diff --git a/cabal-install/Distribution/Client/ProjectBuilding.hs b/cabal-install/Distribution/Client/ProjectBuilding.hs index 1e91b5e187c..10a2a93df03 100644 --- a/cabal-install/Distribution/Client/ProjectBuilding.hs +++ b/cabal-install/Distribution/Client/ProjectBuilding.hs @@ -936,6 +936,13 @@ buildAndInstallUnpackedPackage verbosity annotateFailure mlogFile BuildFailed $ setup buildCommand buildFlags + -- Haddock phase + whenHaddock $ do + when isParallelBuild $ + notice verbosity $ "Generating " ++ dispname ++ " documentation..." + annotateFailureNoLog HaddocksFailed $ + setup haddockCommand haddockFlags + -- Install phase annotateFailure mlogFile InstallFailed $ do @@ -954,7 +961,7 @@ buildAndInstallUnpackedPackage verbosity -- While this breaks the prefix-relocatable property of the lirbaries -- it is necessary on macOS to stay under the load command limit of the -- macOS mach-o linker. See also @PackageHash.hashedInstalledPackageIdVeryShort@. - otherFiles <- filter (not . isPrefixOf entryDir) <$> listFilesRecursive tmpDir + otherFiles <- filter (not . isPrefixOf entryDir) <$> listFilesRecursive tmpDir -- here's where we could keep track of the installed files ourselves -- if we wanted to by making a manifest of the files in the tmp dir return (entryDir, otherFiles) @@ -1022,6 +1029,10 @@ buildAndInstallUnpackedPackage verbosity isParallelBuild = buildSettingNumJobs >= 2 + whenHaddock action + | elabBuildHaddocks pkg = action + | otherwise = return () + configureCommand = Cabal.configureCommand defaultProgramDb configureFlags v = flip filterConfigureFlags v $ setupHsConfigureFlags rpkg pkgshared @@ -1031,6 +1042,10 @@ buildAndInstallUnpackedPackage verbosity buildCommand = Cabal.buildCommand defaultProgramDb buildFlags _ = setupHsBuildFlags pkg pkgshared verbosity builddir + haddockCommand = Cabal.haddockCommand + haddockFlags _ = setupHsHaddockFlags pkg pkgshared + verbosity builddir + generateInstalledPackageInfo :: IO InstalledPackageInfo generateInstalledPackageInfo = withTempInstalledPackageInfoFile diff --git a/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs b/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs index b0c048b0d4a..f6ce8e45b51 100644 --- a/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs +++ b/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs @@ -490,7 +490,10 @@ convertToLegacySharedConfig :: ProjectConfig -> LegacySharedConfig convertToLegacySharedConfig ProjectConfig { projectConfigBuildOnly = ProjectConfigBuildOnly {..}, - projectConfigShared = ProjectConfigShared {..} + projectConfigShared = ProjectConfigShared {..}, + projectConfigAllPackages = PackageConfig { + packageConfigDocumentation + } } = LegacySharedConfig { @@ -536,7 +539,7 @@ convertToLegacySharedConfig } installFlags = InstallFlags { - installDocumentation = mempty, + installDocumentation = packageConfigDocumentation, installHaddockIndex = projectConfigHaddockIndex, installDest = Flag NoCopyDest, installDryRun = projectConfigDryRun, diff --git a/cabal-install/Distribution/Client/ProjectPlanning.hs b/cabal-install/Distribution/Client/ProjectPlanning.hs index 4cb7ebb1c22..d4d09407e0e 100644 --- a/cabal-install/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/Distribution/Client/ProjectPlanning.hs @@ -1675,7 +1675,8 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB elabTestTargets = [] elabBenchTargets = [] elabReplTarget = Nothing - elabBuildHaddocks = False + elabBuildHaddocks = + perPkgOptionFlag pkgid False packageConfigDocumentation elabPkgSourceLocation = srcloc elabPkgSourceHash = Map.lookup pkgid sourcePackageHashes