diff --git a/.gitignore b/.gitignore index c5b6d2e..f5a4864 100644 --- a/.gitignore +++ b/.gitignore @@ -402,4 +402,6 @@ ASALocalRun/ .mfractor/ # Local History for Visual Studio -.localhistory/ \ No newline at end of file +.localhistory/ +# tools/refresh-from-master.sh scratch (sibling clones + libmeos prefix). +.meos-chain/ diff --git a/tools/refresh-from-master.sh b/tools/refresh-from-master.sh new file mode 100755 index 0000000..fa68784 --- /dev/null +++ b/tools/refresh-from-master.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# refresh-from-master.sh — refresh this binding's generated surface against the latest MEOS API, +# end to end, with one command: +# +# tools/refresh-from-master.sh +# +# It runs the shared MobilityDB/MEOS-API refresh-binding.sh over this repo — deriving the catalog +# and libmeos from the latest MobilityDB master and regenerating this binding's surface. The +# per-binding last leg is in tools/refresh.conf. +# +# All of refresh-binding.sh's options pass through, e.g.: +# tools/refresh-from-master.sh --mdb ~/src/MobilityDB # refresh against a local MobilityDB branch +# tools/refresh-from-master.sh --skip-tests # regenerate + build, skip the tests +# +# MEOSAPI= uses an existing MEOS-API checkout (any branch); otherwise MEOS-API master is +# cloned into the work dir. WORK_DIR overrides the scratch location (default /.meos-chain). +set -euo pipefail + +HERE="$(cd "$(dirname "$0")/.." && pwd)" +WORK="${WORK_DIR:-$HERE/.meos-chain}" +MEOSAPI="${MEOSAPI:-}" + +if [ -z "$MEOSAPI" ]; then + MEOSAPI="$WORK/MEOS-API" + mkdir -p "$WORK" + if [ -d "$MEOSAPI/.git" ]; then + git -C "$MEOSAPI" fetch --quiet https://github.com/MobilityDB/MEOS-API master + git -C "$MEOSAPI" checkout --quiet FETCH_HEAD + else + git clone --quiet https://github.com/MobilityDB/MEOS-API "$MEOSAPI" + fi +fi + +exec "$MEOSAPI/tools/refresh-binding.sh" \ + --binding "$HERE" --meos-api "$MEOSAPI" --work-dir "$WORK" "$@" diff --git a/tools/refresh.conf b/tools/refresh.conf new file mode 100644 index 0000000..2992964 --- /dev/null +++ b/tools/refresh.conf @@ -0,0 +1,13 @@ +# refresh.conf — MEOS.NET's last leg for tools/refresh-binding.sh (in MEOS-API). +# The chain (MobilityDB -> catalog + libmeos) is shared; only these differ per binding. +# tools/codegen.py takes the catalog path as an argument, so CATALOG_DEST is empty and the +# catalog is read from $CATALOG; it regenerates the committed MEOS.NET/Internal/*.cs. +# BUILD_CMD runs from / with $PREFIX (libmeos prefix) and $CATALOG exported; +# $SKIP_TESTS is set when --skip-tests is passed. +ENGINE=csharp +BUILD_DIR=. +BUILD_LIBMEOS=true +CATALOG_DEST= +BUILD_CMD='python3 tools/codegen.py "$CATALOG" + dotnet build MEOS.NET.sln -c Release + [ -n "${SKIP_TESTS:-}" ] || LD_LIBRARY_PATH="$PREFIX/lib" dotnet test MEOS.NET.sln -c Release --no-build'