summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders/Ghc.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-08-21 23:12:37 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2022-09-13 11:04:38 +0000
commitec6cd1fcf0d939026357d30ee4254a6faeec16f6 (patch)
treeeee76d9b2217f0f047062387c2d74512e6a0afe8 /hadrian/src/Settings/Builders/Ghc.hs
parent7f009c1e61942530a9679bf6c19907e36a025e8a (diff)
downloadhaskell-ec6cd1fcf0d939026357d30ee4254a6faeec16f6.tar.gz
hadrian: Add some more packages to multi-cradle
The main improvement here is to pass `-this-unit-id` for executables so that they can be added to the multi-cradle if desired as well as normal library packages.
Diffstat (limited to 'hadrian/src/Settings/Builders/Ghc.hs')
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index 04e6d160d7..88bd26bd62 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -13,6 +13,7 @@ import qualified Context as Context
import Rules.Libffi (libffiName)
import qualified Data.Set as Set
import System.Directory
+import Data.Version.Extra
ghcBuilderArgs :: Args
ghcBuilderArgs = mconcat
@@ -245,12 +246,15 @@ wayGhcArgs = do
packageGhcArgs :: Args
packageGhcArgs = do
package <- getPackage
+ ghc_ver <- readVersion <$> (expr . ghcVersionStage =<< getStage)
pkgId <- expr $ pkgIdentifier package
mconcat [ arg "-hide-all-packages"
, arg "-no-user-package-db"
, arg "-package-env -"
, packageDatabaseArgs
- , libraryPackage ? arg ("-this-unit-id " ++ pkgId)
+ -- We want to pass -this-unit-id for executables as well for multi-repl to
+ -- work with executable packages but this is buggy on GHC-9.0.2
+ , (isLibrary package || (ghc_ver >= makeVersion [9,2,1])) ? arg ("-this-unit-id " ++ pkgId)
, map ("-package-id " ++) <$> getContextData depIds ]
includeGhcArgs :: Args