Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions CI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import System.IO.Extra
import System.IO.Unsafe
import System.Process.Extra
import System.Time.Extra
import Ghclibgen (allowNewerProjectLines, mkAllowNewerFlags)

main :: IO ()
main = do
Expand All @@ -36,18 +37,6 @@ main = do
version <- buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix allowNewerFlags allowNewerSpecs
putStrLn version

mkAllowNewerFlags :: [String] -> String
mkAllowNewerFlags xs =
let render = unwords . map (\s -> "--allow-newer=" ++ s)
def = ""
in case xs of
[] -> if null def then "" else " " ++ def
_ -> " " ++ render xs

allowNewerProjectLines :: [String] -> [String]
allowNewerProjectLines [] = []
allowNewerProjectLines xs = ["allow-newer: " ++ intercalate ", " xs]

data Options = Options
{ ghcFlavor :: GhcFlavor,
noGhcCheckout :: Bool,
Expand Down Expand Up @@ -412,7 +401,7 @@ buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix allowNewerFlags allowN
system_ $ "cabal build exe:ghc-lib-gen" ++ allowNewerFlags
system_ $ "cabal run exe:ghc-lib-gen" ++ allowNewerFlags
++ " -- ghc ../patches --ghc-lib-parser "
++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor ++allowNewerFlags
++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor ++ allowNewerFlags

patchVersion version "ghc/ghc-lib-parser.cabal"
mkTarball pkg_ghclib_parser
Expand Down Expand Up @@ -478,11 +467,11 @@ buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix allowNewerFlags allowN

system_ $ "cd examples/ghc-lib-test-mini-hlint && cabal test " ++
"--project-dir ../.. --test-show-details direct " ++
("--test-options \"--color always --test-command ../../ghc-lib-test-mini-hlint " ++ ghcFlavorArg ++ "\"")
"--test-options \"--color always --test-command ../../ghc-lib-test-mini-hlint " ++ ghcFlavorArg ++ "\""

system_ $ "cd examples/ghc-lib-test-mini-compile && cabal test " ++
"--project-dir ../.. --test-show-details direct " ++
("--test-options \"--color always --test-command ../../ghc-lib-test-mini-compile " ++ ghcFlavorArg ++ "\"")
"--test-options \"--color always --test-command ../../ghc-lib-test-mini-compile " ++ ghcFlavorArg ++ "\""

system_ "cabal -v0 exec -- ghc -ignore-dot-ghci -package=ghc-lib-parser -e \"print 1\""
system_ "cabal -v0 exec -- ghc -ignore-dot-ghci -package=ghc-lib -e \"print 1\""
Expand Down
2 changes: 1 addition & 1 deletion ghc-lib-gen.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ executable ghc-lib-build-tool
else
build-tool-depends: alex:alex, happy:happy < 2.0
build-depends:
directory, filepath, time, extra, optparse-applicative
directory, filepath, time, extra, optparse-applicative, ghc-lib-gen
if flag(semaphore-compat)
build-depends: semaphore-compat
main-is: CI.hs
18 changes: 14 additions & 4 deletions ghc-lib-gen/src/Ghclibgen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ module Ghclibgen
generateGhcLibCabal,
generateGhcLibParserCabal,
setupModuleDepsPlaceholders,
mkAllowNewerFlags,
allowNewerProjectLines,
)
where

Expand Down Expand Up @@ -1742,10 +1744,7 @@ generatePrerequisites ghcFlavor allowNewerSpecs = do
system_ "bash -c \"./configure --enable-tarballs-autodownload\""
withCurrentDirectory "hadrian" $ do

let defaultAllowNewer = []
effectiveAllowNewer =
if null allowNewerSpecs then defaultAllowNewer else allowNewerSpecs
allowNewerArgs = concatMap (\s -> ["--allow-newer=" ++ s]) effectiveAllowNewer
let allowNewerArgs = mkAllowNewerFlagsList allowNewerSpecs

system_ . unwords . join $
[ ["cabal", "build", "exe:hadrian", "--ghc-options=-j"]
Expand Down Expand Up @@ -1826,3 +1825,14 @@ genPlaceholderModules = loop
contents <- listDirectory fp
mapM_ (loop . (fp </>)) contents
else when (takeExtension fp `elem` [".x", ".y", ".hsc"]) $ genPlaceholderModule fp

mkAllowNewerFlags :: [String] -> String
mkAllowNewerFlags [] = ""
mkAllowNewerFlags xs = " " ++ unwords (mkAllowNewerFlagsList xs)

mkAllowNewerFlagsList :: [String] -> [String]
mkAllowNewerFlagsList = map ("--allow-newer=" ++)

allowNewerProjectLines :: [String] -> [String]
allowNewerProjectLines [] = []
allowNewerProjectLines xs = ["allow-newer: " ++ intercalate ", " xs]
Loading