Repository navigation
fix(just): real build and test recipes; one justfile #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| # | ||
| # Run the AffineScript compiler. | ||
| # Compiler: $AFFINESCRIPT if set, else the pinned build from | ||
| # scripts/install-affinescript.sh, else `affinescript` on PATH. | ||
| set -euo pipefail | ||
|
|
||
| root=$(cd "$(dirname "$0")/.." && pwd) | ||
| pinned="$root/.affinescript/compiler" | ||
|
|
||
| compiler="" | ||
| if [ -z "${AFFINESCRIPT:-}" ]; then | ||
|
Check failure on line 13 in scripts/affinescript.sh
|
||
| if [ -x "$pinned/_build/default/bin/main.exe" ]; then | ||
|
Check failure on line 14 in scripts/affinescript.sh
|
||
| compiler="$pinned/_build/default/bin/main.exe" | ||
| elif command -v affinescript >/dev/null 2>&1; then | ||
| compiler=affinescript | ||
| else | ||
| echo "affinescript not found. Run 'just setup-compiler' (scripts/install-affinescript.sh) first." >&2 | ||
| exit 127 | ||
| fi | ||
| fi | ||
| if [ -z "${AFFINESCRIPT_STDLIB:-}" ] && [ -d "$pinned/stdlib" ]; then | ||
|
Check failure on line 23 in scripts/affinescript.sh
|
||
| export AFFINESCRIPT_STDLIB="$pinned/stdlib" | ||
| fi | ||
|
|
||
| # A path chosen here is one word, even if the checkout path has spaces. | ||
| if [ -n "$compiler" ]; then | ||
|
Check failure on line 28 in scripts/affinescript.sh
|
||
| exec "$compiler" "$@" | ||
| fi | ||
| # shellcheck disable=SC2086 # a user-set AFFINESCRIPT may be a multi-word command | ||
| exec $AFFINESCRIPT "$@" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the required SPDX identifier in both new scripts. Both new scripts declare Based on learnings, “SPDX:
|
||
| # | ||
| # Build the pinned AffineScript compiler into .affinescript/compiler. | ||
| # scripts/affinescript.sh finds it there; nothing is installed globally. | ||
| # | ||
| # Needs git, OCaml >= 4.14 and dune >= 3.14, plus the compiler's OCaml | ||
| # libraries (menhir, sedlex, ppx_deriving, ppx_sexp_conv, sexplib0, fmt, | ||
| # cmdliner, yojson, js_of_ocaml, js_of_ocaml-ppx). With opam on PATH the | ||
| # script installs those itself; otherwise they must come from the system | ||
| # (for example Debian/Ubuntu: ocaml-dune menhir libmenhir-ocaml-dev | ||
| # libsedlex-ocaml-dev libppx-deriving-ocaml-dev libppx-sexp-conv-ocaml-dev | ||
| # libsexplib0-ocaml-dev libfmt-ocaml-dev libcmdliner-ocaml-dev | ||
| # libyojson-ocaml-dev libjs-of-ocaml-dev js-of-ocaml). | ||
| set -euo pipefail | ||
|
|
||
| # The only compiler pin. Keep it equal to TOOL_LANE_COMPILER_REF in | ||
| # any CI workflow that builds the compiler. | ||
| COMPILER_REPO="https://github.com/hyperpolymath/affinescript.git" | ||
| COMPILER_REF="4a55253703e13a96a768656a7ed548919c341261" | ||
|
|
||
| root=$(cd "$(dirname "$0")/.." && pwd) | ||
| dir="$root/.affinescript/compiler" | ||
|
|
||
| if [ ! -d "$dir/.git" ]; then | ||
|
Check failure on line 25 in scripts/install-affinescript.sh
|
||
| mkdir -p "$(dirname "$dir")" | ||
| git clone --quiet "$COMPILER_REPO" "$dir" | ||
| fi | ||
| git -C "$dir" fetch --quiet origin "$COMPILER_REF" 2>/dev/null || git -C "$dir" fetch --quiet origin | ||
| git -C "$dir" checkout --quiet --detach "$COMPILER_REF" | ||
|
|
||
| cd "$dir" | ||
| if command -v opam >/dev/null 2>&1; then | ||
| opam install . --deps-only -y | ||
| opam exec -- dune build bin/main.exe | ||
| else | ||
| command -v dune >/dev/null 2>&1 || { | ||
| echo "dune not found: install opam, or the system OCaml packages listed at the top of $0" >&2 | ||
| exit 1 | ||
| } | ||
| dune build bin/main.exe | ||
| fi | ||
| "$dir/_build/default/bin/main.exe" --version | ||
| echo "AffineScript compiler ready at $dir (pin $COMPILER_REF)" | ||
Uh oh!
There was an error while loading. Please reload this page.