stack-all 0.5.2 → 0.6
raw patch · 4 files changed
+50/−35 lines, 4 files
Files
- ChangeLog.md +6/−0
- README.md +19/−16
- src/Main.hs +21/−15
- stack-all.cabal +4/−4
ChangeLog.md view
@@ -1,5 +1,11 @@ # Release history for stack-all +## 0.6 (2024-05-19)+- stack-all now works outside of projects too like stack does+- error when --make-lts combined with a command args+- also error for --create-config with versions or command args+- bump default oldest lts from 16 to 18 (ghc-8.10)+ ## 0.5.2 (2024-04-18) - fix parsing of ltsXX - use https for snapshots url
README.md view
@@ -8,28 +8,32 @@ `stack-all` by default runs `stack build` over Stackage Nightly and LTS major versions-(current default is nightly & major LTS versions back to lts-16)+(current default is nightly & major LTS versions back to lts-18) corresponding to latest major ghc minor versions, with appropriate stack `--resolver` options. -Note that `stack` only works if a `stack.yaml` file exists.+Note that `stack` only works in a project if a `stack.yaml` file exists. If no `stack.yaml` file is found in a .cabal project, `stack-all` will create one. Of course it may still fail to build, but this allows for-quickly trying to build a package that does not include stack support.+quickly experiments to build a package that does not include stack support. +Since 0.6, stack-all also works outside projects, like stack itself does.+ ### Help output `$ stack-all --version`+ ```-0.5.2+0.6 ``` `$ stack-all --help`+ ``` Build over Stackage versions -Usage: stack-all [--version] [(-c|--create-config) | (-s|--make-lts)] - [-k|--keep-going] [-d|--debug] [--refresh-cache] - [-n|--newest MAJOR] [(-o|--oldest MAJOR) | (-a|--all-lts)] +Usage: stack-all [--version] [(-c|--create-config) | (-s|--make-lts)]+ [-k|--keep-going] [-d|--debug] [--refresh-cache]+ [-n|--newest MAJOR] [(-o|--oldest MAJOR) | (-a|--all-lts)] [MAJORVER... [COMMAND...]] stack-all builds projects easily across different Stackage versions@@ -80,26 +84,26 @@ There are `--oldest` and `--newest` options to specify the range of lts versions to build over: -You can specify the oldest major LTS to build for with eg `stack-all -o lts14`.-Otherwise if not configured the default oldest LTS is currently `lts-16`.+You can specify the oldest major LTS to build for with eg `stack-all -o lts16`.+Otherwise if not configured the default oldest LTS is currently `lts-18`. Similarly you can specify the newest LTS version to build from with eg `stack-all -n lts20`. (The default is to build from nightly.) Alternatively, one can give one or more explicit LTS major versions to build-for as arguments: eg `stack-all lts18` if you only wish to build that version.+for as arguments: eg `stack-all lts19` if you only wish to build that version. ### Configuring the oldest and/or newest LTS to build You can configure the oldest working LTS major version for your project-by running for example `stack-all -c -o lts-18` which generates a `.stack-all`+by running for example `stack-all -c -o lts-19` which generates a `.stack-all` project config file like this: ``` [versions]-# lts-16 too old-oldest = lts-18+# lts-18 too old+oldest = lts-19 ``` (the comment line can be used to document why the older LTS doesn't work).-This specifies that the oldest LTS version to build for is lts-18.+This specifies that the oldest LTS version to build for is lts-19. The newest LTS to build with stack-all can similarly be configured: `stack-all -c -n lts21` or setting `newest = lts-21`.@@ -123,5 +127,4 @@ You can also build from git source with `stack install` or `cabal install`. ## Collaboration-The project is hosted at https://github.com/juhp/stack-all-under a BSD license.+The project is hosted at https://github.com/juhp/stack-all under a BSD license.
src/Main.hs view
@@ -20,7 +20,7 @@ import Snapshots defaultOldestLTS :: MajorVer-defaultOldestLTS = LTS 16+defaultOldestLTS = LTS 18 data VersionLimit = DefaultLimit | Oldest MajorVer | AllVersions @@ -45,36 +45,39 @@ run :: Command -> Bool ->Bool -> Bool -> Maybe MajorVer -> VersionLimit -> [String] -> IO () run command keepgoing debug refresh mnewest verlimit verscmd = do- findStackProjectDir Nothing+ whenJustM findStackProjectDir setCurrentDirectory+ (versions, cargs) <- getVersionsCmd case command of- CreateConfig ->+ CreateConfig -> do+ unless (null cargs) $+ error' "cannot combine --create-config with stack commands"+ unless (null versions) $+ error' "cannot combine --create-config with major versions" case verlimit of Oldest oldest -> createStackAll (Just oldest) mnewest _ -> createStackAll Nothing mnewest MakeStackLTS -> do- (versions, _) <- getVersionsCmd+ unless (null cargs) $+ error' "cannot combine --make-lts with stack commands" if null versions then error' "--make-lts needs an LTS major version" else makeStackLTS refresh versions DefaultRun -> do- (versions, cargs) <- getVersionsCmd configs <- readStackConfigs let newestFilter = maybe id (filter . (>=)) mnewest mapM_ (stackBuild configs keepgoing debug refresh cargs) (newestFilter versions) where- findStackProjectDir :: Maybe FilePath -> IO ()- findStackProjectDir mcwd = do+ findStackProjectDir :: IO (Maybe FilePath)+ findStackProjectDir = do haveStackYaml <- doesFileExist "stack.yaml"+ mcwdir <- Just <$> getCurrentDirectory if haveStackYaml- then return ()- else do- cwdir <- getCurrentDirectory- if cwdir /= "/"- then setCurrentDirectory ".." >>- findStackProjectDir (if isJust mcwd then mcwd else Just cwdir)+ then return mcwdir+ else+ if mcwdir /= Just "/"+ then withCurrentDirectory ".." findStackProjectDir else do putStrLn "stack.yaml not found"- whenJust mcwd setCurrentDirectory haveCabalFile <- doesFileExistWithExtension "." ".cabal" if haveCabalFile then do@@ -83,7 +86,10 @@ unlessM (cmdBool "stack" ["init"]) $ do snap <- latestLtsSnapshot refresh writeFile "stack.yaml" $ "resolver: " ++ snap ++ "\n"- else error' "no package/project found"+ return mcwdir+ else do+ putStrLn "no package/project found"+ return Nothing getVersionsCmd :: IO ([MajorVer],[String]) getVersionsCmd = do
stack-all.cabal view
@@ -1,8 +1,8 @@ name: stack-all-version: 0.5.2-synopsis: CLI tool for building across Stackage major versions+version: 0.6+synopsis: CLI tool for building over Stackage major versions description:- Build your Haskell project over Stackage major LTS versions.+ Build a Haskell project over one or many Stackage major LTS versions. license: BSD3 license-file: LICENSE author: Jens Petersen <juhpetersen@gmail.com>@@ -17,7 +17,7 @@ cabal-version: 1.18 tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.8,- GHC == 9.4.8, GHC == 9.6.4, GHC == 9.8.2+ GHC == 9.4.8, GHC == 9.6.5, GHC == 9.8.2 source-repository head type: git