From f3b55daab2cb39821a9db355e0908eee3fa8d75b Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Tue, 28 Jul 2026 21:49:20 +0200 Subject: [PATCH] Add a one-command refresh against upstream MEOS tools/refresh-from-master.sh refreshes the MeosOps* facades against upstream MEOS in one command: it runs the shared MEOS-API refresh-jvm-chain.sh over this repo, deriving libmeos and the catalog from MobilityDB master, building the JMEOS jar, and regenerating the facades. tools/refresh.conf holds this consumer last leg (the binding module, the org.jmeos:meos:1.0 coordinates, the mvn command). GENERATION.md leads with the one-liner; the module it builds is binding, matching the current layout. .gitignore excludes the wrapper .meos-chain scratch dir. --- .gitignore | 3 +++ GENERATION.md | 47 ++++++++++++------------------------ tools/refresh-from-master.sh | 35 +++++++++++++++++++++++++++ tools/refresh.conf | 8 ++++++ 4 files changed, 62 insertions(+), 31 deletions(-) create mode 100755 tools/refresh-from-master.sh create mode 100644 tools/refresh.conf diff --git a/.gitignore b/.gitignore index 11fb378..485d9ed 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ __pycache__/ # Derived generator input — the MEOS catalog is staged in CI from upstream # MobilityDB master (provision-meos), never committed. tools/meos-idl.json + +# tools/refresh-from-master.sh scratch (sibling clones + libmeos prefix). +.meos-chain/ diff --git a/GENERATION.md b/GENERATION.md index 226ece5..d585cc6 100644 --- a/GENERATION.md +++ b/GENERATION.md @@ -69,44 +69,29 @@ the smoke tests load is built from the **same** master catalog, so the jar surfa facades and the native library all track master together — surface-match by construction, with no committed jar or pinned commit to drift. -## Regenerating by hand +## Refreshing against upstream MEOS -CI performs the steps below via `provision-meos`. To run them yourself you need a JDK, Maven, -CMake and the MEOS build dependencies. - -**1. Derive libmeos and the catalog from MobilityDB master.** Both come from one commit; see -`MEOS-API/GENERATION.md` for the two commands: +`tools/refresh-from-master.sh` runs the whole chain — deriving libmeos and the catalog from +MobilityDB master, building the JMEOS jar, and regenerating the `MeosOps*` facades — in one +command, on Ubuntu with a JDK, Maven, CMake and the MEOS build dependencies installed: ```bash -MDB=~/src/MobilityDB # checkout at the commit you are deriving from -MEOSAPI=~/src/MEOS-API -cmake -S "$MDB" -B "$MDB/build" -DCMAKE_BUILD_TYPE=Release -DMEOS=ON -DALL=ON -cmake --build "$MDB/build" -j"$(nproc)" -cmake --install "$MDB/build" --prefix "$MDB/.prefix" -cd "$MEOSAPI" && MDB_SRC_ROOT="$MDB" python3 run.py "$MDB/.prefix/include" +tools/refresh-from-master.sh ``` -**2. Build the JMEOS jar against that catalog and install it into the local Maven -repository** under the coordinates this build resolves — `org.jmeos:meos:1.0`: +It runs the shared `MobilityDB/MEOS-API` `refresh-jvm-chain.sh` over this repo (cloning MEOS-API +master the first time). All of that script's options pass through: ```bash -cd ~/src/JMEOS # JMEOS main -CATALOG="$MEOSAPI/output/meos-idl.json" LIBMEOS="$MDB/.prefix/lib/libmeos.so" \ - tools/regen-from-catalog.sh -mvn install:install-file -Dfile=jar/JMEOS.jar \ - -DgroupId=org.jmeos -DartifactId=meos -Dversion=1.0 -Dpackaging=jar +tools/refresh-from-master.sh --mdb ~/src/MobilityDB # refresh against a local MobilityDB branch +tools/refresh-from-master.sh --skip-tests # regenerate + compile, skip the smoke tests ``` -**3. Stage the catalog and build.** `tools/meos-idl.json` is derived, not committed: - -```bash -cd ~/src/MobilityFlink -cp "$MEOSAPI/output/meos-idl.json" tools/meos-idl.json -cd flink-processor -mvn -Dmeos.lib.dir="$MDB/.prefix/lib" -Dmeos.enabled=true clean test -``` +This repo's last leg is `tools/refresh.conf`: the `binding` Maven module, the `org.jmeos:meos:1.0` +jar coordinates, and the `mvn … clean test` command. `generate-sources` runs `tools/codegen_jvm.py +--engine flink` over the staged `tools/meos-idl.json` and the installed jar, so the facades are +regenerated by the build itself; `meos.lib.dir` is where the smoke tests find `libmeos.so` and +`meos.enabled` turns them on. -`generate-sources` runs `tools/codegen_jvm.py --engine flink --catalog ../tools/meos-idl.json ---jar --out target/generated-facades`, so the `MeosOps*` facades are -regenerated by the build itself. `meos.lib.dir` is where the smoke tests look for -`libmeos.so`, and `meos.enabled` turns them on. +The chain's per-leg commands, which `refresh-jvm-chain.sh` composes, are in `MEOS-API/GENERATION.md` +(`provision-meos.sh`) and `JMEOS/GENERATION.md` (`regen-from-catalog.sh`). diff --git a/tools/refresh-from-master.sh b/tools/refresh-from-master.sh new file mode 100755 index 0000000..26e9155 --- /dev/null +++ b/tools/refresh-from-master.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# refresh-from-master.sh — refresh this consumer's MEOS facades against the latest MEOS API, +# end to end, with one command: +# +# tools/refresh-from-master.sh +# +# It runs the shared MobilityDB/MEOS-API refresh-jvm-chain.sh over this repo — deriving the +# catalog and libmeos from the latest MobilityDB master, building the JMEOS jar, and +# regenerating this consumer's facades. The per-consumer last leg is in tools/refresh.conf. +# +# All of refresh-jvm-chain.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 + compile, skip the test run +# +# 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-jvm-chain.sh" \ + --consumer "$HERE" --meos-api "$MEOSAPI" --work-dir "$WORK" "$@" diff --git a/tools/refresh.conf b/tools/refresh.conf new file mode 100644 index 0000000..240ce5d --- /dev/null +++ b/tools/refresh.conf @@ -0,0 +1,8 @@ +# refresh.conf — MobilityFlink's last leg for tools/refresh-jvm-chain.sh (in MEOS-API). +# The chain (MobilityDB -> catalog + libmeos -> JMEOS jar) is shared; only these differ per +# consumer. BUILD_CMD runs from / with $PREFIX (the libmeos install prefix), +# $CATALOG and $JAR exported; $SKIP_TESTS is set when --skip-tests is passed. +ENGINE=flink +BUILD_DIR=. +JMEOS_COORDS=org.jmeos:meos:1.0 +BUILD_CMD='LD_LIBRARY_PATH="$PREFIX/lib" mvn -B -Dmeos.lib.dir="$PREFIX/lib" -Dmeos.enabled=true ${SKIP_TESTS:+-DskipTests} clean test'