From 07b4bbba1c312c385504b3def93607def2d5e4db Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Mon, 27 Nov 2017 23:27:54 +0200 Subject: WIP on getting projects to build with Cabal 2.0/GHC 8.2 --- tests/CompileTest.hs | 1 + tests/GhcSession.hs | 16 +++++++++++++--- tests/exeintlib/exeintlib.cabal | 21 +++++++++++++++++++++ tests/exeintlib/exelib.cabal | 21 --------------------- 4 files changed, 35 insertions(+), 24 deletions(-) create mode 100644 tests/exeintlib/exeintlib.cabal delete mode 100644 tests/exeintlib/exelib.cabal (limited to 'tests') diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs index de9b6ab..cc9c85a 100644 --- a/tests/CompileTest.hs +++ b/tests/CompileTest.hs @@ -97,6 +97,7 @@ main = do , ("8.0.1", ">= 1.24 ") , ("8.0.2", ">= 1.24.2 ") , ("8.2.1", ">= 2.0.0.2 ") + , ("8.2.2", ">= 2.0.0.2 ") ] relevant_cabal_versions = diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs index 42193b9..f627cae 100644 --- a/tests/GhcSession.hs +++ b/tests/GhcSession.hs @@ -27,8 +27,9 @@ main = do args <- getArgs topdir <- getCurrentDirectory res <- mapM (setup topdir test) $ case args of - [] -> [ ("tests/exelib" , parseVer "1.10") - , ("tests/exeintlib", parseVer "2.0") + [] -> [ + -- ("tests/exelib" , parseVer "1.10") + ("tests/exeintlib", parseVer "2.0") ] xs -> map (,parseVer "0") xs @@ -49,6 +50,7 @@ setup :: FilePath -> (FilePath -> IO [Bool]) -> (FilePath, Version) -> IO [Bool] setup topdir act (srcdir, min_cabal_ver) = do ci_ver <- cabalInstallVersion c_ver <- cabalInstallBuiltinCabalVersion + putStrLn $ "(ci_ver,c_ver)=" ++ show (ci_ver,c_ver) -- AZ-DEBUG let mreason | (ci_ver < parseVer "1.24") = Just $ "cabal-install-" ++ showVersion ci_ver ++ " is too old" @@ -63,7 +65,9 @@ setup topdir act (srcdir, min_cabal_ver) = do putStrLn $ "Skipping test '" ++ srcdir ++ "' because " ++ reason ++ "." return [] Nothing -> do - withSystemTempDirectory "cabal-helper.ghc-session.test" $ \dir -> do + -- withSystemTempDirectory "cabal-helper.ghc-session.test" $ \dir -> do + let dir = "/tmp/xxx" + do setCurrentDirectory $ topdir srcdir run "cabal" [ "sdist", "--output-dir", dir ] @@ -76,7 +80,9 @@ setup topdir act (srcdir, min_cabal_ver) = do run x xs = do print $ x:xs o <- readProcess x xs "" + putStrLn "=======================output============" -- AZ-DEBUG putStrLn o + putStrLn "=======================output-done=======" -- AZ-DEBUG return () test :: FilePath -> IO [Bool] @@ -85,7 +91,9 @@ test dir = do cs <- runQuery qe $ components $ (,,) <$> entrypoints <.> ghcOptions forM cs $ \(ep, opts, cn) -> do let sopts = intercalate " " $ map formatArg $ "ghc" : opts + putStrLn "======================= cn ============" -- AZ-DEBUG putStrLn $ "\n" ++ show cn ++ ": " ++ sopts + putStrLn "======================= cn done =======" -- AZ-DEBUG compileModule ep opts where formatArg x @@ -95,6 +103,8 @@ test dir = do compileModule :: ChEntrypoint -> [String] -> IO Bool compileModule ep opts = do + putStrLn $ "compileModule:ep=" ++ show ep + E.handle (\(ec :: ExitCode) -> print ec >> return False) $ do defaultErrorHandler defaultFatalMessager defaultFlushOut $ do diff --git a/tests/exeintlib/exeintlib.cabal b/tests/exeintlib/exeintlib.cabal new file mode 100644 index 0000000..807aac5 --- /dev/null +++ b/tests/exeintlib/exeintlib.cabal @@ -0,0 +1,21 @@ +name: exeintlib +version: 0 +build-type: Simple +cabal-version: >=2.0 + +library + exposed-modules: Lib + hs-source-dirs: lib + build-depends: base, filepath, intlib + default-language: Haskell2010 + +library intlib + exposed-modules: IntLib + hs-source-dirs: intlib + build-depends: base, directory + default-language: Haskell2010 + +executable exe + main-is: Exe.hs + build-depends: base, exeintlib + default-language: Haskell2010 \ No newline at end of file diff --git a/tests/exeintlib/exelib.cabal b/tests/exeintlib/exelib.cabal deleted file mode 100644 index 807aac5..0000000 --- a/tests/exeintlib/exelib.cabal +++ /dev/null @@ -1,21 +0,0 @@ -name: exeintlib -version: 0 -build-type: Simple -cabal-version: >=2.0 - -library - exposed-modules: Lib - hs-source-dirs: lib - build-depends: base, filepath, intlib - default-language: Haskell2010 - -library intlib - exposed-modules: IntLib - hs-source-dirs: intlib - build-depends: base, directory - default-language: Haskell2010 - -executable exe - main-is: Exe.hs - build-depends: base, exeintlib - default-language: Haskell2010 \ No newline at end of file -- cgit v1.2.3