Skip to content

Commit

Permalink
Reenable GHC environment file support
Browse files Browse the repository at this point in the history
This was temporarily disabled via
3033776 due to haskell#4010
but it turns out that we can easily workaround this for
older Cabal versions.

All we need to do is inject `--ghc-options=-hide-all-packages` into
the flags passed to Setup.hs when an old `Cabal` version is detected
(this was suggested by @dcoutts in
haskell#4010 (comment))

Luckily, `-hide-all-packages` is idempotent in GHC, so we can place it
anywhere on the GHC command-line as well as multiple times with the
same result.

This would close haskell#4010

(cherry picked from commit 6fc90eb34259170aa4949d2d127c942899f3351e)
  • Loading branch information
hvr authored and bgamari committed Aug 27, 2017
1 parent 500542b commit b230c11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions cabal-install/Distribution/Client/ProjectPlanOutput.hs
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,6 @@ writePlanGhcEnvironment DistDirLayout{distProjectRootDirectory}
| compilerFlavor compiler == GHC
, supportsPkgEnvFiles (getImplInfo compiler)
--TODO: check ghcjs compat
--TODO: This feature is temporarily disabled due to #4010
, False
= writeGhcEnvironmentFile
distProjectRootDirectory
platform (compilerVersion compiler)
Expand Down
8 changes: 7 additions & 1 deletion cabal-install/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2980,7 +2980,13 @@ setupHsConfigureFlags (ReadyPackage elab@ElaboratedConfiguredPackage{..})
ElabComponent _ -> toFlag elabComponentId

configProgramPaths = Map.toList elabProgramPaths
configProgramArgs = Map.toList elabProgramArgs
configProgramArgs
| elabSetupScriptCliVersion < mkVersion [1,24,2]
-- workaround for https://github.com/haskell/cabal/issues/4010
= Map.toList $
Map.insertWith (++) "ghc" ["-hide-all-packages"]
elabProgramArgs
| otherwise = Map.toList elabProgramArgs
configProgramPathExtra = toNubList elabProgramPathExtra
configHcFlavor = toFlag (compilerFlavor pkgConfigCompiler)
configHcPath = mempty -- we use configProgramPaths instead
Expand Down

0 comments on commit b230c11

Please sign in to comment.