Skip to content

Commit

Permalink
Merge pull request #5143 from alexbiehl/pr/enable-documentation
Browse files Browse the repository at this point in the history
Make --enable-documentation work
  • Loading branch information
23Skidoo authored Feb 14, 2018
2 parents 669fe7a + 2fdb838 commit c094940
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 16 additions & 1 deletion cabal-install/Distribution/Client/ProjectBuilding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions cabal-install/Distribution/Client/ProjectConfig/Legacy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,10 @@ convertToLegacySharedConfig :: ProjectConfig -> LegacySharedConfig
convertToLegacySharedConfig
ProjectConfig {
projectConfigBuildOnly = ProjectConfigBuildOnly {..},
projectConfigShared = ProjectConfigShared {..}
projectConfigShared = ProjectConfigShared {..},
projectConfigAllPackages = PackageConfig {
packageConfigDocumentation
}
} =

LegacySharedConfig {
Expand Down Expand Up @@ -536,7 +539,7 @@ convertToLegacySharedConfig
}

installFlags = InstallFlags {
installDocumentation = mempty,
installDocumentation = packageConfigDocumentation,
installHaddockIndex = projectConfigHaddockIndex,
installDest = Flag NoCopyDest,
installDryRun = projectConfigDryRun,
Expand Down
3 changes: 2 additions & 1 deletion cabal-install/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c094940

Please sign in to comment.