From ec6cd1fcf0d939026357d30ee4254a6faeec16f6 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Sun, 21 Aug 2022 23:12:37 +0100 Subject: 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. --- hadrian/src/Settings/Builders/Ghc.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'hadrian/src/Settings/Builders/Ghc.hs') 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 -- cgit v1.2.1