Skip to content

Commit 9b0bbd0

Browse files
authored
Merge pull request #6827 from commercialhaskell/fix6826
Fix #6826 Ignore the `mainLibraryHasExposedModules package` test
2 parents 33d6b9a + 7567626 commit 9b0bbd0

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Behavior changes:
2222
* When building GHC from source, on Windows, the default Hadrian build target is
2323
`reloc-binary-dist` and the default path to the GHC built by Hadrian is
2424
`_build/reloc-bindist`.
25+
* Stack's `haddock` command no longer requires a package to have a main library
26+
that exposes modules.
2527

2628
Other enhancements:
2729

doc/commands/build_command.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,6 @@ sets this flag.
348348
Stack applies Haddock's `--gen-contents` and `--gen-index` flags to generate a
349349
single HTML contents and index for multiple sets of Haddock documentation.
350350

351-
!!! note
352-
353-
If a package does not have a main library that exposes modules, Haddock
354-
documentation will not be built for that package, irrespective of the flag.
355-
356351
!!! warning
357352

358353
On Windows, the values for the `haddock-interfaces` and `haddock-html` keys

src/Stack/Build/ExecutePackage.hs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ import Stack.Coverage ( generateHpcReport, updateTixFile )
8282
import Stack.GhcPkg ( ghcPkg, ghcPkgPathEnvVar, unregisterGhcPkgIds )
8383
import Stack.Package
8484
( buildLogPath, buildableExes, buildableSubLibs
85-
, hasBuildableMainLibrary, mainLibraryHasExposedModules
85+
, hasBuildableMainLibrary
8686
)
8787
import Stack.PackageDump ( conduitDumpPackage, ghcPkgDescribe )
8888
import Stack.Prelude
@@ -347,8 +347,10 @@ announceTask ee taskType action = logInfo $
347347

348348
-- | Implements running a package's build, used to implement
349349
-- 'Control.Concurrent.Execute.ATBuild' and
350-
-- 'Control.Concurrent.Execute.ATBuildFinal' tasks. In particular this does the
351-
-- following:
350+
-- 'Control.Concurrent.Execute.ATBuildFinal' tasks. The latter is a task for
351+
-- building a package's benchmarks and test-suites.
352+
--
353+
-- In particular this does the following:
352354
--
353355
-- * Checks if the package exists in the precompiled cache, and if so, add it to
354356
-- the database instead of performing the build.
@@ -471,12 +473,9 @@ realConfigAndBuild
471473
where
472474
pkgId = taskProvides task
473475
PackageIdentifier pname _ = pkgId
474-
doHaddock curator package =
476+
doHaddock curator =
475477
task.buildHaddocks
476478
&& not isFinalBuild
477-
-- Works around haddock failing on bytestring-builder since it has no
478-
-- modules when bytestring is new enough.
479-
&& mainLibraryHasExposedModules package
480479
-- Special help for the curator tool to avoid haddocks that are known
481480
-- to fail
482481
&& maybe True (Set.notMember pname . (.skipHaddock)) curator
@@ -593,7 +592,7 @@ realConfigAndBuild
593592
postBuildCheck True
594593

595594
mcurator <- view $ buildConfigL . to (.curator)
596-
when (doHaddock mcurator package) $ do
595+
when (doHaddock mcurator) $ do
597596
let isTaskTargetMutable = taskTargetIsMutable task == Mutable
598597
isHaddockForHackage =
599598
ee.buildOpts.haddockForHackage && isTaskTargetMutable

src/Stack/Package.hs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module Stack.Package
2323
, packageDependencies
2424
, applyForceCustomBuild
2525
, hasBuildableMainLibrary
26-
, mainLibraryHasExposedModules
2726
, packageUnknownTools
2827
, buildableForeignLibs
2928
, buildableSubLibs
@@ -651,15 +650,6 @@ hasBuildableMainLibrary :: Package -> Bool
651650
hasBuildableMainLibrary package =
652651
maybe False isComponentBuildable package.library
653652

654-
-- | Check if the main library has any exposed modules.
655-
--
656-
-- This should become irrelevant at some point since there's nothing inherently
657-
-- wrong or different with packages exposing only modules in internal libraries
658-
-- (for instance).
659-
mainLibraryHasExposedModules :: Package -> Bool
660-
mainLibraryHasExposedModules package =
661-
maybe False (not . null . (.exposedModules)) package.library
662-
663653
-- | Aggregate all unknown tools from all components. Mostly meant for
664654
-- build tools specified in the legacy manner (build-tools:) that failed the
665655
-- hard-coded lookup. See 'Stack.Types.Component.unknownTools' for more

0 commit comments

Comments
 (0)