@@ -29,17 +29,26 @@ import Text.Printf
29
29
30
30
main :: IO ()
31
31
main = do
32
- cabalFiles <- getArgs
33
- printf " Checking release builds for %s...\n " (show cabalFiles)
34
-
35
- forM_ allGhcVersions findGhcExecutable
36
-
37
- withTempProjectFile cabalFiles $ \ projectFile ->
38
- forM_ cabalFiles $ \ cabalFile -> do
39
- let component = (dropExtension $ takeFileName cabalFile)
40
- forM_ allGhcVersions $ buildComponentWith projectFile component
41
-
42
- printf " All release builds successful for GHC versions: %s" (unwords $ fmap ghcVersionExecutableName allGhcVersions)
32
+ args <- getArgs
33
+ case args of
34
+ ghcVersions : cabalFiles
35
+ | Just vs <- case ghcVersions of
36
+ " Default" -> Just [Default ]
37
+ " All" -> Just allGhcVersions
38
+ _ -> Nothing
39
+ -> do
40
+ printf " Checking release builds for %s with ghc versions %s...\n " (show cabalFiles) (show $ fmap ghcVersionExecutableName vs)
41
+
42
+ forM_ vs findGhcExecutable
43
+
44
+ withTempProjectFile cabalFiles $ \ projectFile ->
45
+ forM_ cabalFiles $ \ cabalFile -> do
46
+ let component = (dropExtension $ takeFileName cabalFile)
47
+ forM_ vs $ buildComponentWith projectFile component
48
+
49
+ printf " All release builds successful for GHC versions: %s" (unwords $ fmap ghcVersionExecutableName vs)
50
+ _ -> do
51
+ putStrLn " Usage: [Default|All] FILES"
43
52
44
53
-- TODO: I wanted to use the --ignore-project cabal option, which should be
45
54
-- a globally configurable value according to the cabal user guide, but for
@@ -58,14 +67,15 @@ withTempProjectFile cabalFiles k = do
58
67
(\ _ -> removeFile tempProjectFilePath)
59
68
k
60
69
61
- data GhcVersion = Ghc9_2 | Ghc9_4 | Ghc9_6 | Ghc9_8 | Ghc9_10 | Ghc9_12
70
+ data GhcVersion = Default | Ghc9_2 | Ghc9_4 | Ghc9_6 | Ghc9_8 | Ghc9_10 | Ghc9_12
62
71
deriving stock (Enum , Bounded )
63
72
64
73
allGhcVersions :: [GhcVersion ]
65
- allGhcVersions = [minBound .. maxBound ]
74
+ allGhcVersions = [Ghc9_2 .. maxBound ]
66
75
67
76
ghcVersionExecutableName :: GhcVersion -> String
68
77
ghcVersionExecutableName = \ case
78
+ Default -> " ghc"
69
79
Ghc9_2 -> " ghc-9.2"
70
80
Ghc9_4 -> " ghc-9.4"
71
81
Ghc9_6 -> " ghc-9.6"
0 commit comments