diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2023-03-16 11:35:17 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-05-04 14:58:14 -0400 |
commit | db4be3395cb74eb07355339184123d5ded331dc3 (patch) | |
tree | 69ccc565d5e4253d74adc44cfbabf39d41061424 /hadrian/src/Rules/Generate.hs | |
parent | 6689c9c6eba6f538bedfe7a08316d7c5dec8bfae (diff) | |
download | haskell-db4be3395cb74eb07355339184123d5ded331dc3.tar.gz |
Add hashes to unit-ids created by hadrian
This commit adds support for computing an inputs hash for packages
compiled by hadrian. The result is that ABI incompatible packages should
be given different hashes and therefore be distinct in a cabal store.
Hashing is enabled by the `--flag`, and is off by default as the hash
contains a hash of the source files. We enable it when we produce
release builds so that the artifacts we distribute have the right unit
ids.
Diffstat (limited to 'hadrian/src/Rules/Generate.hs')
-rw-r--r-- | hadrian/src/Rules/Generate.hs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index c38d454617..6aa9f19b47 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -14,6 +14,7 @@ import Oracles.Flag import Oracles.ModuleFiles import Oracles.Setting import Hadrian.Haskell.Cabal.Type (PackageData(version)) +import Hadrian.Haskell.Cabal import Hadrian.Oracles.Cabal (readPackageData) import Packages import Rules.Libffi @@ -483,16 +484,15 @@ generateConfigHs = do trackGenerateHs cProjectName <- getSetting ProjectName cBooterVersion <- getSetting GhcVersion - cProjectVersionMunged <- getSetting ProjectVersionMunged - -- ROMES:TODO:HASH First we attempt a fixed unit-id with version but without hash. - -- - -- We now use a more informative unit-id for ghc. See Note [GHC's Unit Id] - -- in GHC.Unit.Types + -- We now give a unit-id with a version and a hash to ghc. + -- See Note [GHC's Unit Id] in GHC.Unit.Types -- -- It's crucial that the unit-id matches the unit-key -- ghc is no longer -- part of the WiringMap, so we don't to go back and forth between the - -- unit-id and the unit-key -- we take care here that they are the same. - let cProjectUnitId = "ghc-" ++ cProjectVersionMunged -- ROMES:TODO:HASH + -- unit-id and the unit-key -- we take care that they are the same by using + -- 'pkgUnitId' on 'compiler' (the ghc-library package) to create the + -- unit-id in both situations. + cProjectUnitId <- expr . (`pkgUnitId` compiler) =<< getStage return $ unlines [ "module GHC.Settings.Config" , " ( module GHC.Version" @@ -589,3 +589,5 @@ generatePlatformHostHs = do , "hostPlatformArchOS :: ArchOS" , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" ] + + |