@@ -356,7 +356,7 @@ packageFromPackageDescription packageConfig pkgFlags (PackageDescriptionPair pkg
356356 pkgId = package pkg
357357 name = fromCabalPackageName (pkgName pkgId)
358358 deps = M. filterWithKey (const . not . isMe) (M. union
359- (packageDependencies (packageConfigCompilerVersion packageConfig) pkg)
359+ (packageDependencies packageConfig pkg)
360360 -- We include all custom-setup deps - if present - in the
361361 -- package deps themselves. Stack always works with the
362362 -- invariant that there will be a single installed package
@@ -610,25 +610,31 @@ getBuildComponentDir (Just name) = parseRelDir (name FilePath.</> (name ++ "-tmp
610610-- being 7.10 or earlier. This obviously makes our function a lot more
611611-- fun to write...
612612packageDependencies
613- :: CompilerVersion 'CVActual
613+ :: PackageConfig
614614 -> PackageDescription
615615 -> Map PackageName VersionRange
616- packageDependencies ghcVersion pkg' =
616+ packageDependencies pkgConfig pkg' =
617617 M. fromListWith intersectVersionRanges $
618618 map (depName &&& depRange) $
619619 concatMap targetBuildDepends (allBuildInfo' pkg) ++
620620 maybe [] setupDepends (setupBuildInfo pkg)
621621 where
622622 pkg
623- | getGhcVersion ghcVersion >= $ (mkVersion " 8.0" ) = pkg'
623+ | getGhcVersion (packageConfigCompilerVersion pkgConfig) >= $ (mkVersion " 8.0" ) = pkg'
624624 -- Set all components to buildable. Only need to worry about
625625 -- library, exe, test, and bench, since others didn't exist in
626626 -- older Cabal versions
627627 | otherwise = pkg'
628628 { library = (\ c -> c { libBuildInfo = go (libBuildInfo c) }) <$> library pkg'
629629 , executables = (\ c -> c { buildInfo = go (buildInfo c) }) <$> executables pkg'
630- , testSuites = (\ c -> c { testBuildInfo = go (testBuildInfo c) }) <$> testSuites pkg'
631- , benchmarks = (\ c -> c { benchmarkBuildInfo = go (benchmarkBuildInfo c) }) <$> benchmarks pkg'
630+ , testSuites =
631+ if packageConfigEnableTests pkgConfig
632+ then (\ c -> c { testBuildInfo = go (testBuildInfo c) }) <$> testSuites pkg'
633+ else testSuites pkg'
634+ , benchmarks =
635+ if packageConfigEnableBenchmarks pkgConfig
636+ then (\ c -> c { benchmarkBuildInfo = go (benchmarkBuildInfo c) }) <$> benchmarks pkg'
637+ else benchmarks pkg'
632638 }
633639
634640 go bi = bi { buildable = True }
0 commit comments