Skip to content

Commit

Permalink
feat: fix scripts to use different paths if mina is a submodule of o1js
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMinkov committed Sep 28, 2023
1 parent 14047c5 commit a025ce4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/lib/crypto/kimchi_backend/common/gen_version.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#!/usr/bin/env bash
set -e -o pipefail

git_root=$(git rev-parse --show-toplevel)
mina_submodule=$(git submodule status | grep "mina" || true)

if [ -z ${MARLIN_REPO_SHA+x} ]; then
marlin_submodule_dir=$(git submodule status | grep proof-systems | sed 's/^[-\ ]//g' | cut -d ' ' -f 2)
marlin_repo_sha=$(cd $marlin_submodule_dir && git rev-parse --short=8 --verify HEAD)
if [[ -n "$mina_submodule" ]]; then
marlin_submodule_dir=$(git -C "$git_root/src/mina" submodule status | grep proof-systems | sed 's/^[-\ ]//g' | cut -d ' ' -f 2)
marlin_repo_sha=$(git -C "$git_root/src/mina/$marlin_submodule_dir" rev-parse --short=8 --verify HEAD)
else
marlin_submodule_dir=$(git submodule status | grep proof-systems | sed 's/^[-\ ]//g' | cut -d ' ' -f 2)
marlin_repo_sha=$(git -C "$marlin_submodule_dir" rev-parse --short=8 --verify HEAD)
fi
else
marlin_repo_sha=$(cut -b -8 <<< "$MARLIN_REPO_SHA")
fi

echo "let marlin_repo_sha = \"$marlin_repo_sha\"" >> "$1"
echo "let marlin_repo_sha = \"$marlin_repo_sha\"" >> "$1"
9 changes: 7 additions & 2 deletions src/lib/mina_version/normal/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ pushd "$root" > /dev/null
if [[ -e .git ]] && ! git diff --quiet; then id="[DIRTY]$id"; fi
commit_date="${MINA_COMMIT_DATE-$(git show HEAD -s --format="%cI" || echo "<unknown>")}"

pushd src/lib/crypto/proof-systems > /dev/null
mina_submodule=$(git submodule status | grep "mina" || true)
if [[ -n "$mina_submodule" ]]; then
pushd src/mina/src/lib/crypto/proof-systems > /dev/null
else
pushd src/lib/crypto/proof-systems > /dev/null
fi
marlin_commit_id="${MARLIN_COMMIT_ID-$(git rev-parse --verify HEAD || echo "<unknown>")}"
marlin_commit_id_short="$(printf '%s' "$marlin_commit_id" | cut -c1-8)"
if [[ -e .git ]] && ! git diff --quiet; then marlin_commit_id="[DIRTY]$marlin_commit_id"; fi
Expand All @@ -31,4 +36,4 @@ popd > /dev/null
printf 'let marlin_commit_date = "%s"\n' "$marlin_commit_date"

printf 'let print_version () = Core_kernel.printf "Commit %%s on branch %%s\\n%%!" commit_id branch\n'
} > "$1"
} > "$1"

0 comments on commit a025ce4

Please sign in to comment.