Skip to content
Snippets Groups Projects
Commit ae69d046 authored by Matthew Pickering's avatar Matthew Pickering
Browse files

Fix `EXTRA_HC_OPTS` variable when using `cabal-3.8.1.0`

In cabal 3.8.1.0 --ghc-options specified on command line only passes the options to local packages. Therefore setting `EXTRA_HC_OPTS=-dcore-lint` will only pass the option to the top-level package when it's built but none of the dependencies. This at least wastes work later if we try and recompile a dependency, or worse, it might just be we never compile it with core-lint.

Instead we should modify the `cabal.project` and add a section like:

```
package *
   ghc-options: -dcore-lint
```

Fixes #66
parent 5a7f4853
No related branches found
No related tags found
No related merge requests found
......@@ -86,8 +86,7 @@ cabalOptions cfg =
(configLoggingWrapper cfg)
in
configCabalOptions cfg ++
compilerOption ++
concatMap (\opt -> ["--ghc-options", opt]) (configGhcOptions cfg)
compilerOption
config :: Parser TestPatches.Config
config =
......@@ -313,6 +312,7 @@ buildPackage cfg pname version = do
createDirectoryIfMissing True dirName
copyFile "cabal.project" (dirName </> "cabal.project")
appendFile (dirName </> "cabal.project") "packages: .\n"
appendFile (dirName </> "cabal.project") $ "package *\n ghc-options:" ++ unwords (configGhcOptions cfg)
TIO.writeFile
(dirName </> concat ["test-", display pname, ".cabal"])
(makeTestCabalFile cfg pname version)
......
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