mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-07-14 17:20:35 +03:00
Always embed git commit into --version output
Previously, we attempted to scrub out `git` commits from release binaries using a `sed` invocation in the `cry` script, but as was observed in #1353, this ended up scrubbing out `git` commits on all builds, not just release ones. We have decided that we should just include `git` commits on all builds, so we can fix the issue by removing the buggy use of `sed`. Unfortunately, `cabal`'s recompilation logic is not smart enough to always rebuild `GitRev.hs` on every new commit, even though it should. For this reason, we make the `./cry build` command temporarily dirty the `GitRev.hs` file so that it is forcibly rebuilt, then revert the change to `GitRev.hs` and rebuild. It's rather heavy-handed, but it works. Fixes #1353.
This commit is contained in:
parent
383a5974e2
commit
588f5c3184
14
cry
14
cry
@ -44,25 +44,17 @@ case $COMMAND in
|
|||||||
# XXX: This is a workaround the fact that currently Cabal
|
# XXX: This is a workaround the fact that currently Cabal
|
||||||
# will not rebuild this file, even though it has TH code, that
|
# will not rebuild this file, even though it has TH code, that
|
||||||
# depends on the environment. For now, we temporarily modify the
|
# depends on the environment. For now, we temporarily modify the
|
||||||
# file, then build, then revert it back after build.
|
# file, then build, then revert it back, then build once more.
|
||||||
|
|
||||||
dirty_string="-- Last build $(date)"
|
dirty_string="-- Last build $(date)"
|
||||||
echo "$dirty_string" >> src/GitRev.hs
|
echo "$dirty_string" >> src/GitRev.hs
|
||||||
|
|
||||||
if [[ -n "$RELEASE" ]]; then
|
|
||||||
sed -i.bak -e 's/^commitShortHash = .*$/commitShortHash = "UNKNOWN"/' \
|
|
||||||
-e 's/^commitHash = .*$/commitHash = "UNKNOWN"/' \
|
|
||||||
-e 's/^commitBranch = .*$/commitBranch = "UNKNOWN"/' \
|
|
||||||
-e 's/^commitDirty = .*$/commitDirty = False/' \
|
|
||||||
-e '/import qualified GitRev/d' \
|
|
||||||
src/Cryptol/Version.hs
|
|
||||||
rm -f src/Cryptol/Version.hs.bak
|
|
||||||
fi
|
|
||||||
|
|
||||||
cabal v2-build "$@" exe:cryptol
|
cabal v2-build "$@" exe:cryptol
|
||||||
|
|
||||||
sed -i.bak "/^-- Last build/d" src/GitRev.hs
|
sed -i.bak "/^-- Last build/d" src/GitRev.hs
|
||||||
rm -f src/GitRev.hs.bak
|
rm -f src/GitRev.hs.bak
|
||||||
|
|
||||||
|
cabal v2-build "$@" exe:cryptol
|
||||||
;;
|
;;
|
||||||
|
|
||||||
haddock) echo Building Haddock documentation && cabal v2-haddock ;;
|
haddock) echo Building Haddock documentation && cabal v2-haddock ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user