diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-08-21 23:12:37 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-09-13 11:04:38 +0000 |
commit | ec6cd1fcf0d939026357d30ee4254a6faeec16f6 (patch) | |
tree | eee76d9b2217f0f047062387c2d74512e6a0afe8 | |
parent | 7f009c1e61942530a9679bf6c19907e36a025e8a (diff) | |
download | haskell-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.
-rw-r--r-- | hadrian/src/Rules/ToolArgs.hs | 17 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/Ghc.hs | 6 |
2 files changed, 12 insertions, 11 deletions
diff --git a/hadrian/src/Rules/ToolArgs.hs b/hadrian/src/Rules/ToolArgs.hs index e07d5743c4..6bcdafdcdf 100644 --- a/hadrian/src/Rules/ToolArgs.hs +++ b/hadrian/src/Rules/ToolArgs.hs @@ -79,8 +79,6 @@ multiSetup pkg_s = do (Ghc ToolArgs stage0InTree) [] ["ignored"] arg_list <- interpret fake_target getArgs let c = Context stage0InTree p (if windowsHost then vanilla else dynamic) Inplace -- Critical use of Inplace, one of the main motivations! - -- readContextData has the effect of configuring the package so all - -- dependent packages will also be built. cd <- readContextData c srcs <- hsSources c gens <- interpretInContext c generatedDependencies @@ -128,7 +126,6 @@ mkToolTarget es p = do let fake_target = target context (Ghc ToolArgs stage0InTree) [] ["ignored"] -- Generate any source files for this target - cd <- readContextData context srcs <- hsSources context gens <- interpretInContext context generatedDependencies @@ -154,17 +151,17 @@ toolTargets = [ binary , directory , process , exceptions --- , ghc # depends on ghc library --- , runGhc # depends on ghc library + -- , ghc -- # depends on ghc library + -- , runGhc -- # depends on ghc library , ghcBoot , ghcBootTh , ghcHeap , ghci --- , ghcPkg # executable --- , haddock # depends on ghc library --- , hsc2hs # executable + , ghcPkg -- # executable + -- , haddock -- # depends on ghc library + , hsc2hs -- # executable , hpc --- , hpcBin # executable + , hpcBin -- # executable , mtl , parsec , time @@ -172,7 +169,7 @@ toolTargets = [ binary , text , terminfo , transformers --- , unlit # executable + , unlit -- # executable ] ++ if windowsHost then [ win32 ] else [ unix ] -- | Create a mapping from files to which component it belongs to. 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 |