Repository navigation
Closed
Description
@ekmett has many packages, even "low level" ones, which use custom setup scripts. Examples:
- https://hackage.haskell.org/package/distributive
- https://hackage.haskell.org/package/comonad
- https://hackage.haskell.org/package/zippers
Grepping for generateBuildModule on Hackage will give you quite a parcel.
The boilerplate for these setup scripts is quite similar. This function is copy pasted quite a bit:
generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
generateBuildModule verbosity pkg lbi = do
let dir = autogenModulesDir lbi
createDirectoryIfMissingVerbose verbosity True dir
withLibLBI pkg lbi $ \_ libcfg -> do
withTestLBI pkg lbi $ \suite suitecfg -> do
rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines
[ "module Build_" ++ testName suite ++ " where"
, "deps :: [String]"
, "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))
]
where
formatdeps = map (formatone . snd)
formatone p = case packageName p of
PackageName n -> n ++ "-" ++ showVersion (packageVersion p)
testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]
testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ysAny reason why Paths can't support this?
I've also seen it used for Haddock:
haddockOutputDir :: Package p => HaddockFlags -> p -> FilePath
haddockOutputDir flags pkg = destDir where
baseDir = case haddockDistPref flags of
NoFlag -> "."
Flag x -> x
destDir = baseDir </> "doc" </> "html" </> display (packageName pkg)I don't know what kind of bug this is working around. Eek!
It would be great if the Kmett-verse could get off Custom scripts. It will take time, because they have big Cabal support windows. But the change starts here.
Reacted by Mikhail Glushenkov and Duncan Coutts
Activity
ekmett commentedon Sep 6, 2016
I also have a few scripts that copy an extra image or something into the haddock directory.
I think the lens script does so.
23Skidoo commentedon Sep 6, 2016
Don't we have
extra-doc-filesfor that?ekmett commentedon Sep 6, 2016
Since around 1.18 right? I've yet to be able to make the switch.
phadej commentedon Sep 6, 2016
@ezyang, the
deps(andautogen_dir) variable is needed to drivedoctests, seeI.e. if there would be declarative way to run
doctests: profit.23Skidoo commentedon Sep 6, 2016
@ekmett Yes, since 1.18: 49a2be9, 4502e90. Though it looks like we don't have a version check for it in
D.PD.Check.23Skidoo commentedon Sep 11, 2016
Fixed in #3825.
RyanGlScott commentedon Jan 11, 2017
@phadej: Re the declarative way to run
doctests: would #2327 give us this ability?phadej commentedon Jan 11, 2017
@RyanGlScott, yes, AFAICS the doctests are the only reason Edward's packages use Custom setup.
5 remaining items
hvr commentedon Aug 31, 2018
@ekmett well, do your users actually need to be able to invoke the doctest-testsuite with legacy cabal versions? It's quite possible that we can implement this in a similar way to the
custom-setupwhich is ignored by cabal versions not gnostic to it.ekmett commentedon Sep 4, 2018
@hvr That might work.
RyanGlScott commentedon Jan 10, 2021
Using
cabal-docspec, we've managed to remove the use of customSetupscripts for most repos in the Kmettiverse. I'm not sure if that's enough to warrant closing this issue—your call.ekmett commentedon Feb 21, 2021
I'm willing to declare intent to move the rest to
cabal-docspec.ulysses4ever commentedon Jul 10, 2022
I built an intersection of two lists
Hackage grep result for
generateBuildModule(as suggested above, this is a good evidence of a Edward's work)List of packages where Edward is listed as a maintainer
Here's the result with comments:
So, these all look kinda dated. I propose we close this issue as completed (thanks to maintainers of respective packages, mostly Ryan).
Mikolaj commentedon Jul 11, 2022
Well done. Thank you. Closing.