diff --git a/Cabal/Distribution/Simple/Build.hs b/Cabal/Distribution/Simple/Build.hs index 4afe06f07f7..9b3e3d6f607 100644 --- a/Cabal/Distribution/Simple/Build.hs +++ b/Cabal/Distribution/Simple/Build.hs @@ -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" diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs index 22ad437141f..fdbcb402fa3 100644 --- a/Cabal/Distribution/Simple/Configure.hs +++ b/Cabal/Distribution/Simple/Configure.hs @@ -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 diff --git a/Cabal/Distribution/Simple/GHC/Internal.hs b/Cabal/Distribution/Simple/GHC/Internal.hs index acc5257656b..36443e36d64 100644 --- a/Cabal/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/Distribution/Simple/GHC/Internal.hs @@ -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 diff --git a/Cabal/Distribution/Simple/LocalBuildInfo.hs b/Cabal/Distribution/Simple/LocalBuildInfo.hs index 8135a779929..2cfa00bc375 100644 --- a/Cabal/Distribution/Simple/LocalBuildInfo.hs +++ b/Cabal/Distribution/Simple/LocalBuildInfo.hs @@ -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)