@@ -35,15 +35,14 @@ import qualified Distribution.Simple.Build.PathsModule as Build.PathsModule
35
35
36
36
import Distribution.Package
37
37
( Package (.. ), PackageName (.. ), PackageIdentifier (.. )
38
- , Dependency (.. ), thisPackageVersion , packageName
39
- , ComponentId (.. ), ComponentId (.. ) )
38
+ , Dependency (.. ), thisPackageVersion )
40
39
import Distribution.Simple.Compiler
41
40
( Compiler , CompilerFlavor (.. ), compilerFlavor
42
41
, PackageDB (.. ), PackageDBStack )
43
42
import Distribution.PackageDescription
44
43
( PackageDescription (.. ), BuildInfo (.. ), Library (.. ), Executable (.. )
45
44
, TestSuite (.. ), TestSuiteInterface (.. ), Benchmark (.. )
46
- , BenchmarkInterface (.. ), allBuildInfo , defaultRenaming )
45
+ , BenchmarkInterface (.. ), allBuildInfo )
47
46
import qualified Distribution.InstalledPackageInfo as IPI
48
47
import qualified Distribution.ModuleName as ModuleName
49
48
import Distribution.ModuleName (ModuleName )
@@ -55,7 +54,7 @@ import Distribution.Simple.BuildTarget
55
54
import Distribution.Simple.PreProcess
56
55
( preprocessComponent , preprocessExtras , PPSuffixHandler )
57
56
import Distribution.Simple.LocalBuildInfo
58
- ( LocalBuildInfo (compiler , buildDir , withPackageDB , withPrograms )
57
+ ( LocalBuildInfo (compiler , buildDir , withPackageDB , withPrograms , flagAssignment )
59
58
, Component (.. ), componentName , getComponent , componentBuildInfo
60
59
, ComponentLocalBuildInfo (.. ), pkgEnabledComponents
61
60
, withComponentsInBuildOrder , componentsInBuildOrder
@@ -65,6 +64,7 @@ import Distribution.Simple.Program.Types
65
64
import Distribution.Simple.Program.Db
66
65
import Distribution.Simple.BuildPaths
67
66
( autogenModulesDir , autogenModuleName , cppHeaderName , exeExtension )
67
+ import Distribution.Simple.Configure (computeComponentId , computeCompatPackageKey )
68
68
import Distribution.Simple.Register
69
69
( registerPackage , inplaceInstalledPackageInfo
70
70
, doesPackageDBExist , deletePackageDB , createPackageDB )
@@ -249,7 +249,10 @@ buildComponent verbosity numJobs pkg_descr lbi0 suffixes
249
249
extras <- preprocessExtras comp lbi
250
250
info verbosity $ " Building test suite " ++ testName test ++ " ..."
251
251
buildLib verbosity numJobs pkg lbi lib libClbi
252
- registerPackage verbosity (compiler lbi) (withPrograms lbi) False
252
+ -- NB: need to enable multiple instances here, because on 7.10+
253
+ -- the package name is the same as the library, and we still
254
+ -- want the registration to go through.
255
+ registerPackage verbosity (compiler lbi) (withPrograms lbi) True
253
256
(withPackageDB lbi) ipi
254
257
let ebi = buildInfo exe
255
258
exe' = exe { buildInfo = addExtraCSources ebi extras }
@@ -401,17 +404,22 @@ testSuiteLibV09AsLibAndExe pkg_descr
401
404
libExposed = True ,
402
405
libBuildInfo = bi
403
406
}
407
+ cid = computeComponentId (package pkg_descr)
408
+ (CTestName (testName test))
409
+ (map fst (componentPackageDeps clbi))
410
+ (flagAssignment lbi)
411
+ (pkg_name, compat_key) = computeCompatPackageKey
412
+ (compiler lbi) (package pkg_descr)
413
+ (CTestName (testName test)) cid
404
414
libClbi = LibComponentLocalBuildInfo
405
415
{ componentPackageDeps = componentPackageDeps clbi
406
416
, componentPackageRenaming = componentPackageRenaming clbi
407
- , componentId = ComponentId $ display (packageId pkg)
408
- , componentCompatPackageKey = ComponentId $ display (packageId pkg)
417
+ , componentId = cid
418
+ , componentCompatPackageKey = compat_key
409
419
, componentExposedModules = [IPI. ExposedModule m Nothing Nothing ]
410
420
}
411
421
pkg = pkg_descr {
412
- package = (package pkg_descr) {
413
- pkgName = PackageName (testName test)
414
- }
422
+ package = (package pkg_descr) { pkgName = pkg_name }
415
423
, buildDepends = targetBuildDepends $ testBuildInfo test
416
424
, executables = []
417
425
, testSuites = []
@@ -439,9 +447,7 @@ testSuiteLibV09AsLibAndExe pkg_descr
439
447
: (filter (\ (_, x) -> let PackageName name = pkgName x
440
448
in name == " Cabal" || name == " base" )
441
449
(componentPackageDeps clbi)),
442
- componentPackageRenaming =
443
- Map. insert (packageName ipi) defaultRenaming
444
- (componentPackageRenaming clbi)
450
+ componentPackageRenaming = Map. empty
445
451
}
446
452
testSuiteLibV09AsLibAndExe _ TestSuite {} _ _ _ _ = error " testSuiteLibV09AsLibAndExe: wrong kind"
447
453
0 commit comments