From 6b377719c10d5ab3343fd5221f99a4a21008e25a Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 14 Mar 2024 08:26:58 +0100 Subject: Initial commit --- lib/tools/dune | 10 ++++++++++ lib/tools/git_head.sh | 11 +++++++++++ 2 files changed, 21 insertions(+) create mode 100644 lib/tools/dune create mode 100755 lib/tools/git_head.sh (limited to 'lib/tools') diff --git a/lib/tools/dune b/lib/tools/dune new file mode 100644 index 0000000..29ee744 --- /dev/null +++ b/lib/tools/dune @@ -0,0 +1,10 @@ +(library + (name tools)) + +(rule + (target git_hash.ml) + (deps git_head.sh (universe)) + (action + (with-stdout-to + %{target} + (bash "./git_head.sh")))) diff --git a/lib/tools/git_head.sh b/lib/tools/git_head.sh new file mode 100755 index 0000000..bfa738a --- /dev/null +++ b/lib/tools/git_head.sh @@ -0,0 +1,11 @@ +#! /bin/sh +# Include the git hash in an OCaml file. + +git diff-index --quiet HEAD -- +if [ $? -ne 0 ]; then + revision=": untracked" +else + revision=$(git rev-parse --short HEAD) +fi +compile_date=$(date +%Y/%m/%d) +echo "let revision = \"${revision} - compiled on ${compile_date}\"" -- cgit v1.2.3