Skip to content

Commit

Permalink
0.6.1 bugfix for failing config modes
Browse files Browse the repository at this point in the history
- inject default build command late
- rename stackBuild to runStack
  • Loading branch information
juhp committed May 20, 2024
1 parent a919adc commit 03c588f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release history for stack-all

## 0.6.1 (2024-05-20)
- fix --create-config and --make-lts failing if no command

## 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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ Since 0.6, stack-all also works outside projects, like stack itself does.
`$ stack-all --version`

```
0.6
0.6.1
```
`$ 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
Expand Down
4 changes: 4 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@
- workaround exec needing -- before prog options ?

- fetch stack.yaml from github project?

- --half to skip every other major lts ?

- short commands: b, i, t, etc
12 changes: 6 additions & 6 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ run command keepgoing debug refresh mnewest verlimit verscmd = do
case command of
CreateConfig -> do
unless (null cargs) $
error' "cannot combine --create-config with stack commands"
error' $ "cannot combine --create-config with stack commands:" +-+ unwords cargs
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
unless (null cargs) $
error' "cannot combine --make-lts with stack commands"
error' $ "cannot combine --make-lts with stack commands:" +-+ unwords cargs
if null versions
then error' "--make-lts needs an LTS major version"
else makeStackLTS refresh versions
DefaultRun -> do
configs <- readStackConfigs
let newestFilter = maybe id (filter . (>=)) mnewest
mapM_ (stackBuild configs keepgoing debug refresh cargs) (newestFilter versions)
mapM_ (runStack configs keepgoing debug refresh $ if null cargs then ["build"] else cargs) (newestFilter versions)
where
findStackProjectDir :: IO (Maybe FilePath)
findStackProjectDir = do
Expand Down Expand Up @@ -110,7 +110,7 @@ run command keepgoing debug refresh mnewest verlimit verscmd = do
AllVersions -> return allMajors
Oldest ver -> return $ filter (inRange Nightly ver) allMajors
else nub <$> mapM resolveMajor verlist
return (versions,if null cmds then ["build"] else cmds)
return (versions,cmds)
where
inRange :: MajorVer -> MajorVer -> MajorVer -> Bool
inRange newest oldest v = v >= oldest && v <= newest
Expand Down Expand Up @@ -187,9 +187,9 @@ makeStackLTS refresh vers = do
configFile :: MajorVer -> FilePath
configFile ver = "stack-" ++ showCompact ver <.> "yaml"

stackBuild :: [MajorVer] -> Bool -> Bool -> Bool -> [String]
runStack :: [MajorVer] -> Bool -> Bool -> Bool -> [String]
-> MajorVer -> IO ()
stackBuild configs keepgoing debug refresh command ver = do
runStack configs keepgoing debug refresh command ver = do
let mcfgver =
case ver of
Nightly | Nightly `elem` configs -> Just Nightly
Expand Down
2 changes: 1 addition & 1 deletion stack-all.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stack-all
version: 0.6
version: 0.6.1
synopsis: CLI tool for building over Stackage major versions
description:
Build a Haskell project over one or many Stackage major LTS versions.
Expand Down

0 comments on commit 03c588f

Please sign in to comment.