summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-01-18 17:32:27 +0100
committerBen Gamari <ben@smart-cactus.org>2016-01-19 00:07:33 +0100
commit240ddd7c39536776e955e881d709bbb039b48513 (patch)
treeb9686cb0e771a268b514a57dc8bec7e31601351c /libraries
parentb8abd852d3674cb485490d2b2e94906c06ee6e8f (diff)
downloadhaskell-240ddd7c39536776e955e881d709bbb039b48513.tar.gz
Switch from -this-package-key to -this-unit-id.
A small cosmetic change, but we have to do a bit of work to actually support it: - Cabal submodule update, so that Cabal passes us -this-unit-id when we ask for it. This includes a Cabal renaming to be consistent with Unit ID, which makes ghc-pkg a bit more scrutable. - Build system is updated to use -this-unit-id rather than -this-package-key, to avoid deprecation warnings. Needs a version test so I resurrected the old test we had (sorry rwbarton!) - I've *undeprecated* -package-name, so that we are in the same state as GHC 7.10, since the "correct" flag will have only entered circulation in GHC 8.0. - I removed -package-key. Since we didn't deprecate -package-id I think this should not cause any problems for users; they can just change their code to use -package-id. - The package database is indexed by UNIT IDs, not component IDs. I updated the naming here. - I dropped the signatures field from ExposedModule; nothing was using it, and instantiatedWith from the package database field. - ghc-pkg was updated to use unit ID nomenclature, I removed the -package-key flags but I decided not to add any new flags for now. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: 23Skidoo, thomie, erikd Differential Revision: https://phabricator.haskell.org/D1780
Diffstat (limited to 'libraries')
m---------libraries/Cabal0
-rw-r--r--libraries/base/base.cabal2
-rw-r--r--libraries/ghc-boot/GHC/PackageDb.hs83
-rw-r--r--libraries/ghc-prim/ghc-prim.cabal2
-rw-r--r--libraries/integer-gmp/integer-gmp.cabal2
-rw-r--r--libraries/integer-simple/integer-simple.cabal4
-rw-r--r--libraries/template-haskell/template-haskell.cabal9
7 files changed, 41 insertions, 61 deletions
diff --git a/libraries/Cabal b/libraries/Cabal
-Subproject a8a121ea4d78783dd303dd2992d8e73ef337e7e
+Subproject ecdf65a3c1e01b798e9d073258a6d1c8ff63a6d
diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal
index cd77e55ee6..7d9367a6be 100644
--- a/libraries/base/base.cabal
+++ b/libraries/base/base.cabal
@@ -362,4 +362,4 @@ Library
-- We need to set the unit id to base (without a version number)
-- as it's magic.
- ghc-options: -this-package-key base
+ ghc-options: -this-unit-id base
diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs
index 2be20b2405..cc03c3b17f 100644
--- a/libraries/ghc-boot/GHC/PackageDb.hs
+++ b/libraries/ghc-boot/GHC/PackageDb.hs
@@ -64,15 +64,14 @@ import System.Directory
-- | This is a subset of Cabal's 'InstalledPackageInfo', with just the bits
-- that GHC is interested in.
--
-data InstalledPackageInfo instpkgid srcpkgid srcpkgname pkgkey modulename
+data InstalledPackageInfo srcpkgid srcpkgname unitid modulename
= InstalledPackageInfo {
- componentId :: instpkgid,
+ unitId :: unitid,
sourcePackageId :: srcpkgid,
packageName :: srcpkgname,
packageVersion :: Version,
- unitId :: pkgkey,
abiHash :: String,
- depends :: [pkgkey],
+ depends :: [unitid],
importDirs :: [FilePath],
hsLibraries :: [String],
extraLibraries :: [String],
@@ -86,9 +85,8 @@ data InstalledPackageInfo instpkgid srcpkgid srcpkgname pkgkey modulename
includeDirs :: [FilePath],
haddockInterfaces :: [FilePath],
haddockHTMLs :: [FilePath],
- exposedModules :: [ExposedModule pkgkey modulename],
+ exposedModules :: [ExposedModule unitid modulename],
hiddenModules :: [modulename],
- instantiatedWith :: [(modulename,OriginalModule pkgkey modulename)],
exposed :: Bool,
trusted :: Bool
}
@@ -98,40 +96,30 @@ data InstalledPackageInfo instpkgid srcpkgid srcpkgname pkgkey modulename
-- plus module name) representing where a module was *originally* defined
-- (i.e., the 'exposedReexport' field of the original ExposedModule entry should
-- be 'Nothing'). Invariant: an OriginalModule never points to a reexport.
-data OriginalModule pkgkey modulename
+data OriginalModule unitid modulename
= OriginalModule {
- originalPackageId :: pkgkey,
+ originalPackageId :: unitid,
originalModuleName :: modulename
}
deriving (Eq, Show)
-- | Represents a module name which is exported by a package, stored in the
--- 'exposedModules' field. A module export may be a reexport (in which
--- case 'exposedReexport' is filled in with the original source of the module),
--- and may be a signature (in which case 'exposedSignature is filled in with
--- what the signature was compiled against). Thus:
+-- 'exposedModules' field. A module export may be a reexport (in which case
+-- 'exposedReexport' is filled in with the original source of the module).
+-- Thus:
--
--- * @ExposedModule n Nothing Nothing@ represents an exposed module @n@ which
+-- * @ExposedModule n Nothing@ represents an exposed module @n@ which
-- was defined in this package.
--
--- * @ExposedModule n (Just o) Nothing@ represents a reexported module @n@
+-- * @ExposedModule n (Just o)@ represents a reexported module @n@
-- which was originally defined in @o@.
--
--- * @ExposedModule n Nothing (Just s)@ represents an exposed signature @n@
--- which was compiled against the implementation @s@.
---
--- * @ExposedModule n (Just o) (Just s)@ represents a reexported signature
--- which was originally defined in @o@ and was compiled against the
--- implementation @s@.
---
--- We use two 'Maybe' data types instead of an ADT with four branches or
--- four fields because this representation allows us to treat
--- reexports/signatures uniformly.
-data ExposedModule pkgkey modulename
+-- We use a 'Maybe' data types instead of an ADT with two branches because this
+-- representation allows us to treat reexports uniformly.
+data ExposedModule unitid modulename
= ExposedModule {
exposedName :: modulename,
- exposedReexport :: Maybe (OriginalModule pkgkey modulename),
- exposedSignature :: Maybe (OriginalModule pkgkey modulename)
+ exposedReexport :: Maybe (OriginalModule unitid modulename)
}
deriving (Eq, Show)
@@ -140,15 +128,14 @@ class BinaryStringRep a where
toStringRep :: a -> BS.ByteString
emptyInstalledPackageInfo :: (BinaryStringRep a, BinaryStringRep b,
- BinaryStringRep c, BinaryStringRep d)
- => InstalledPackageInfo a b c d e
+ BinaryStringRep c)
+ => InstalledPackageInfo a b c d
emptyInstalledPackageInfo =
InstalledPackageInfo {
- componentId = fromStringRep BS.empty,
+ unitId = fromStringRep BS.empty,
sourcePackageId = fromStringRep BS.empty,
packageName = fromStringRep BS.empty,
packageVersion = Version [] [],
- unitId = fromStringRep BS.empty,
abiHash = "",
depends = [],
importDirs = [],
@@ -166,7 +153,6 @@ emptyInstalledPackageInfo =
haddockHTMLs = [],
exposedModules = [],
hiddenModules = [],
- instantiatedWith = [],
exposed = False,
trusted = False
}
@@ -174,8 +160,8 @@ emptyInstalledPackageInfo =
-- | Read the part of the package DB that GHC is interested in.
--
readPackageDbForGhc :: (BinaryStringRep a, BinaryStringRep b, BinaryStringRep c,
- BinaryStringRep d, BinaryStringRep e) =>
- FilePath -> IO [InstalledPackageInfo a b c d e]
+ BinaryStringRep d) =>
+ FilePath -> IO [InstalledPackageInfo a b c d]
readPackageDbForGhc file =
decodeFromFile file getDbForGhc
where
@@ -208,8 +194,8 @@ readPackageDbForGhcPkg file =
-- | Write the whole of the package DB, both parts.
--
writePackageDb :: (Binary pkgs, BinaryStringRep a, BinaryStringRep b,
- BinaryStringRep c, BinaryStringRep d, BinaryStringRep e) =>
- FilePath -> [InstalledPackageInfo a b c d e] -> pkgs -> IO ()
+ BinaryStringRep c, BinaryStringRep d) =>
+ FilePath -> [InstalledPackageInfo a b c d] -> pkgs -> IO ()
writePackageDb file ghcPkgs ghcPkgPart =
writeFileAtomic file (runPut putDbForGhcPkg)
where
@@ -296,20 +282,19 @@ writeFileAtomic targetPath content = do
renameFile tmpPath targetPath)
instance (BinaryStringRep a, BinaryStringRep b, BinaryStringRep c,
- BinaryStringRep d, BinaryStringRep e) =>
- Binary (InstalledPackageInfo a b c d e) where
+ BinaryStringRep d) =>
+ Binary (InstalledPackageInfo a b c d) where
put (InstalledPackageInfo
- componentId sourcePackageId
- packageName packageVersion unitId
+ unitId sourcePackageId
+ packageName packageVersion
abiHash depends importDirs
hsLibraries extraLibraries extraGHCiLibraries libraryDirs
frameworks frameworkDirs
ldOptions ccOptions
includes includeDirs
haddockInterfaces haddockHTMLs
- exposedModules hiddenModules instantiatedWith
+ exposedModules hiddenModules
exposed trusted) = do
- put (toStringRep componentId)
put (toStringRep sourcePackageId)
put (toStringRep packageName)
put packageVersion
@@ -331,12 +316,10 @@ instance (BinaryStringRep a, BinaryStringRep b, BinaryStringRep c,
put haddockHTMLs
put exposedModules
put (map toStringRep hiddenModules)
- put (map (\(k,v) -> (toStringRep k, v)) instantiatedWith)
put exposed
put trusted
get = do
- componentId <- get
sourcePackageId <- get
packageName <- get
packageVersion <- get
@@ -358,14 +341,12 @@ instance (BinaryStringRep a, BinaryStringRep b, BinaryStringRep c,
haddockHTMLs <- get
exposedModules <- get
hiddenModules <- get
- instantiatedWith <- get
exposed <- get
trusted <- get
return (InstalledPackageInfo
- (fromStringRep componentId)
+ (fromStringRep unitId)
(fromStringRep sourcePackageId)
(fromStringRep packageName) packageVersion
- (fromStringRep unitId)
abiHash
(map fromStringRep depends)
importDirs
@@ -376,7 +357,6 @@ instance (BinaryStringRep a, BinaryStringRep b, BinaryStringRep c,
haddockInterfaces haddockHTMLs
exposedModules
(map fromStringRep hiddenModules)
- (map (\(k,v) -> (fromStringRep k, v)) instantiatedWith)
exposed trusted)
instance (BinaryStringRep a, BinaryStringRep b) =>
@@ -392,14 +372,11 @@ instance (BinaryStringRep a, BinaryStringRep b) =>
instance (BinaryStringRep a, BinaryStringRep b) =>
Binary (ExposedModule a b) where
- put (ExposedModule exposedName exposedReexport exposedSignature) = do
+ put (ExposedModule exposedName exposedReexport) = do
put (toStringRep exposedName)
put exposedReexport
- put exposedSignature
get = do
exposedName <- get
exposedReexport <- get
- exposedSignature <- get
return (ExposedModule (fromStringRep exposedName)
- exposedReexport
- exposedSignature)
+ exposedReexport)
diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal
index 1f09b45fca..2077e6d799 100644
--- a/libraries/ghc-prim/ghc-prim.cabal
+++ b/libraries/ghc-prim/ghc-prim.cabal
@@ -68,4 +68,4 @@ Library
-- We need to set the unit ID to ghc-prim (without a version number)
-- as it's magic.
- ghc-options: -this-package-key ghc-prim
+ ghc-options: -this-unit-id ghc-prim
diff --git a/libraries/integer-gmp/integer-gmp.cabal b/libraries/integer-gmp/integer-gmp.cabal
index 5b5fb56ffe..377efb39f9 100644
--- a/libraries/integer-gmp/integer-gmp.cabal
+++ b/libraries/integer-gmp/integer-gmp.cabal
@@ -48,7 +48,7 @@ library
UnliftedFFITypes
build-depends: ghc-prim
hs-source-dirs: src/
- ghc-options: -this-package-key integer-gmp -Wall
+ ghc-options: -this-unit-id integer-gmp -Wall
cc-options: -std=c99 -Wall
include-dirs: include
diff --git a/libraries/integer-simple/integer-simple.cabal b/libraries/integer-simple/integer-simple.cabal
index f958aa8201..0c05ad71ec 100644
--- a/libraries/integer-simple/integer-simple.cabal
+++ b/libraries/integer-simple/integer-simple.cabal
@@ -26,6 +26,6 @@ Library
other-modules: GHC.Integer.Type
default-extensions: CPP, MagicHash, BangPatterns, UnboxedTuples,
UnliftedFFITypes, NoImplicitPrelude
- -- We need to set the package name to integer-simple
+ -- We need to set the unit ID to integer-simple
-- (without a version number) as it's magic.
- ghc-options: -this-package-key integer-simple -Wall
+ ghc-options: -this-unit-id integer-simple -Wall
diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal
index aae8afee59..b96e122610 100644
--- a/libraries/template-haskell/template-haskell.cabal
+++ b/libraries/template-haskell/template-haskell.cabal
@@ -55,7 +55,10 @@ Library
-- version number) as it's magic.
ghc-options: -Wall
- if impl( ghc >= 7.9 )
- ghc-options: -this-package-key template-haskell
+ if impl( ghc >= 7.11 )
+ ghc-options: -this-unit-id template-haskell
else
- ghc-options: -package-name template-haskell
+ if impl( ghc >= 7.9 )
+ ghc-options: -this-package-key template-haskell
+ else
+ ghc-options: -package-name template-haskell