From 3159397a817aedc9bc84b7a88c148d680cf3e42f Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 27 Nov 2024 16:17:57 +0100 Subject: [PATCH 1/3] misc(setup.sh): `rebuild.sh` -> `just build` --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index a20542e0f..23f9de20e 100755 --- a/setup.sh +++ b/setup.sh @@ -19,7 +19,7 @@ while [ $# -gt 0 ]; do done # Warns if we're building in a dirty checkout of hax: while hacking on -# hax, we should really be using the `./.utils/rebuild.sh` +# hax, we should really be using `just build`. warn_if_dirty() { ( cd "$SCRIPTPATH" From 1dc71b068bc4860004d3e122bd2700c072522dfd Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 27 Nov 2024 16:23:52 +0100 Subject: [PATCH 2/3] feat(setup.sh): cleanup cargo & dune by default, add a `--no-cleanup` flag --- setup.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/setup.sh b/setup.sh index 23f9de20e..18101ff36 100755 --- a/setup.sh +++ b/setup.sh @@ -5,6 +5,7 @@ set -eu SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" opam_jobs=4 +CLEANUP_WORKSPACE=on # Parse command line arguments. all_args=("$@") @@ -14,10 +15,23 @@ while [ $# -gt 0 ]; do opam_jobs=$2 shift ;; + --no-cleanup) + CLEANUP_WORKSPACE=off + ;; esac shift done +# Cleanup the cargo and dune workspace, to make sure we are in a clean +# state +cleanup_workspace() { + cargo clean + ( + cd engine + dune clean + ) +} + # Warns if we're building in a dirty checkout of hax: while hacking on # hax, we should really be using `just build`. warn_if_dirty() { @@ -86,6 +100,10 @@ install_ocaml_engine() { ) } +if [ "$CLEANUP_WORKSPACE" = "on" ]; then + cleanup_workspace +fi + warn_if_dirty for binary in opam node rustup jq; do From c297dc516a80457403b070ec42771dade92b9213 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 27 Nov 2024 16:27:24 +0100 Subject: [PATCH 3/3] feat(setup.sh): add `--help` message --- setup.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/setup.sh b/setup.sh index 18101ff36..2e592d1a6 100755 --- a/setup.sh +++ b/setup.sh @@ -18,6 +18,16 @@ while [ $# -gt 0 ]; do --no-cleanup) CLEANUP_WORKSPACE=off ;; + --help) + echo "hax setup script" + echo "" + echo "Usage: $0 [OPTIONS]" + echo "" + echo "Options:" + echo ' -j The number of opam jobs to run in parallel' + echo ' --no-cleanup Disables the default behavior that runs `cargo clean` and `dune clean`' + exit + ;; esac shift done