Refactor Cabal around the idea of "library names".
In GHC 7.10, Cabal always generate package keys, including in
cases where Backpack was involved (e.g. --instantiated-with).
In fact, in these case, GHC needs to be able to generate the
package key (because it will often make a substitution on the
instantiation, and needs to know if this identity coincides with
anything else we've seen previously).
Thus, we introduce a new notion, the 'LibraryName', which
is JUST the non-Backpack portion of a package key. For ordinary
packages that are definite, a 'LibraryName' is simply
the 'PackageId' plus 'PackageKey'; for indefinite Backpack packages,
when a package gets instantiatied, it may end up with different
'PackageKey's even though the 'LibraryName' stays the same.
'LibraryName's can be computed purely by Cabal.
This patch:
- Defines library name, which are the source package ID plus
a hash of all the source package ID and the library names of external,
textual dependencies,
- Redefines the package key to be JUST the hash portion of a
library name, in the case that Backpack is not used,
- Records the library name in InstalledPackageInfo.
Note: the source package ID is included both externally (so the library
name is a useful handle to refer to package) and internally (so the
hash can stand alone as the package key.)
A major refactoring which is part of this commit is moving package keys/library
names from LocalBuildInfo to LibComponentBuildInfo. If you have an LBI, you can
still extract a package key/library name using the new
localPackageKey/localLibraryName function (which looks through the
ComponentBuildInfos of a LocalBuildInfo for the library in question). This is
conceptually cleaner for two reasons:
1. Only dependencies of the *library* are counted as part
of the library name, as opposed to *all* dependencies which
we previously used.
2. A library name doesn't really mean much for an executable,
or a test suite, since no one else will have to link against
them. So we can fall back on something simpler.
A more minor refactoring is the 'LibraryName' type, which was
previously defined by LocalBuildInfo and generally looked something
like "HSprocess-0.1-XXXX". We change the meaning of 'LibraryName'
to be "process-0.1-XXXX" (thus we have to insert some HS additions
in the code) and eliminate componentLibraries, thus assuming that
there is only ONE Haskell library (which was the case.) So
we remove a little bit of generality and in return get code
that is much easier to read. (The only downside is GHC's hack
to split DLLs into multiples has to be adjusted slightly, but
this is not a big price to pay.)
Signed-off-by:
Edward Z. Yang <ezyang@cs.stanford.edu>
Showing
- Cabal/Distribution/InstalledPackageInfo.hs 7 additions, 2 deletionsCabal/Distribution/InstalledPackageInfo.hs
- Cabal/Distribution/Package.hs 57 additions, 60 deletionsCabal/Distribution/Package.hs
- Cabal/Distribution/Simple/Bench.hs 2 additions, 2 deletionsCabal/Distribution/Simple/Bench.hs
- Cabal/Distribution/Simple/Build.hs 9 additions, 15 deletionsCabal/Distribution/Simple/Build.hs
- Cabal/Distribution/Simple/Build/Macros.hs 4 additions, 3 deletionsCabal/Distribution/Simple/Build/Macros.hs
- Cabal/Distribution/Simple/BuildPaths.hs 6 additions, 6 deletionsCabal/Distribution/Simple/BuildPaths.hs
- Cabal/Distribution/Simple/Configure.hs 33 additions, 37 deletionsCabal/Distribution/Simple/Configure.hs
- Cabal/Distribution/Simple/GHC.hs 11 additions, 21 deletionsCabal/Distribution/Simple/GHC.hs
- Cabal/Distribution/Simple/GHC/Internal.hs 11 additions, 4 deletionsCabal/Distribution/Simple/GHC/Internal.hs
- Cabal/Distribution/Simple/GHCJS.hs 17 additions, 26 deletionsCabal/Distribution/Simple/GHCJS.hs
- Cabal/Distribution/Simple/Haddock.hs 3 additions, 4 deletionsCabal/Distribution/Simple/Haddock.hs
- Cabal/Distribution/Simple/InstallDirs.hs 14 additions, 17 deletionsCabal/Distribution/Simple/InstallDirs.hs
- Cabal/Distribution/Simple/LHC.hs 14 additions, 19 deletionsCabal/Distribution/Simple/LHC.hs
- Cabal/Distribution/Simple/LocalBuildInfo.hs 30 additions, 16 deletionsCabal/Distribution/Simple/LocalBuildInfo.hs
- Cabal/Distribution/Simple/Register.hs 6 additions, 6 deletionsCabal/Distribution/Simple/Register.hs
- Cabal/Distribution/Simple/Test.hs 2 additions, 2 deletionsCabal/Distribution/Simple/Test.hs
- Cabal/Distribution/Simple/Test/ExeV10.hs 1 addition, 1 deletionCabal/Distribution/Simple/Test/ExeV10.hs
- Cabal/Distribution/Simple/Test/LibV09.hs 1 addition, 1 deletionCabal/Distribution/Simple/Test/LibV09.hs
- Cabal/Distribution/Simple/Test/Log.hs 1 addition, 1 deletionCabal/Distribution/Simple/Test/Log.hs
- Cabal/tests/PackageTests/DeterministicAr/Check.hs 4 additions, 6 deletionsCabal/tests/PackageTests/DeterministicAr/Check.hs
Loading
Please register or sign in to comment