Commit ef41f44e authored by Edward Z. Yang's avatar Edward Z. Yang

Distinguish between component ID and unit ID.

GHC 8.0 is switching the state sponsored way to specify
linker names from -this-package-key to -this-unit-id, so
it behooves us to use the right one.  But it didn't make
much sense to pass ComponentIds to a flag named UnitId,
so I went ahead and finished a (planned) refactoring
to distinguish ComponentIds from UnitIds.

At the moment, there is NO difference between a ComponentId
and a UnitId; they are identical.  But semantically, a
component ID records what sources/flags we chose (giving us enough
information to typecheck a package), whereas a unit ID records
the component ID as well as how holes were instantiated
(giving us enough information to build it.)  MOST code
in the Cabal library wants unit IDs, but there are a few
places (macros and configuration) where we really do
want a component ID.

Some other refactorings that got caught up in here:

    - Changed the type of componentCompatPackageKey to String, reflecting the
      fact that it's not truly a UnitId or ComponentId.

    - Changed the behavior of CURRENT_PACKAGE_KEY to unconditionally
      give the compatibility package key, which is actually what you
      want if you're using it for the template Haskell trick.  I also
      added a CURRENT_COMPONENT_ID macro for the actual component ID,
      which is something that the Cabal test-suite will find useful.

    - Added the correct feature test for GHC 8.0 ("Uses unit IDs").
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 4e9017fc
......@@ -28,6 +28,7 @@
module Distribution.InstalledPackageInfo (
InstalledPackageInfo(..),
installedComponentId,
OriginalModule(..), ExposedModule(..),
ParseResult(..), PError(..), PWarning,
emptyInstalledPackageInfo,
......@@ -40,7 +41,7 @@ module Distribution.InstalledPackageInfo (
import Distribution.ParseUtils
import Distribution.License
import Distribution.Package hiding (installedComponentId)
import Distribution.Package hiding (installedUnitId)
import qualified Distribution.Package as Package
import Distribution.ModuleName
import Distribution.Version
......@@ -60,9 +61,9 @@ import GHC.Generics (Generic)
data InstalledPackageInfo
= InstalledPackageInfo {
-- these parts are exactly the same as PackageDescription
sourcePackageId :: PackageId,
installedComponentId:: ComponentId,
compatPackageKey :: ComponentId,
sourcePackageId :: PackageId,
installedUnitId :: UnitId,
compatPackageKey :: String,
license :: License,
copyright :: String,
maintainer :: String,
......@@ -87,7 +88,7 @@ data InstalledPackageInfo
extraGHCiLibraries:: [String], -- overrides extraLibraries for GHCi
includeDirs :: [FilePath],
includes :: [String],
depends :: [ComponentId],
depends :: [UnitId],
ccOptions :: [String],
ldOptions :: [String],
frameworkDirs :: [FilePath],
......@@ -98,13 +99,17 @@ data InstalledPackageInfo
}
deriving (Eq, Generic, Read, Show)
installedComponentId :: InstalledPackageInfo -> ComponentId
installedComponentId ipi = case installedUnitId ipi of
SimpleUnitId cid -> cid
instance Binary InstalledPackageInfo
instance Package.Package InstalledPackageInfo where
packageId = sourcePackageId
instance Package.HasComponentId InstalledPackageInfo where
installedComponentId = installedComponentId
instance Package.HasUnitId InstalledPackageInfo where
installedUnitId = installedUnitId
instance Package.PackageInstalled InstalledPackageInfo where
installedDepends = depends
......@@ -112,9 +117,9 @@ instance Package.PackageInstalled InstalledPackageInfo where
emptyInstalledPackageInfo :: InstalledPackageInfo
emptyInstalledPackageInfo
= InstalledPackageInfo {
sourcePackageId = PackageIdentifier (PackageName "") (Version [] []),
installedComponentId = ComponentId "",
compatPackageKey = ComponentId "",
sourcePackageId = PackageIdentifier (PackageName "") (Version [] []),
installedUnitId = mkUnitId "",
compatPackageKey = "",
license = UnspecifiedLicense,
copyright = "",
maintainer = "",
......@@ -153,7 +158,7 @@ emptyInstalledPackageInfo
data OriginalModule
= OriginalModule {
originalPackageId :: ComponentId,
originalPackageId :: UnitId,
originalModuleName :: ModuleName
}
deriving (Generic, Eq, Read, Show)
......@@ -246,9 +251,10 @@ basicFieldDescrs =
packageVersion (\ver pkg -> pkg{sourcePackageId=(sourcePackageId pkg){pkgVersion=ver}})
, simpleField "id"
disp parse
installedComponentId (\pk pkg -> pkg{installedComponentId=pk})
installedUnitId (\pk pkg -> pkg{installedUnitId=pk})
-- NB: parse these as component IDs
, simpleField "key"
disp parse
(disp . ComponentId) (fmap (\(ComponentId s) -> s) parse)
compatPackageKey (\pk pkg -> pkg{compatPackageKey=pk})
, simpleField "license"
disp parseLicenseQ
......
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-----------------------------------------------------------------------------
-- |
......@@ -23,6 +24,8 @@ module Distribution.Package (
-- * Package keys/installed package IDs (used for linker symbols)
ComponentId(..),
UnitId(..),
mkUnitId,
getHSLibraryName,
InstalledPackageId, -- backwards compat
......@@ -37,7 +40,7 @@ module Distribution.Package (
-- * Package classes
Package(..), packageName, packageVersion,
HasComponentId(..),
HasUnitId(..),
PackageInstalled(..),
) where
......@@ -132,8 +135,17 @@ instance NFData ComponentId where
rnf (ComponentId pk) = rnf pk
-- | Returns library name prefixed with HS, suitable for filenames
getHSLibraryName :: ComponentId -> String
getHSLibraryName (ComponentId s) = "HS" ++ s
getHSLibraryName :: UnitId -> String
getHSLibraryName (SimpleUnitId (ComponentId s)) = "HS" ++ s
-- | For now, there is no distinction between component IDs
-- and unit IDs in Cabal.
newtype UnitId = SimpleUnitId ComponentId
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data, Binary, Text, NFData)
-- | Makes a simple-style UnitId from a string.
mkUnitId :: String -> UnitId
mkUnitId = SimpleUnitId . ComponentId
-- ------------------------------------------------------------
-- * Package source dependencies
......@@ -194,8 +206,8 @@ instance Package PackageIdentifier where
packageId = id
-- | Packages that have an installed package ID
class Package pkg => HasComponentId pkg where
installedComponentId :: pkg -> ComponentId
class Package pkg => HasUnitId pkg where
installedUnitId :: pkg -> UnitId
-- | Class of installed packages.
--
......@@ -203,8 +215,8 @@ class Package pkg => HasComponentId pkg where
-- 'InstalledPackageInfo', but when we are doing install plans in Cabal install
-- we may have other, installed package-like things which contain more metadata.
-- Installed packages have exact dependencies 'installedDepends'.
class (HasComponentId pkg) => PackageInstalled pkg where
installedDepends :: pkg -> [ComponentId]
class (HasUnitId pkg) => PackageInstalled pkg where
installedDepends :: pkg -> [UnitId]
-- -----------------------------------------------------------------------------
-- ABI hash
......
......@@ -118,6 +118,6 @@ benchOption pkg_descr lbi bm template =
fromPathTemplate $ substPathTemplate env template
where
env = initialPathTemplateEnv
(PD.package pkg_descr) (LBI.localComponentId lbi)
(PD.package pkg_descr) (LBI.localUnitId lbi)
(compilerInfo $ LBI.compiler lbi) (LBI.hostPlatform lbi) ++
[(BenchmarkNameVar, toPathTemplate $ PD.benchmarkName bm)]
......@@ -381,17 +381,20 @@ testSuiteLibV09AsLibAndExe pkg_descr
libExposed = True,
libBuildInfo = bi
}
-- NB: temporary hack; I have a refactor which solves this
cid = computeComponentId (package pkg_descr)
(CTestName (testName test))
(map fst (componentPackageDeps clbi))
(map ((\(SimpleUnitId cid0) -> cid0) . fst)
(componentPackageDeps clbi))
(flagAssignment lbi)
uid = SimpleUnitId cid
(pkg_name, compat_key) = computeCompatPackageKey
(compiler lbi) (package pkg_descr)
(CTestName (testName test)) cid
(CTestName (testName test)) uid
libClbi = LibComponentLocalBuildInfo
{ componentPackageDeps = componentPackageDeps clbi
, componentPackageRenaming = componentPackageRenaming clbi
, componentId = cid
, componentUnitId = uid
, componentCompatPackageKey = compat_key
, componentExposedModules = [IPI.ExposedModule m Nothing]
}
......@@ -420,7 +423,7 @@ testSuiteLibV09AsLibAndExe pkg_descr
-- that exposes the relevant test suite library.
exeClbi = ExeComponentLocalBuildInfo {
componentPackageDeps =
(IPI.installedComponentId ipi, packageId ipi)
(IPI.installedUnitId ipi, packageId ipi)
: (filter (\(_, x) -> let PackageName name = pkgName x
in name == "Cabal" || name == "base")
(componentPackageDeps clbi)),
......
......@@ -30,10 +30,8 @@ import Distribution.Version
( Version(versionBranch) )
import Distribution.PackageDescription
( PackageDescription )
import Distribution.Simple.Compiler
( packageKeySupported )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(compiler, withPrograms), externalPackageDeps, localComponentId )
( LocalBuildInfo(withPrograms), externalPackageDeps, localComponentId, localCompatPackageKey )
import Distribution.Simple.Program.Db
( configuredPrograms )
import Distribution.Simple.Program.Types
......@@ -96,14 +94,14 @@ generateMacros prefix name version =
where
(major1:major2:minor:_) = map show (versionBranch version ++ repeat 0)
-- | Generate the @CURRENT_PACKAGE_KEY@ definition for the package key
-- of the current package, if supported by the compiler.
-- NB: this only makes sense for definite packages.
-- | Generate the @CURRENT_COMPONENT_ID@ definition for the component ID
-- of the current package.
generateComponentIdMacro :: LocalBuildInfo -> String
generateComponentIdMacro lbi
| packageKeySupported (compiler lbi) =
"#define CURRENT_PACKAGE_KEY \"" ++ display (localComponentId lbi) ++ "\"\n\n"
| otherwise = ""
generateComponentIdMacro lbi =
concat
[ "#define CURRENT_COMPONENT_ID \"" ++ display (localComponentId lbi) ++ "\"\n\n"
, "#define CURRENT_PACKAGE_KEY \"" ++ localCompatPackageKey lbi ++ "\"\n\n"
]
fixchar :: Char -> Char
fixchar '-' = '_'
......
......@@ -76,16 +76,16 @@ haddockName pkg_descr = display (packageName pkg_descr) <.> "haddock"
-- ---------------------------------------------------------------------------
-- Library file names
mkLibName :: ComponentId -> String
mkLibName :: UnitId -> String
mkLibName lib = "lib" ++ getHSLibraryName lib <.> "a"
mkProfLibName :: ComponentId -> String
mkProfLibName :: UnitId -> String
mkProfLibName lib = "lib" ++ getHSLibraryName lib ++ "_p" <.> "a"
-- Implement proper name mangling for dynamical shared objects
-- libHS<packagename>-<compilerFlavour><compilerVersion>
-- e.g. libHSbase-2.1-ghc6.6.1.so
mkSharedLibName :: CompilerId -> ComponentId -> String
mkSharedLibName :: CompilerId -> UnitId -> String
mkSharedLibName (CompilerId compilerFlavor compilerVersion) lib
= "lib" ++ getHSLibraryName lib ++ "-" ++ comp <.> dllExtension
where comp = display compilerFlavor ++ display compilerVersion
......
......@@ -55,6 +55,7 @@ module Distribution.Simple.Compiler (
renamingPackageFlagsSupported,
unifiedIPIDRequired,
packageKeySupported,
unitIdSupported,
-- * Support for profiling detail levels
ProfDetailLevel(..),
......@@ -286,6 +287,10 @@ unifiedIPIDRequired = ghcSupported "Requires unified installed package IDs"
packageKeySupported :: Compiler -> Bool
packageKeySupported = ghcSupported "Uses package keys"
-- | Does this compiler support unit IDs?
unitIdSupported :: Compiler -> Bool
unitIdSupported = ghcSupported "Uses unit IDs"
-- | Utility function for GHC only features
ghcSupported :: String -> Compiler -> Bool
ghcSupported key comp =
......
......@@ -415,12 +415,12 @@ configure (pkg_descr0, pbi) cfg = do
let installDeps = Map.elems -- deduplicate
. Map.fromList
. map (\v -> (Installed.installedComponentId v, v))
. map (\v -> (Installed.installedUnitId v, v))
$ externalPkgDeps
packageDependsIndex <-
case PackageIndex.dependencyClosure installedPackageSet
(map Installed.installedComponentId installDeps) of
(map Installed.installedUnitId installDeps) of
Left packageDependsIndex -> return packageDependsIndex
Right broken ->
die $ "The following installed packages are broken because other"
......@@ -433,11 +433,11 @@ configure (pkg_descr0, pbi) cfg = do
| (pkg, deps) <- broken ]
let pseudoTopPkg = emptyInstalledPackageInfo {
Installed.installedComponentId =
ComponentId (display (packageId pkg_descr)),
Installed.installedUnitId =
mkUnitId (display (packageId pkg_descr)),
Installed.sourcePackageId = packageId pkg_descr,
Installed.depends =
map Installed.installedComponentId installDeps
map Installed.installedUnitId installDeps
}
case PackageIndex.dependencyInconsistencies
. PackageIndex.insert pseudoTopPkg
......@@ -738,9 +738,9 @@ getInternalPackages pkg_descr0 =
--TODO: should use a per-compiler method to map the source
-- package ID into an installed package id we can use
-- for the internal package set. The open-codes use of
-- ComponentId . display here is a hack.
Installed.installedComponentId =
ComponentId $ display $ pid,
-- mkUnitId here is a hack.
Installed.installedUnitId =
mkUnitId $ display $ pid,
Installed.sourcePackageId = pid
}
in PackageIndex.fromList [internalPackage]
......@@ -1084,15 +1084,15 @@ newPackageDepsBehaviour pkg =
-- deps in the end. So we still need to remember which installed packages to
-- pick.
combinedConstraints :: [Dependency] ->
[(PackageName, ComponentId)] ->
[(PackageName, UnitId)] ->
InstalledPackageIndex ->
Either String ([Dependency],
Map PackageName InstalledPackageInfo)
combinedConstraints constraints dependencies installedPackages = do
when (not (null badComponentIds)) $
when (not (null badUnitIds)) $
Left $ render $ text "The following package dependencies were requested"
$+$ nest 4 (dispDependencies badComponentIds)
$+$ nest 4 (dispDependencies badUnitIds)
$+$ text "however the given installed package instance does not exist."
when (not (null badNames)) $
......@@ -1116,19 +1116,19 @@ combinedConstraints constraints dependencies installedPackages = do
| (_, _, Just pkg) <- dependenciesPkgInfo ]
-- The dependencies along with the installed package info, if it exists
dependenciesPkgInfo :: [(PackageName, ComponentId,
dependenciesPkgInfo :: [(PackageName, UnitId,
Maybe InstalledPackageInfo)]
dependenciesPkgInfo =
[ (pkgname, ipkgid, mpkg)
| (pkgname, ipkgid) <- dependencies
, let mpkg = PackageIndex.lookupComponentId
, let mpkg = PackageIndex.lookupUnitId
installedPackages ipkgid
]
-- If we looked up a package specified by an installed package id
-- (i.e. someone has written a hash) and didn't find it then it's
-- an error.
badComponentIds =
badUnitIds =
[ (pkgname, ipkgid)
| (pkgname, ipkgid, Nothing) <- dependenciesPkgInfo ]
......@@ -1455,10 +1455,10 @@ computeCompatPackageKey
:: Compiler
-> PackageIdentifier
-> ComponentName
-> ComponentId
-> (PackageName, ComponentId)
computeCompatPackageKey comp pid cname cid@(ComponentId str)
| not (packageKeySupported comp) =
-> UnitId
-> (PackageName, String)
computeCompatPackageKey comp pid cname uid@(SimpleUnitId (ComponentId str))
| not (packageKeySupported comp || unitIdSupported comp) =
-- NB: the package ID in the database entry has to follow this
let zdashcode s = go s (Nothing :: Maybe Int) []
where go [] _ r = reverse r
......@@ -1479,7 +1479,7 @@ computeCompatPackageKey comp pid cname cid@(ComponentId str)
| cname == CLibName = display pid
| otherwise = display package_name ++ "-"
++ display (pkgVersion pid)
in (package_name, ComponentId old_style_key)
in (package_name, old_style_key)
| not (unifiedIPIDRequired comp) =
let mb_verbatim_key
= case simpleParse str :: Maybe PackageId of
......@@ -1494,9 +1494,9 @@ computeCompatPackageKey comp pid cname cid@(ComponentId str)
then Just cand
else Nothing
rehashed_key = hashToBase62 str
in (pkgName pid, ComponentId $ fromMaybe rehashed_key
in (pkgName pid, fromMaybe rehashed_key
(mb_verbatim_key `mplus` mb_truncated_key))
| otherwise = (pkgName pid, cid)
| otherwise = (pkgName pid, display uid)
mkComponentsLocalBuildInfo :: ConfigFlags
-> Compiler
......@@ -1518,15 +1518,16 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
-- Hack to reuse install dirs machinery
-- NB: no real IPID available at this point
let env = packageTemplateEnv (package pkg_descr)
(ComponentId "")
(mkUnitId "")
str = fromPathTemplate
(InstallDirs.substPathTemplate env (toPathTemplate cid0))
in ComponentId str
_ ->
computeComponentId (package pkg_descr) CLibName (getDeps CLibName) flagAssignment
(_, compat_key) = computeCompatPackageKey comp (package pkg_descr) CLibName cid
uid = SimpleUnitId cid
(_, compat_key) = computeCompatPackageKey comp (package pkg_descr) CLibName uid
sequence
[ do clbi <- componentLocalBuildInfo cid compat_key c
[ do clbi <- componentLocalBuildInfo uid compat_key c
return (componentName c, clbi, cdeps)
| (c, cdeps) <- graph ]
where
......@@ -1541,14 +1542,14 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
-- we just take the subset for the package names this component
-- needs. Note, this only works because we cannot yet depend on two
-- versions of the same package.
componentLocalBuildInfo cid compat_key component =
componentLocalBuildInfo uid compat_key component =
case component of
CLib lib -> do
let exports = map (\n -> Installed.ExposedModule n Nothing)
(PD.exposedModules lib)
let mb_reexports = resolveModuleReexports installedPackages
(packageId pkg_descr)
cid
uid
externalPkgDeps lib
reexports <- case mb_reexports of
Left problems -> reportModuleReexportProblems problems
......@@ -1556,7 +1557,7 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
return LibComponentLocalBuildInfo {
componentPackageDeps = cpds,
componentId = cid,
componentUnitId = uid,
componentCompatPackageKey = compat_key,
componentPackageRenaming = cprns,
componentExposedModules = exports ++ reexports
......@@ -1581,11 +1582,11 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
dedup = Map.toList . Map.fromList
cpds = if newPackageDepsBehaviour pkg_descr
then dedup $
[ (Installed.installedComponentId pkg, packageId pkg)
[ (Installed.installedUnitId pkg, packageId pkg)
| pkg <- selectSubset bi externalPkgDeps ]
++ [ (cid, pkgid)
++ [ (uid, pkgid)
| pkgid <- selectSubset bi internalPkgDeps ]
else [ (Installed.installedComponentId pkg, packageId pkg)
else [ (Installed.installedUnitId pkg, packageId pkg)
| pkg <- externalPkgDeps ]
cprns = if newPackageDepsBehaviour pkg_descr
then targetBuildRenaming bi
......@@ -1612,7 +1613,7 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
--
resolveModuleReexports :: InstalledPackageIndex
-> PackageId
-> ComponentId
-> UnitId
-> [InstalledPackageInfo]
-> Library
-> Either [(ModuleReexport, String)] -- errors
......@@ -1633,9 +1634,9 @@ resolveModuleReexports installedPackages srcpkgid key externalPkgDeps lib =
exposedModule)])
-- The package index here contains all the indirect deps of the
-- package we're configuring, but we want just the direct deps
| let directDeps = Set.fromList (map Installed.installedComponentId externalPkgDeps)
| let directDeps = Set.fromList (map Installed.installedUnitId externalPkgDeps)
, pkg <- PackageIndex.allPackages installedPackages
, Installed.installedComponentId pkg `Set.member` directDeps
, Installed.installedUnitId pkg `Set.member` directDeps
, let exportingPackageName = packageName pkg
, exposedModule <- visibleModuleDetails pkg
]
......@@ -1662,7 +1663,7 @@ resolveModuleReexports installedPackages srcpkgid key externalPkgDeps lib =
-- The first case is the modules actually defined in this package.
-- In this case the reexport will point to this package.
Nothing -> return exposedModule { Installed.exposedReexport =
Just (Installed.OriginalModule (Installed.installedComponentId pkg)
Just (Installed.OriginalModule (Installed.installedUnitId pkg)
(Installed.exposedName exposedModule)) }
-- On the other hand, a visible module might actually be itself
-- a re-export! In this case, the re-export info for the package
......
......@@ -475,9 +475,9 @@ buildOrReplLib :: Bool -> Verbosity -> Cabal.Flag (Maybe Int)
-> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
let libName = componentId clbi
let libName = componentUnitId clbi
libTargetDir
| componentId clbi == localComponentId lbi = buildDir lbi
| componentUnitId clbi == localUnitId lbi = buildDir lbi
| otherwise = buildDir lbi </> display libName
whenVanillaLib forceVanilla =
when (forceVanilla || withVanillaLib lbi)
......@@ -1140,7 +1140,7 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do
>>= installOrdinaryFiles verbosity targetDir
cid = compilerId (compiler lbi)
libName = componentId clbi
libName = componentUnitId clbi
vanillaLibName = mkLibName libName
profileLibName = mkProfLibName libName
ghciLibName = Internal.mkGHCiLibName libName
......
......@@ -14,7 +14,7 @@ module Distribution.Simple.GHC.IPI642 (
) where
import qualified Distribution.InstalledPackageInfo as Current
import qualified Distribution.Package as Current hiding (installedComponentId)
import qualified Distribution.Package as Current hiding (installedUnitId)
import Distribution.Simple.GHC.IPIConvert
import Distribution.Text
......@@ -61,8 +61,8 @@ data InstalledPackageInfo = InstalledPackageInfo {
}
deriving Read
mkComponentId :: Current.PackageIdentifier -> Current.ComponentId
mkComponentId = Current.ComponentId . display
mkUnitId :: Current.PackageIdentifier -> Current.UnitId
mkUnitId = Current.mkUnitId . display
toCurrent :: InstalledPackageInfo -> Current.InstalledPackageInfo
toCurrent ipi@InstalledPackageInfo{} =
......@@ -70,8 +70,8 @@ toCurrent ipi@InstalledPackageInfo{} =
mkExposedModule m = Current.ExposedModule m Nothing
in Current.InstalledPackageInfo {
Current.sourcePackageId = pid,
Current.installedComponentId = mkComponentId pid,
Current.compatPackageKey = mkComponentId pid,
Current.installedUnitId = mkUnitId pid,
Current.compatPackageKey = "",
Current.abiHash = Current.AbiHash "", -- bogus but old GHCs don't care.
Current.license = convertLicense (license ipi),
Current.copyright = copyright ipi,
......@@ -95,7 +95,7 @@ toCurrent ipi@InstalledPackageInfo{} =
Current.extraGHCiLibraries = extraGHCiLibraries ipi,
Current.includeDirs = includeDirs ipi,
Current.includes = includes ipi,
Current.depends = map (mkComponentId.convertPackageId) (depends ipi),
Current.depends = map (mkUnitId.convertPackageId) (depends ipi),
Current.ccOptions = ccOptions ipi,
Current.ldOptions = ldOptions ipi,
Current.frameworkDirs = frameworkDirs ipi,
......
......@@ -14,7 +14,7 @@ module Distribution.Simple.GHC.IPIConvert (
convertModuleName
) where
import qualified Distribution.Package as Current hiding (installedComponentId)
import qualified Distribution.Package as Current hiding (installedUnitId)
import qualified Distribution.License as Current
import Distribution.Version
......
......@@ -357,7 +357,7 @@ componentGhcOptions verbosity lbi bi clbi odir =
ghcOptVerbosity = toFlag verbosity,
ghcOptHideAllPackages = toFlag True,
ghcOptCabal = toFlag True,
ghcOptComponentId = case clbi of
ghcOptThisUnitId = case clbi of
LibComponentLocalBuildInfo { componentCompatPackageKey = pk }
-> toFlag pk
_ -> Mon.mempty,
......@@ -409,7 +409,7 @@ filterGhciFlags = filter supported
supported "-unreg" = False
supported _ = True
mkGHCiLibName :: ComponentId -> String
mkGHCiLibName :: UnitId -> String
mkGHCiLibName lib = getHSLibraryName lib <.> "o"
ghcLookupProperty :: String -> Compiler -> Bool
......@@ -440,7 +440,7 @@ getHaskellObjects implInfo lib lbi pref wanted_obj_ext allow_split_objs
| x <- libModules lib ]
mkGhcOptPackages :: ComponentLocalBuildInfo
-> [(ComponentId, PackageId, ModuleRenaming)]
-> [(UnitId, PackageId, ModuleRenaming)]
mkGhcOptPackages clbi =
map (\(i,p) -> (i,p,lookupRenaming p (componentPackageRenaming clbi)))
(componentPackageDeps clbi)
......
......@@ -274,7 +274,7 @@ buildOrReplLib :: Bool -> Verbosity -> Cabal.Flag (Maybe Int)
-> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildOrReplLib forRepl verbosity numJobs _pkg_descr lbi lib clbi = do
let libName@(ComponentId cname) = componentId clbi
let libName = componentUnitId clbi
libTargetDir = buildDir lbi
whenVanillaLib forceVanilla =
when (not forRepl && (forceVanilla || withVanillaLib lbi))
......@@ -300,6 +300,9 @@ buildOrReplLib forRepl verbosity numJobs _pkg_descr lbi lib clbi = do
-- Determine if program coverage should be enabled and if so, what
-- '-hpcdir' should be.
let isCoverageEnabled = fromFlag $ configCoverage $