From 2f0abc76fed77f835b9328bcc4f9662523849e11 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Tue, 28 Jul 2026 22:01:45 +0200 Subject: [PATCH] Add a one-command refresh against upstream MEOS tools/refresh-from-master.sh refreshes the generated UDF layer 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 surface. tools/refresh.conf holds this consumer last leg (the repo-root module, the org.jmeos:meos:1.0 coordinates, the mvn command). GENERATION.md leads with the one-liner; .gitignore excludes the .meos-chain scratch. --- .gitignore | 3 +++ GENERATION.md | 44 ++++++++++++------------------------ tools/refresh-from-master.sh | 35 ++++++++++++++++++++++++++++ tools/refresh.conf | 8 +++++++ 4 files changed, 61 insertions(+), 29 deletions(-) create mode 100755 tools/refresh-from-master.sh create mode 100644 tools/refresh.conf diff --git a/.gitignore b/.gitignore index 3d1c0cfb..9dee64f8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ src/main/java/org/mobilitydb/spark/generated/ # Derived MEOS catalog (generated in CI via the provision-meos action) 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 f959937f..c4d32343 100644 --- a/GENERATION.md +++ b/GENERATION.md @@ -35,42 +35,28 @@ so the catalog and jar never drift from the `run.py` that derives them. The UDF layer is the generated `registerAll()` — zero hand-written registrations. -## 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 UDF layer — 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 tests ``` -**3. Stage the catalog and build.** `tools/meos-idl.json` is derived, not committed: - -```bash -cd ~/src/MobilitySpark -cp "$MEOSAPI/output/meos-idl.json" tools/meos-idl.json -LD_LIBRARY_PATH="$MDB/.prefix/lib" mvn clean test -``` +This repo's last leg is `tools/refresh.conf`: the repo-root Maven module, the `org.jmeos:meos:1.0` +jar coordinates, and the `mvn … clean test` command. `generate-sources` runs `tools/codegen_jvm.py +--engine spark` over the staged `tools/meos-idl.json` and the installed jar, so the UDF layer is +regenerated by the build itself; `LD_LIBRARY_PATH` is how the tests find `libmeos.so`. -`generate-sources` runs `tools/codegen_jvm.py --engine spark --catalog tools/meos-idl.json ---jar --out target/generated-sources/spark/...`, so the UDF layer is -regenerated by the build itself. `LD_LIBRARY_PATH` is how the tests find `libmeos.so`. +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 00000000..26e91552 --- /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 00000000..7a69bee9 --- /dev/null +++ b/tools/refresh.conf @@ -0,0 +1,8 @@ +# refresh.conf — MobilitySpark'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=spark +BUILD_DIR=. +JMEOS_COORDS=org.jmeos:meos:1.0 +BUILD_CMD='LD_LIBRARY_PATH="$PREFIX/lib" mvn -B ${SKIP_TESTS:+-DskipTests} clean test'