@@ -39,7 +39,9 @@ import Distribution.Client.ProjectPlanning
3939 , TargetAction (.. )
4040 )
4141import Distribution.Client.ProjectPlanning.Types
42- ( elabDistDirParams
42+ ( Toolchain (.. )
43+ , elabDistDirParams
44+ , getStage
4345 )
4446import Distribution.Client.ScriptUtils
4547 ( AcceptNoTargets (.. )
@@ -71,18 +73,11 @@ import Distribution.Simple.Flag
7173 , pattern Flag
7274 , pattern NoFlag
7375 )
74- import Distribution.Simple.Haddock (createHaddockIndex )
76+
77+ -- import Distribution.Simple.Haddock (createHaddockIndex)
7578import Distribution.Simple.InstallDirs
7679 ( toPathTemplate
7780 )
78- import Distribution.Simple.Program.Builtin
79- ( haddockProgram
80- )
81- import Distribution.Simple.Program.Db
82- ( addKnownProgram
83- , reconfigurePrograms
84- , requireProgramVersion
85- )
8681import Distribution.Simple.Setup
8782 ( HaddockFlags (.. )
8883 , HaddockProjectFlags (.. )
@@ -103,8 +98,6 @@ import Distribution.Types.PackageDescription (PackageDescription (benchmarks, su
10398import Distribution.Types.PackageId (pkgName )
10499import Distribution.Types.PackageName (unPackageName )
105100import Distribution.Types.UnitId (unUnitId )
106- import Distribution.Types.Version (mkVersion )
107- import Distribution.Types.VersionRange (orLaterVersion )
108101import Distribution.Verbosity as Verbosity
109102 ( normal
110103 )
@@ -170,24 +163,26 @@ haddockProjectAction flags _extraArgs globalFlags = do
170163 pkgs :: [Either InstalledPackageInfo ElaboratedConfiguredPackage ]
171164 pkgs = matchingPackages elaboratedPlan
172165
173- progs <-
174- reconfigurePrograms
175- verbosity
176- (haddockProjectProgramPaths flags)
177- (haddockProjectProgramArgs flags)
178- -- we need to insert 'haddockProgram' before we reconfigure it,
179- -- otherwise 'set
180- . addKnownProgram haddockProgram
181- . pkgConfigCompilerProgs
182- $ sharedConfig
183- let sharedConfig' = sharedConfig{pkgConfigCompilerProgs = progs}
184-
185- _ <-
186- requireProgramVersion
187- verbosity
188- haddockProgram
189- (orLaterVersion (mkVersion [2 , 26 , 1 ]))
190- progs
166+ -- TODO
167+ -- progs <-
168+ -- reconfigurePrograms
169+ -- verbosity
170+ -- (haddockProjectProgramPaths flags)
171+ -- (haddockProjectProgramArgs flags)
172+ -- -- we need to insert 'haddockProgram' before we reconfigure it,
173+ -- -- otherwise 'set
174+ -- . addKnownProgram haddockProgram
175+ -- . pkgConfigCompilerProgs
176+ -- $ sharedConfig
177+ -- let sharedConfig' = sharedConfig{pkgConfigCompilerProgs = progs}
178+ let sharedConfig' = sharedConfig
179+
180+ -- _ <-
181+ -- requireProgramVersion
182+ -- verbosity
183+ -- haddockProgram
184+ -- (orLaterVersion (mkVersion [2, 26, 1]))
185+ -- progs
191186
192187 --
193188 -- Build project; we need to build dependencies.
@@ -302,10 +297,12 @@ haddockProjectAction flags _extraArgs globalFlags = do
302297 False -> do
303298 let pkg_descr = elabPkgDescription package
304299 unitId = unUnitId (elabUnitId package)
300+ compilers = toolchainCompiler <$> pkgConfigToolchains sharedConfig'
301+ compiler = getStage compilers (elabStage package)
305302 packageDir =
306303 storePackageDirectory
307304 (cabalStoreDirLayout cabalLayout)
308- (pkgConfigCompiler sharedConfig')
305+ compiler
309306 (elabUnitId package)
310307 -- TODO: use `InstallDirTemplates`
311308 docDir = packageDir </> " share" </> " doc" </> " html"
@@ -325,7 +322,7 @@ haddockProjectAction flags _extraArgs globalFlags = do
325322 -- generate index, content, etc.
326323 --
327324
328- let (missingHaddocks, packageInfos ') = partitionEithers packageInfos
325+ let (missingHaddocks, _packageInfos ') = partitionEithers packageInfos
329326 when (not (null missingHaddocks)) $ do
330327 warn verbosity " missing haddocks for some packages from the store"
331328 -- Show the package list if `-v1` is passed; it's usually a long list.
@@ -334,28 +331,31 @@ haddockProjectAction flags _extraArgs globalFlags = do
334331 -- `documentation: True` in the global config).
335332 info verbosity (intercalate " \n " missingHaddocks)
336333
337- let flags' =
338- flags
339- { haddockProjectDir = Flag outputDir
340- , haddockProjectInterfaces =
341- Flag
342- [ ( interfacePath
343- , Just url
344- , Just url
345- , visibility
346- )
347- | (url, interfacePath, visibility) <- packageInfos'
348- ]
349- , haddockProjectUseUnicode = NoFlag
350- }
351- createHaddockIndex
352- verbosity
353- (pkgConfigCompilerProgs sharedConfig')
354- (pkgConfigCompiler sharedConfig')
355- (pkgConfigPlatform sharedConfig')
356- Nothing
357- flags'
334+ warn verbosity " createHaddockIndex not implemented"
358335 where
336+ -- let flags' =
337+ -- flags
338+ -- { haddockProjectDir = Flag outputDir
339+ -- , haddockProjectInterfaces =
340+ -- Flag
341+ -- [ ( interfacePath
342+ -- , Just url
343+ -- , Just url
344+ -- , visibility
345+ -- )
346+ -- | (url, interfacePath, visibility) <- packageInfos'
347+ -- ]
348+ -- , haddockProjectUseUnicode = NoFlag
349+ -- }
350+ -- -- NOTE: this lives in Cabal
351+ -- createHaddockIndex
352+ -- verbosity
353+ -- (toolchainProgramDb $ buildToolchain $ pkgConfigToolchains sharedConfig')
354+ -- (toolchainCompiler $ buildToolchain $ pkgConfigToolchains sharedConfig')
355+ -- (toolchainPlatform $ buildToolchain $ pkgConfigToolchains sharedConfig')
356+ -- Nothing
357+ -- flags'
358+
359359 -- build all packages with appropriate haddock flags
360360 commonFlags = haddockProjectCommonFlags flags
361361
0 commit comments