Skip to content
Snippets Groups Projects
Unverified Commit 3e051f6a authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub
Browse files

Merge pull request #9007 from fendor/fix/testsuite-generate-confhook

Generate cabal-testsuite modules at configure time
parents a191f0a2 444a7729
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
......@@ -10,19 +10,21 @@ import Distribution.Simple.Utils
import Distribution.Types.LocalBuildInfo
import Distribution.Types.ModuleRenaming
import Distribution.Types.UnqualComponentName
import Distribution.Verbosity
import System.Directory
import System.FilePath
main :: IO ()
main = defaultMainWithHooks simpleUserHooks
{ buildHook = \pkg lbi hooks flags -> do
generateScriptEnvModule lbi flags
buildHook simpleUserHooks pkg lbi hooks flags
{ confHook = \args flags -> do
lbi <- confHook simpleUserHooks args flags
generateScriptEnvModule lbi (fromFlagOrDefault minBound (configVerbosity flags))
pure lbi
}
generateScriptEnvModule :: LocalBuildInfo -> BuildFlags -> IO ()
generateScriptEnvModule lbi flags = do
generateScriptEnvModule :: LocalBuildInfo -> Verbosity -> IO ()
generateScriptEnvModule lbi verbosity = do
lbiPackageDbStack <- mapM canonicalizePackageDB (withPackageDB lbi)
createDirectoryIfMissing True moduledir
......@@ -55,7 +57,6 @@ generateScriptEnvModule lbi flags = do
, "lbiWithSharedLib = " ++ show (withSharedLib lbi)
]
where
verbosity = fromFlagOrDefault minBound (buildVerbosity flags)
moduledir = libAutogenDir </> "Test" </> "Cabal"
-- fixme: use component-specific folder
libAutogenDir = autogenPackageModulesDir lbi
......
synopsis: Generate cabal-testsuite modules at configure time
packages: cabal-testsuite
prs: #9007
description: {
Generate modules required by cabal-testsuite at configure time rather than build time.
This allows to run `cabal repl cabal-testsuite` out of the box.
In addition, enables HLS support for `cabal-testsuite`.
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment