diff options
| author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-06-23 13:15:17 -0700 |
|---|---|---|
| committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-07-23 13:35:45 -0700 |
| commit | f9687caf337d409e4735d5bb4cf73a7dc629a58c (patch) | |
| tree | 3f4d0bc7fcd74b66ad750eed4d134c4afdcb7803 /compiler/main/Packages.hs | |
| parent | 5ff4daddd9bc8f424d8f71fb01ebbbae9d608cdf (diff) | |
| download | haskell-f9687caf337d409e4735d5bb4cf73a7dc629a58c.tar.gz | |
Library names, with Cabal submodule update
A library name is a package name, package version, and hash of the
version names of all textual dependencies (i.e. packages which were included.) A library
name is a coarse approximation of installed package IDs, which are suitable for
inclusion in package keys (you don't want to put an IPID in a package key, since
it means the key will change any time the source changes.)
- We define ShPackageKey, which is the semantic object which
is hashed into a PackageKey. You can use 'newPackageKey'
to hash a ShPackageKey to a PackageKey
- Given a PackageKey, we can lookup its ShPackageKey with
'lookupPackageKey'. The way we can do this is by consulting
the 'pkgKeyCache', which records a reverse mapping from
every hash to the ShPackageKey. This means that if you
load in PackageKeys from external sources (e.g. interface
files), you also need to load in a mapping of PackageKeys
to their ShPackageKeys so we can populate the cache.
- We define a 'LibraryName' which encapsulates the full
depenency resolution that Cabal may have selected; this
is opaque to GHC but can be used to distinguish different
versions of a package.
- Definite packages don't have an interesting PackageKey,
so we rely on Cabal to pass them to us.
- We can pretty-print package keys while displaying the
instantiation, but it's not wired up to anything (e.g.
the Outputable instance of PackageKey).
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1056
GHC Trac Issues: #10566
Diffstat (limited to 'compiler/main/Packages.hs')
| -rw-r--r-- | compiler/main/Packages.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 16ee352243..20822476cd 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -363,7 +363,7 @@ initPackages dflags = do Nothing -> readPackageConfigs dflags Just db -> return $ setBatchPackageFlags dflags db (pkg_state, preload, this_pkg) - <- mkPackageState dflags pkg_db [] (thisPackage dflags) + <- mkPackageState dflags pkg_db [] return (dflags{ pkgDatabase = Just pkg_db, pkgState = pkg_state, thisPackage = this_pkg }, @@ -885,15 +885,17 @@ mkPackageState :: DynFlags -> [PackageConfig] -- initial database -> [PackageKey] -- preloaded packages - -> PackageKey -- this package -> IO (PackageState, [PackageKey], -- new packages to preload PackageKey) -- this package, might be modified if the current -- package is a wired-in package. -mkPackageState dflags0 pkgs0 preload0 this_package = do +mkPackageState dflags0 pkgs0 preload0 = do dflags <- interpretPackageEnv dflags0 + -- Compute the package key + let this_package = thisPackage dflags + {- Plan. |
