Skip to content

Commit

Permalink
Haddock: use buildSettingKeepTempFiles
Browse files Browse the repository at this point in the history
This commit initialises the Haddock flag haddockKeepTempFiles with the
value of buildSettingKeepTempFiles.

This addresses an 8 year old TODO in the code, from Duncan Coutts.
  • Loading branch information
sheaf committed May 3, 2024
1 parent bfd9bfb commit 7765d52
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ buildAndRegisterUnpackedPackage
verbosity
distDirLayout@DistDirLayout{distTempDirectory}
maybe_semaphore
BuildTimeSettings{buildSettingNumJobs}
buildTimeSettings@BuildTimeSettings{buildSettingNumJobs}
registerLock
cacheLock
pkgshared@ElaboratedSharedConfig
Expand Down Expand Up @@ -329,6 +329,7 @@ buildAndRegisterUnpackedPackage
setupHsHaddockFlags
pkg
pkgshared
buildTimeSettings
(commonFlags v)
haddockArgs v =
flip filterHaddockArgs v $
Expand Down
71 changes: 38 additions & 33 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4101,41 +4101,46 @@ setupHsRegisterFlags
setupHsHaddockFlags
:: ElaboratedConfiguredPackage
-> ElaboratedSharedConfig
-> BuildTimeSettings
-> Cabal.CommonSetupFlags
-> Cabal.HaddockFlags
setupHsHaddockFlags (ElaboratedConfiguredPackage{..}) (ElaboratedSharedConfig{..}) common =
Cabal.HaddockFlags
{ haddockCommonFlags = common
, haddockProgramPaths =
case lookupProgram haddockProgram pkgConfigCompilerProgs of
Nothing -> mempty
Just prg ->
[
( programName haddockProgram
, locationPath (programLocation prg)
)
]
, haddockProgramArgs = mempty -- unused, set at configure time
, haddockHoogle = toFlag elabHaddockHoogle
, haddockHtml = toFlag elabHaddockHtml
, haddockHtmlLocation = maybe mempty toFlag elabHaddockHtmlLocation
, haddockForHackage = toFlag elabHaddockForHackage
, haddockForeignLibs = toFlag elabHaddockForeignLibs
, haddockExecutables = toFlag elabHaddockExecutables
, haddockTestSuites = toFlag elabHaddockTestSuites
, haddockBenchmarks = toFlag elabHaddockBenchmarks
, haddockInternal = toFlag elabHaddockInternal
, haddockCss = maybe mempty toFlag elabHaddockCss
, haddockLinkedSource = toFlag elabHaddockLinkedSource
, haddockQuickJump = toFlag elabHaddockQuickJump
, haddockHscolourCss = maybe mempty toFlag elabHaddockHscolourCss
, haddockContents = maybe mempty toFlag elabHaddockContents
, haddockKeepTempFiles = mempty -- TODO: from build settings
, haddockIndex = maybe mempty toFlag elabHaddockIndex
, haddockBaseUrl = maybe mempty toFlag elabHaddockBaseUrl
, haddockLib = maybe mempty toFlag elabHaddockLib
, haddockOutputDir = maybe mempty toFlag elabHaddockOutputDir
}
setupHsHaddockFlags
(ElaboratedConfiguredPackage{..})
(ElaboratedSharedConfig{..})
(BuildTimeSettings{buildSettingKeepTempFiles = keepTmpFiles})
common =
Cabal.HaddockFlags
{ haddockCommonFlags = common
, haddockProgramPaths =
case lookupProgram haddockProgram pkgConfigCompilerProgs of
Nothing -> mempty
Just prg ->
[
( programName haddockProgram
, locationPath (programLocation prg)
)
]
, haddockProgramArgs = mempty -- unused, set at configure time
, haddockHoogle = toFlag elabHaddockHoogle
, haddockHtml = toFlag elabHaddockHtml
, haddockHtmlLocation = maybe mempty toFlag elabHaddockHtmlLocation
, haddockForHackage = toFlag elabHaddockForHackage
, haddockForeignLibs = toFlag elabHaddockForeignLibs
, haddockExecutables = toFlag elabHaddockExecutables
, haddockTestSuites = toFlag elabHaddockTestSuites
, haddockBenchmarks = toFlag elabHaddockBenchmarks
, haddockInternal = toFlag elabHaddockInternal
, haddockCss = maybe mempty toFlag elabHaddockCss
, haddockLinkedSource = toFlag elabHaddockLinkedSource
, haddockQuickJump = toFlag elabHaddockQuickJump
, haddockHscolourCss = maybe mempty toFlag elabHaddockHscolourCss
, haddockContents = maybe mempty toFlag elabHaddockContents
, haddockKeepTempFiles = toFlag keepTmpFiles
, haddockIndex = maybe mempty toFlag elabHaddockIndex
, haddockBaseUrl = maybe mempty toFlag elabHaddockBaseUrl
, haddockLib = maybe mempty toFlag elabHaddockLib
, haddockOutputDir = maybe mempty toFlag elabHaddockOutputDir
}

setupHsHaddockArgs :: ElaboratedConfiguredPackage -> [String]
-- TODO: Does the issue #3335 affects test as well
Expand Down

0 comments on commit 7765d52

Please sign in to comment.