Commit bddc053a authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Change generation of -package-id parameters to new CLBI entry.



Instead of computing the renamings based on componentPackageRenaming
right before it gets to GHC, compute it *during configure time*.
This will make some refactorings for Backpack easier.

NB: I had to keep componentPackageDeps because removing it would
be a big BC break.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 1ade2203
......@@ -394,7 +394,7 @@ testSuiteLibV09AsLibAndExe pkg_descr
{ componentPackageDeps = componentPackageDeps clbi
, componentLocalName = CLibName (testName test)
, componentIsPublic = False
, componentPackageRenaming = componentPackageRenaming clbi
, componentIncludes = componentIncludes clbi
, componentUnitId = componentUnitId clbi
, componentCompatPackageName = compat_name
, componentCompatPackageKey = compat_key
......@@ -423,17 +423,17 @@ testSuiteLibV09AsLibAndExe pkg_descr
}
-- | The stub executable needs a new 'ComponentLocalBuildInfo'
-- that exposes the relevant test suite library.
deps = (IPI.installedUnitId ipi, packageId ipi)
: (filter (\(_, x) -> let PackageName name = pkgName x
in name == "Cabal" || name == "base")
(componentPackageDeps clbi))
exeClbi = ExeComponentLocalBuildInfo {
-- TODO: this is a hack, but as long as this is unique
-- (doesn't clobber something) we won't run into trouble
componentUnitId = mkUnitId (stubName test),
componentLocalName = CExeName (stubName test),
componentPackageDeps =
(IPI.installedUnitId ipi, packageId ipi)
: (filter (\(_, x) -> let PackageName name = pkgName x
in name == "Cabal" || name == "base")
(componentPackageDeps clbi)),
componentPackageRenaming = Map.empty
componentPackageDeps = deps,
componentIncludes = zip (map fst deps) (repeat defaultRenaming)
}
testSuiteLibV09AsLibAndExe _ TestSuite{} _ _ _ _ = error "testSuiteLibV09AsLibAndExe: wrong kind"
......@@ -454,7 +454,7 @@ benchmarkExeV10asExe bm@Benchmark { benchmarkInterface = BenchmarkExeV10 _ f }
componentUnitId = componentUnitId clbi,
componentLocalName = CExeName (benchmarkName bm),
componentPackageDeps = componentPackageDeps clbi,
componentPackageRenaming = componentPackageRenaming clbi
componentIncludes = componentIncludes clbi
}
benchmarkExeV10asExe Benchmark{} _ = error "benchmarkExeV10asExe: wrong kind"
......
......@@ -1672,7 +1672,7 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
componentIsPublic = libName lib == display (packageName (package pkg_descr)),
componentCompatPackageKey = compat_key,
componentCompatPackageName = compat_name,
componentPackageRenaming = cprns,
componentIncludes = includes,
componentExposedModules = exports ++ reexports
}
CExe _ ->
......@@ -1680,21 +1680,21 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
componentUnitId = uid,
componentLocalName = componentName component,
componentPackageDeps = cpds,
componentPackageRenaming = cprns
componentIncludes = includes
}
CTest _ ->
return TestComponentLocalBuildInfo {
componentUnitId = uid,
componentLocalName = componentName component,
componentPackageDeps = cpds,
componentPackageRenaming = cprns
componentIncludes = includes
}
CBench _ ->
return BenchComponentLocalBuildInfo {
componentUnitId = uid,
componentLocalName = componentName component,
componentPackageDeps = cpds,
componentPackageRenaming = cprns
componentIncludes = includes
}
where
......@@ -1729,6 +1729,7 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr
| pkgid <- selectSubset bi internalPkgDeps ]
else [ (Installed.installedUnitId pkg, packageId pkg)
| pkg <- externalPkgDeps ]
includes = map (\(i,p) -> (i,lookupRenaming p cprns)) cpds
cprns = if newPackageDepsBehaviour pkg_descr
then targetBuildRenaming bi
else Map.empty
......
......@@ -351,12 +351,9 @@ getHaskellObjects _implInfo lib lbi pref wanted_obj_ext allow_split_objs
return [ pref </> ModuleName.toFilePath x <.> wanted_obj_ext
| x <- libModules lib ]
-- TODO: rework me
mkGhcOptPackages :: ComponentLocalBuildInfo
-> [(UnitId, ModuleRenaming)]
mkGhcOptPackages clbi =
map (\(i,p) -> (i,lookupRenaming p (componentPackageRenaming clbi)))
(componentPackageDeps clbi)
mkGhcOptPackages = componentIncludes
substTopDir :: FilePath -> InstalledPackageInfo -> InstalledPackageInfo
substTopDir topDir ipo
......
......@@ -325,25 +325,25 @@ data ComponentLocalBuildInfo
componentCompatPackageName :: PackageName,
componentExposedModules :: [Installed.ExposedModule],
componentIsPublic :: Bool,
componentPackageRenaming :: Map PackageName ModuleRenaming
componentIncludes :: [(UnitId, ModuleRenaming)]
}
| ExeComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentUnitId :: UnitId,
componentPackageDeps :: [(UnitId, PackageId)],
componentPackageRenaming :: Map PackageName ModuleRenaming
componentIncludes :: [(UnitId, ModuleRenaming)]
}
| TestComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentUnitId :: UnitId,
componentPackageDeps :: [(UnitId, PackageId)],
componentPackageRenaming :: Map PackageName ModuleRenaming
componentIncludes :: [(UnitId, ModuleRenaming)]
}
| BenchComponentLocalBuildInfo {
componentLocalName :: ComponentName,
componentUnitId :: UnitId,
componentPackageDeps :: [(UnitId, PackageId)],
componentPackageRenaming :: Map PackageName ModuleRenaming
componentIncludes :: [(UnitId, ModuleRenaming)]
}
deriving (Generic, Read, Show)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment