@@ -29,17 +29,26 @@ import Text.Printf
2929
3030main :: IO ()
3131main = 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"
4352
4453-- TODO: I wanted to use the --ignore-project cabal option, which should be
4554-- a globally configurable value according to the cabal user guide, but for
@@ -58,14 +67,15 @@ withTempProjectFile cabalFiles k = do
5867 (\ _ -> removeFile tempProjectFilePath)
5968 k
6069
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
6271 deriving stock (Enum , Bounded )
6372
6473allGhcVersions :: [GhcVersion ]
65- allGhcVersions = [minBound .. maxBound ]
74+ allGhcVersions = [Ghc9_2 .. maxBound ]
6675
6776ghcVersionExecutableName :: GhcVersion -> String
6877ghcVersionExecutableName = \ case
78+ Default -> " ghc"
6979 Ghc9_2 -> " ghc-9.2"
7080 Ghc9_4 -> " ghc-9.4"
7181 Ghc9_6 -> " ghc-9.6"
0 commit comments