From b02049d4ee7d1ac55d5041e9914037de5f7387ab Mon Sep 17 00:00:00 2001 From: Jean M <132435771+jeanmon@users.noreply.github.com> Date: Wed, 31 May 2023 14:34:42 +0200 Subject: [PATCH] Make bash some scripts runnable from any location (#723) --- bootstrap.sh | 11 ++++------- circuits/cpp/bootstrap.sh | 2 ++ circuits/cpp/scripts/run_tests_local | 6 ++++-- l1-contracts/bootstrap.sh | 2 ++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 0946e34c92b..b0124523316 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -3,6 +3,8 @@ set -eu export CLEAN=${1:-} +cd "$(dirname "$0")" + # Remove all untracked files and directories. if [ -n "$CLEAN" ]; then if [ "$CLEAN" = "clean" ]; then @@ -32,13 +34,8 @@ if [ ! -f ~/.nvm/nvm.sh ]; then exit 1 fi -cd circuits/cpp -./bootstrap.sh -cd ../.. - -cd l1-contracts -./bootstrap.sh -cd .. +circuits/cpp/bootstrap.sh +l1-contracts/bootstrap.sh if [ "$(uname)" = "Darwin" ]; then # works around https://github.com/AztecProtocol/aztec3-packages/issues/158 diff --git a/circuits/cpp/bootstrap.sh b/circuits/cpp/bootstrap.sh index 6c5c2c1f564..dbca0b634ff 100755 --- a/circuits/cpp/bootstrap.sh +++ b/circuits/cpp/bootstrap.sh @@ -5,6 +5,8 @@ set -eu export WASI_VERSION=12 +cd "$(dirname "$0")" + # Update the submodule git submodule update --init --recursive diff --git a/circuits/cpp/scripts/run_tests_local b/circuits/cpp/scripts/run_tests_local index 022b4b827f4..e209cda65cf 100755 --- a/circuits/cpp/scripts/run_tests_local +++ b/circuits/cpp/scripts/run_tests_local @@ -1,6 +1,8 @@ #!/bin/bash set -e +DIR="$(dirname "$0")" + # To be called LOCALLY for testing WITHOUT docker. # Also serves as a core/helper script called by # `run_tests` and `build_run_tests_docker_local` @@ -39,9 +41,9 @@ fi if [ "$ARCH" != "wasm" ]; then # x86_64 / anything other than wasm - BUILD_DIR=build + BUILD_DIR=$DIR/../build else - BUILD_DIR=build-wasm + BUILD_DIR=$DIR/../build-wasm fi # if TESTS is GLOB or empty, run all built tests diff --git a/l1-contracts/bootstrap.sh b/l1-contracts/bootstrap.sh index 8ef3dc8af7d..3cb814fc4d5 100755 --- a/l1-contracts/bootstrap.sh +++ b/l1-contracts/bootstrap.sh @@ -1,6 +1,8 @@ #!/bin/bash set -eu +cd "$(dirname "$0")" + # Clean rm -rf broadcast cache out serve