Commit 2d0a8781 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add mutli-instance support to registerPackage

With support for GHC and GHCJS. All Cabal lib internal uses remain
traditional single instance, so there's no change of behaviour.
parent 7b4df7e0
......@@ -208,7 +208,7 @@ buildComponent verbosity numJobs pkg_descr lbi suffixes
installedPkgInfo = inplaceInstalledPackageInfo pwd distPref pkg_descr
(IPI.AbiHash "") lib' lbi clbi
registerPackage verbosity (compiler lbi) (withPrograms lbi)
registerPackage verbosity (compiler lbi) (withPrograms lbi) False
(withPackageDB lbi) installedPkgInfo
buildComponent verbosity numJobs pkg_descr lbi suffixes
......@@ -249,7 +249,7 @@ buildComponent verbosity numJobs pkg_descr lbi0 suffixes
extras <- preprocessExtras comp lbi
info verbosity $ "Building test suite " ++ testName test ++ "..."
buildLib verbosity numJobs pkg lbi lib libClbi
registerPackage verbosity (compiler lbi) (withPrograms lbi)
registerPackage verbosity (compiler lbi) (withPrograms lbi) False
(withPackageDB lbi) ipi
let ebi = buildInfo exe
exe' = exe { buildInfo = addExtraCSources ebi extras }
......
......@@ -1132,12 +1132,18 @@ hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcPkgProg
registerPackage
:: Verbosity
-> ProgramConfiguration
-> Bool
-> PackageDBStack
-> InstalledPackageInfo
-> IO ()
registerPackage verbosity progdb packageDbs installedPkgInfo =
HcPkg.reregister (hcPkgInfo progdb) verbosity
packageDbs (Right installedPkgInfo)
registerPackage verbosity progdb multiInstance packageDbs installedPkgInfo
| multiInstance
= HcPkg.registerMultiInstance (hcPkgInfo progdb) verbosity
packageDbs installedPkgInfo
| otherwise
= HcPkg.reregister (hcPkgInfo progdb) verbosity
packageDbs (Right installedPkgInfo)
pkgRoot :: Verbosity -> LocalBuildInfo -> PackageDB -> IO FilePath
pkgRoot verbosity lbi = pkgRoot'
......
......@@ -823,12 +823,18 @@ adjustExts hiSuf objSuf opts =
registerPackage :: Verbosity
-> ProgramConfiguration
-> Bool
-> PackageDBStack
-> InstalledPackageInfo
-> IO ()
registerPackage verbosity progdb packageDbs installedPkgInfo =
HcPkg.reregister (hcPkgInfo progdb) verbosity packageDbs
(Right installedPkgInfo)
registerPackage verbosity progdb multiInstance packageDbs installedPkgInfo
| multiInstance
= HcPkg.registerMultiInstance (hcPkgInfo progdb) verbosity
packageDbs installedPkgInfo
| otherwise
= HcPkg.reregister (hcPkgInfo progdb) verbosity
packageDbs (Right installedPkgInfo)
componentGhcOptions :: Verbosity -> LocalBuildInfo
-> BuildInfo -> ComponentLocalBuildInfo -> FilePath
......
......@@ -121,7 +121,7 @@ register pkg@PackageDescription { library = Just lib } lbi regFlags
| modeGenerateRegScript -> writeRegisterScript installedPkgInfo
| otherwise -> do
setupMessage verbosity "Registering" (packageId pkg)
registerPackage verbosity (compiler lbi) (withPrograms lbi)
registerPackage verbosity (compiler lbi) (withPrograms lbi) False
packageDbs installedPkgInfo
where
......@@ -268,13 +268,16 @@ withHcPkg name comp conf f =
registerPackage :: Verbosity
-> Compiler
-> ProgramConfiguration
-> Bool
-> PackageDBStack
-> InstalledPackageInfo
-> IO ()
registerPackage verbosity comp progdb packageDbs installedPkgInfo = do
registerPackage verbosity comp progdb multiInstance packageDbs installedPkgInfo =
case compilerFlavor comp of
GHC -> GHC.registerPackage verbosity progdb packageDbs installedPkgInfo
GHCJS -> GHCJS.registerPackage verbosity progdb packageDbs installedPkgInfo
GHC -> GHC.registerPackage verbosity progdb multiInstance packageDbs installedPkgInfo
GHCJS -> GHCJS.registerPackage verbosity progdb multiInstance packageDbs installedPkgInfo
_ | multiInstance
-> die "Registering multiple package instances is not yet supported for this compiler"
LHC -> LHC.registerPackage verbosity progdb packageDbs installedPkgInfo
UHC -> UHC.registerPackage verbosity comp progdb packageDbs installedPkgInfo
JHC -> notice verbosity "Registering for jhc (nothing to do)"
......
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