;tools: Shake setversion: also update hledger-install.sh
This commit is contained in:
parent
8b425868da
commit
eaeb9222c5
25
Shake.hs
25
Shake.hs
@ -286,10 +286,13 @@ main = do
|
|||||||
|
|
||||||
when commit $ commitIfChanged ";cabal: update cabal files" cabalfiles
|
when commit $ commitIfChanged ";cabal: update cabal files" cabalfiles
|
||||||
|
|
||||||
-- Update version strings in most "source" files to match what's in PKG/.version.
|
-- setversion [VER] [PKGS] [-c]
|
||||||
-- If a version number is provided as first argument, save that in PKG/.version files first.
|
-- Update version strings in all packages, or just the ones specified.
|
||||||
-- If one or more subdirectories are provided as arguments, save/update only those.
|
-- If a version number is provided as first argument, save that in .version files first.
|
||||||
-- Also regenerates .cabal files from package.yaml files.
|
-- Then update various source files to match what's in their nearby .version file, such as:
|
||||||
|
-- package.yaml files, .cabal files (regenerating from package.yaml), .version.m4 files,
|
||||||
|
-- hledger-install.sh, etc.
|
||||||
|
-- With -c, also commit the changes.
|
||||||
-- See also CONTRIBUTING.md > Version numbers.
|
-- See also CONTRIBUTING.md > Version numbers.
|
||||||
phony "setversion" $ do
|
phony "setversion" $ do
|
||||||
let
|
let
|
||||||
@ -304,15 +307,16 @@ main = do
|
|||||||
Just v -> liftIO $ forM_ specifiedversionfiles $ flip maybeWriteFile (v++"\n")
|
Just v -> liftIO $ forM_ specifiedversionfiles $ flip maybeWriteFile (v++"\n")
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
|
|
||||||
-- update "source" files depending on .version in the specified packages
|
-- update source files depending on .version in the specified packages
|
||||||
let dependents = map (</> ".version.m4") specifiedpkgs
|
let dependents = map (</> ".version.m4") specifiedpkgs
|
||||||
++ map (</> "package.yaml") specifiedpkgs
|
++ map (</> "package.yaml") specifiedpkgs
|
||||||
|
++ ["hledger-install/hledger-install.sh"]
|
||||||
need dependents
|
need dependents
|
||||||
|
|
||||||
-- and maybe commit them
|
-- and maybe commit them
|
||||||
when commit $ do
|
when commit $ do
|
||||||
let msg = unwords [
|
let msg = unwords [
|
||||||
";pkg: bump"
|
";pkg: set"
|
||||||
,case dirargs of
|
,case dirargs of
|
||||||
[] -> "version"
|
[] -> "version"
|
||||||
ds -> intercalate ", " ds ++ " version"
|
ds -> intercalate ", " ds ++ " version"
|
||||||
@ -324,6 +328,15 @@ main = do
|
|||||||
|
|
||||||
gencabalfiles
|
gencabalfiles
|
||||||
|
|
||||||
|
-- Update some of the version strings in hledger-install/hledger-install.sh (not all).
|
||||||
|
-- Also sets the script version based on today's date.
|
||||||
|
phony "hledger-install/hledger-install.sh" $ do
|
||||||
|
let versionfile = ".version"
|
||||||
|
let out = "hledger-install/hledger-install.sh"
|
||||||
|
version <- ((headDef (error $ "failed to read " <> versionfile) . words) <$>) $ liftIO $ readFile versionfile
|
||||||
|
cmd_ Shell sed "-i -e" ("'s/(^HLEDGER_INSTALL_VERSION)=.*/\\1='`date +%Y%m%d`'/'") out
|
||||||
|
cmd_ Shell sed "-i -e" ("'s/(^HLEDGER(|_LIB|_UI|_WEB)_VERSION)=.*/\\1="++version++"/'") out
|
||||||
|
|
||||||
-- PKG/.version.m4 <- PKG/.version, just updates the _version_ macro
|
-- PKG/.version.m4 <- PKG/.version, just updates the _version_ macro
|
||||||
"hledger*/.version.m4" %> \out -> do
|
"hledger*/.version.m4" %> \out -> do
|
||||||
let versionfile = takeDirectory out </> ".version"
|
let versionfile = takeDirectory out </> ".version"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user