aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/ci/steps/40-test.sh1
-rw-r--r--src/CabalHelper/Runtime/Main.hs42
-rw-r--r--tests/GhcSession.hs56
3 files changed, 47 insertions, 52 deletions
diff --git a/scripts/ci/steps/40-test.sh b/scripts/ci/steps/40-test.sh
index 47caaba..2a3ef26 100644
--- a/scripts/ci/steps/40-test.sh
+++ b/scripts/ci/steps/40-test.sh
@@ -1,3 +1,2 @@
cabal_helper_libexecdir="$build_dir"/build/cabal-helper-wrapper \
cabal --sandbox-config="$sandbox_config" test --builddir="$build_dir" --show-details=always
-# cabal --sandbox-config="$sandbox_config" test --builddir="$build_dir" --show-details=direct
diff --git a/src/CabalHelper/Runtime/Main.hs b/src/CabalHelper/Runtime/Main.hs
index 2e5108a..0ef826a 100644
--- a/src/CabalHelper/Runtime/Main.hs
+++ b/src/CabalHelper/Runtime/Main.hs
@@ -19,9 +19,7 @@
#undef CH_MIN_VERSION_Cabal
#define CH_MIN_VERSION_Cabal MIN_VERSION_Cabal
#endif
-#if CH_MIN_VERSION_Cabal(2,0,0)
-import Distribution.Backpack (OpenUnitId(..))
-#endif
+
import Distribution.Simple.Utils (cabalVersion)
import Distribution.Simple.Configure
import Distribution.Package
@@ -108,17 +106,6 @@ import qualified Distribution.ModuleName as C
import Distribution.Text
( display
)
-#if CH_MIN_VERSION_Cabal(2,0,0)
-import Distribution.Types.ModuleRenaming
- ( ModuleRenaming(..)
- )
-import Distribution.Types.UnitId
- ( DefUnitId
- )
-import Distribution.Utils.NubList
- ( toNubListR
- )
-#endif
import Distribution.Verbosity
( Verbosity
, silent
@@ -162,16 +149,26 @@ import Distribution.Types.UnqualComponentName
#if CH_MIN_VERSION_Cabal(2,0,0)
-- CPP >= 2.0
-import Distribution.Version
- ( versionNumbers
- , mkVersion
+import Distribution.Backpack (OpenUnitId(..))
+import Distribution.Types.ModuleRenaming
+ ( ModuleRenaming(..)
+ )
+import Distribution.Types.MungedPackageId
+ ( MungedPackageId
)
import Distribution.Types.UnitId
( UnitId
, unDefUnitId
)
-import Distribution.Types.MungedPackageId
- ( MungedPackageId
+import Distribution.Types.UnitId
+ ( DefUnitId
+ )
+import Distribution.Utils.NubList
+ ( toNubListR
+ )
+import Distribution.Version
+ ( versionNumbers
+ , mkVersion
)
#endif
@@ -503,10 +500,9 @@ removeInplaceDeps :: Verbosity
removeInplaceDeps _v lbi pd clbi includeDirs = let
removeInplace c =
let
- (ideps, deps) = partition (isInplaceDep lbi c) (componentPackageDeps c)
- (_, incs) = partition (isInplaceCompInc c) (componentIncludes c)
+ (ideps, incs) = partition (isInplaceCompInc c) (componentIncludes c)
hasIdeps' = not $ null ideps
- c' = c { componentPackageDeps = deps
+ c' = c { componentPackageDeps = error "using deprecated field:componentPackageDeps"
, componentInternalDeps = []
, componentIncludes = incs }
in (hasIdeps',c')
@@ -646,7 +642,7 @@ componentEntrypoints (CLib Library {..})
(map gmModuleName $ otherModules libBuildInfo)
#if CH_MIN_VERSION_Cabal(2,0,0)
componentEntrypoints (CFLib (ForeignLib{..}))
- = error $ "componentEntrypoints:Need to process ForeignLib Component"
+ = ChLibEntrypoint [] []
#endif
componentEntrypoints (CExe Executable {..})
= ChExeEntrypoint modulePath (map gmModuleName $ otherModules buildInfo)
diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs
index 437e927..11b35ff 100644
--- a/tests/GhcSession.hs
+++ b/tests/GhcSession.hs
@@ -106,45 +106,45 @@ compileModule ep opts = do
defaultErrorHandler defaultFatalMessager defaultFlushOut $ do
#endif
- runGhc (Just libdir) $ do
+ runGhc (Just libdir) $ do
- dflags0 <- getSessionDynFlags
- let dflags1 = dflags0 {
- ghcMode = CompManager
- , ghcLink = LinkInMemory
- , hscTarget = HscInterpreted
- , optLevel = 0
- }
+ dflags0 <- getSessionDynFlags
+ let dflags1 = dflags0 {
+ ghcMode = CompManager
+ , ghcLink = LinkInMemory
+ , hscTarget = HscInterpreted
+ , optLevel = 0
+ }
- (dflags2, _, _) <- parseDynamicFlags dflags1 (map noLoc opts)
- _ <- setSessionDynFlags dflags2
+ (dflags2, _, _) <- parseDynamicFlags dflags1 (map noLoc opts)
+ _ <- setSessionDynFlags dflags2
- ts <- mapM (\t -> guessTarget t Nothing) $
- case ep of
- ChLibEntrypoint ms ms' -> map unChModuleName $ ms ++ ms'
- ChExeEntrypoint m ms -> [m] ++ map unChModuleName ms
- ChSetupEntrypoint -> ["Setup.hs"]
- let ts' = map (\t -> t { targetAllowObjCode = False }) ts
+ ts <- mapM (\t -> guessTarget t Nothing) $
+ case ep of
+ ChLibEntrypoint ms ms' -> map unChModuleName $ ms ++ ms'
+ ChExeEntrypoint m ms -> [m] ++ map unChModuleName ms
+ ChSetupEntrypoint -> ["Setup.hs"]
+ let ts' = map (\t -> t { targetAllowObjCode = False }) ts
- setTargets ts'
- _ <- load LoadAllTargets
+ setTargets ts'
+ _ <- load LoadAllTargets
#if __GLASGOW_HASKELL__ >= 706
- setContext $ case ep of
- ChLibEntrypoint ms ms' ->
- map (IIModule . mkModuleName . unChModuleName) $ ms ++ ms'
- ChExeEntrypoint _ ms ->
- map (IIModule . mkModuleName . unChModuleName) $ ChModuleName "Main" : ms
- ChSetupEntrypoint ->
- map (IIModule . mkModuleName) ["Main"]
+ setContext $ case ep of
+ ChLibEntrypoint ms ms' ->
+ map (IIModule . mkModuleName . unChModuleName) $ ms ++ ms'
+ ChExeEntrypoint _ ms ->
+ map (IIModule . mkModuleName . unChModuleName) $ ChModuleName "Main" : ms
+ ChSetupEntrypoint ->
+ map (IIModule . mkModuleName) ["Main"]
#endif
#if __GLASGOW_HASKELL__ <= 706
- GhcMonad.liftIO $ print ExitSuccess
+ GhcMonad.liftIO $ print ExitSuccess
#else
- liftIO $ print ExitSuccess
+ liftIO $ print ExitSuccess
#endif
- return True
+ return True
unChModuleName :: ChModuleName -> String
unChModuleName (ChModuleName mn) = mn