packages feed

stack-all 0.4.2 → 0.5

raw patch · 6 files changed

+67/−35 lines, 6 files

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Release history for stack-all +## 0.5 (2024-02-19)+- support ghc-X.Y/ghcX.Y aliases for lts major versions+- default oldest lts bumped from lts-11 (ghc8.2) to lts-16 (ghc8.8)+- ignore .cabal file directory+ ## 0.4.2 (2023-10-01) - support unversioned "lts" argument - add --refresh-cache option to force refresh of cached snapshots.json
README.md view
@@ -8,25 +8,28 @@  `stack-all` by default runs `stack build` over Stackage Nightly and LTS major versions-(current default is nightly & LTS 21, 20, 19, 18, 16, 14, 13, 12, 11)+(current default is nightly & major LTS versions back to lts-16) corresponding to latest major ghc minor versions, with appropriate stack `--resolver` options.  Note that `stack` only works if a `stack.yaml` file exists.-If no `stack.yaml` file is found, `stack-all` will create one.+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.  ### Help output-```shellsession-$ stack-all --version-0.4.2-$ stack-all --help+`$ stack-all --version`+```+0.5+```+`$ 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@@ -51,11 +54,11 @@ older LTS major versions until another `stack-ltsYY.yaml` file is found. `stack-nightly.yaml` is also supported, but used only for nightly. -For example if you have `stack-lts19.yaml` and `stack-lts16.yaml` files+For example if you have `stack-lts20.yaml` and `stack-lts18.yaml` files in your project,-then `stack.yaml` will be used as normal to build nightly, lts-21 and lts-20,-but `stack-lts19.yaml` will be used for building lts-19 and lts-18,-and `stack-lts16.yaml` will be used for lts-16, lts-14 (and older).+then `stack.yaml` will be used as normal to build nightly, lts-22 and lts-21,+but `stack-lts20.yaml` will be used for building lts-20 and lts-19,+and `stack-lts18.yaml` will be used for lts-18, lts-16 (and older). Since `stack-all` overrides the exact resolver with the latest minor snapshot, the exact minor Stackage version specified in the `stack*.yaml` files doesn't actually matter: `stack-all` always uses the latest published@@ -71,32 +74,35 @@ You can abbreviate `lts-XX` args to `ltsXX` on the commandline. `lts` is also accepted and resolved to the latest major LTS version. +You can also use ghc major version aliases:+eg `ghc9.6` corresponds to `lts22` or `ghc-9.2` to `lts-20`.+ 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-11`.+Otherwise if not configured the default oldest LTS is currently `lts-16`.  Similarly you can specify the newest LTS version to build from with-eg `stack-all -n lts19`. (The default is to build from nightly.)+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.  ### 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-16` which generates a `.stack-all`+by running for example `stack-all -c -o lts-18` which generates a `.stack-all` project config file like this: ``` [versions]-# lts-14 too old-oldest = lts-16+# lts-16 too old+oldest = lts-18 ``` (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-16.+This specifies that the oldest LTS version to build for is lts-18.  The newest LTS to build with stack-all can similarly be configured:-`stack-all -c -n lts20` or setting `newest = lts-20`.+`stack-all -c -n lts21` or setting `newest = lts-21`.  ### Running other stack commands By default `stack-all` just runs the stack `build` command over
src/Main.hs view
@@ -20,7 +20,7 @@ import Snapshots  defaultOldestLTS :: MajorVer-defaultOldestLTS = LTS 11+defaultOldestLTS = LTS 16  data VersionLimit = DefaultLimit | Oldest MajorVer | AllVersions @@ -241,8 +241,11 @@  -- looks in current dir for a unique file with given extension doesFileExistWithExtension :: FilePath -> String -> IO Bool-doesFileExistWithExtension dir ext =-  isJust <$> fileWithExtension dir ext+doesFileExistWithExtension dir ext = do+  mf <- fileWithExtension dir ext+  case mf of+    Nothing -> return False+    Just f -> doesFileExist f  #if !MIN_VERSION_filepath(1,4,2) isExtensionOf :: String -> FilePath -> Bool
src/MajorVer.hs view
@@ -10,7 +10,6 @@   ) where -import Control.Applicative import Data.List.Extra import SimpleCmd (error') import Text.Read (readMaybe)@@ -21,12 +20,27 @@  maybeReadMajor :: String -> Maybe MajorVer maybeReadMajor "nightly" = Just Nightly-maybeReadMajor ver =-  if "lts" `isPrefixOf` ver then-    case readMaybe (dropPrefix "lts-" ver) <|> readMaybe (dropPrefix "lts" ver) of-      Just major -> Just (LTS major)-      Nothing -> Nothing-  else Nothing+maybeReadMajor ver+  | "lts" `isPrefixOf` ver =+      case readMaybe (dropPrefix "-" (dropPrefix "lts-" ver)) of+        Just major -> Just (LTS major)+        Nothing -> Nothing+  | "ghc" `isPrefixOf` ver =+      case dropPrefix "-" (dropPrefix "ghc" ver) of+        "9.6" -> Just (LTS 22)+        "9.4" -> Just (LTS 21)+        "9.2" -> Just (LTS 20)+        "9.0" -> Just (LTS 19)+        "8.10" -> Just (LTS 18)+        "8.8" -> Just (LTS 16)+        "8.6" -> Just (LTS 14)+        "8.4" -> Just (LTS 12)+        "8.2" -> Just (LTS 11)+        "8.0" -> Just (LTS 9)+        "7.10" -> Just (LTS 6)+        "7.8" -> Just (LTS 2)+        _ -> Nothing+  | otherwise = Nothing  -- readMajor "lts-16" readMajor :: String -> MajorVer@@ -36,7 +50,7 @@   case maybeReadMajor ver of     Just s -> s     Nothing ->-      error' $! "couldn't parse " ++ ver ++ " (expected lts-XX or ltsXX)"+      error' $! "couldn't parse " ++ ver ++ " (expected lts-XX, ltsXX, ghc-X.Y or ghcX.Y)"  -- readCompactMajor "lts16" -- Should we support "stack-lts.yaml"?
src/Snapshots.hs view
@@ -17,6 +17,7 @@ #else import qualified Data.HashMap.Lazy as M #endif+import Data.Ord (comparing, Down(Down)) import qualified Data.Text as T import Network.HTTP.Query import SimpleCmd (error')@@ -30,7 +31,9 @@ getMajorVers :: IO [MajorVer] getMajorVers = do   obj <- getSnapshots False-  return $ reverse . sort $ map (readMajor . T.unpack . toText) (M.keys obj \\ ["lts"]) \\ excludedMajors+  return $+    sortBy (comparing Down) $+    map (readMajor . T.unpack . toText) (M.keys obj \\ ["lts"]) \\ excludedMajors #if !MIN_VERSION_aeson(2,0,0)   where toText = id #endif
stack-all.cabal view
@@ -1,5 +1,5 @@ name:                stack-all-version:             0.4.2+version:             0.5 synopsis:            CLI tool for building across Stackage major versions description:         Build your Haskell project over Stackage major LTS versions.@@ -7,7 +7,7 @@ license-file:        LICENSE author:              Jens Petersen <juhpetersen@gmail.com> maintainer:          Jens Petersen <juhpetersen@gmail.com>-copyright:           2020-2023  Jens Petersen <juhpetersen@gmail.com>+copyright:           2020-2024  Jens Petersen <juhpetersen@gmail.com> category:            Distribution homepage:            https://github.com/juhp/stack-all bug-reports:         https://github.com/juhp/stack-all/issues@@ -16,7 +16,8 @@                      ChangeLog.md 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.7+                     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.1  source-repository head   type:                git