Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# provision-meos action. Tracking master (not a pinned commit) keeps the
# source, the catalog, the JMEOS jar and the libmeos the tests load all moving
# together, so the generated facades can never drift from the surface they run
# against. build-jmeos.sh then only builds the JMEOS jar against this libmeos.
# against. The JMEOS jar is then built from JMEOS main against this libmeos.
- name: Provision MEOS catalog + libmeos
id: provision
uses: MobilityDB/MEOS-API/.github/actions/provision-meos@master
Expand All @@ -39,14 +39,28 @@ jobs:
# The catalog is gitignored — it only ever exists as a build artifact.
run: cp "${{ steps.provision.outputs.catalog-path }}" tools/meos-idl.json

- name: Build JMEOS.jar against the installed libmeos
# libmeos is already built and installed under /usr/local by the
# provision-meos action, so build-jmeos.sh skips its own libmeos build
# and only builds the JMEOS jar from JMEOS main, installs it into the
# local Maven repo, and stages libmeos.so under the reactor-root lib/.
run: JOBS=2 ./build-jmeos.sh
- name: Check out JMEOS
uses: actions/checkout@v4
with:
repository: MobilityDB/JMEOS
path: jmeos

- name: Build + install the JMEOS jar as org.jmeos:meos:1.0
# Mirror MobilitySpark and MobilityFlink: stage the derived catalog + libmeos into the
# JMEOS checkout and build it (jmeos-core's generate-sources emits GeneratedFunctions
# from the catalog), then install the plain jar/JMEOS.jar under the org.jmeos:meos:1.0
# coordinates the binding depends on. Tests are skipped — JMEOS's own CI exercises its
# FFI suite; only the jar is needed here.
run: |
mkdir -p jmeos/codegen/input
cp "${{ steps.provision.outputs.catalog-path }}" jmeos/codegen/input/meos-idl.json
cp /usr/local/lib/libmeos.so jmeos/jmeos-core/src/
mvn -B -f jmeos/pom.xml clean install -Dmaven.test.skip=true
mvn -B install:install-file \
-Dfile=jmeos/jar/JMEOS.jar \
-DgroupId=org.jmeos -DartifactId=meos -Dversion=1.0 -Dpackaging=jar

- name: Test the Kafka Streams app
# The generated MeosOps* facades forward to the installed JMEOS jar; the tests
# exercise them against the freshly built libmeos, resolved via LD_LIBRARY_PATH.
run: LD_LIBRARY_PATH="$PWD/lib" mvn -B test
# The generated MeosOps* facades forward to the installed JMEOS jar; the tests exercise
# them against libmeos from /usr/local/lib (surefire sets LD_LIBRARY_PATH=meos.lib.dir).
run: mvn -B clean test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ target/
# MobilityDB master (provision-meos), never committed.
tools/meos-idl.json

# tools/refresh-from-master.sh scratch (sibling clones + libmeos prefix).
.meos-chain/

# JMEOS native dependency — generated by build-jmeos.sh, never committed
.build-jmeos/
jar/
Expand Down
66 changes: 24 additions & 42 deletions GENERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,63 +43,45 @@ and `build-helper` adds it as a source root. The sole hand-written class under

## The build chain — no committed binaries

`build-jmeos.sh` reproduces the native/JVM chain, so the repository carries no jar or
`libmeos.so`:
The chain is reproduced from source, so the repository carries no jar or `libmeos.so`:

```
MobilityDB @ master
→ provision-meos (MEOS-API/run.py + cmake -DMEOS=ON -DALL) → meos-idl.json + libmeos.so
build-jmeos.sh: JMEOS main → JMEOS.jar → com.mobilitydb:jmeos:1.4.0
→ JMEOS main (mvn install) → JMEOS.jar → org.jmeos:meos:1.0
→ tools/codegen_jvm.py --engine kafka (full jar surface) → org.mobilitydb.meos.MeosOps* facades
kafka-streams-app (mvn test)
binding (mvn test)
```

CI derives the catalog + all-families `libmeos.so` from upstream MobilityDB master through
the shared `provision-meos` action, stages the catalog to `tools/meos-idl.json`, and lets
`build-jmeos.sh` build the JMEOS jar from JMEOS `main` against that libmeos. Tracking master
(not a pinned commit) keeps the source, the catalog, the jar and the libmeos the tests load
all moving together, so the generated facades can never drift from the surface they run
against.
CI derives the catalog + all-families `libmeos.so` from upstream MobilityDB master through the
shared `provision-meos` action, stages the catalog to `tools/meos-idl.json`, and builds the
JMEOS jar from JMEOS `main` against that libmeos, installing it as `org.jmeos:meos:1.0` — the
same jar coordinates and build steps MobilitySpark and MobilityFlink use. Tracking master (not a
pinned commit) keeps the source, the catalog, the jar and the libmeos the tests load all moving
together, so the generated facades can never drift from the surface they run against.

## Regenerating by hand
## Refreshing against upstream MEOS

CI performs the steps below via `provision-meos` and `build-jmeos.sh`. 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. Stage the catalog and build the JMEOS jar.** `tools/meos-idl.json` is derived, not
committed. `build-jmeos.sh` builds the jar from JMEOS `main` and installs it into the local
Maven repository as `com.mobilitydb:jmeos:1.4.0`, the coordinates this build resolves. It
reuses an already-built libmeos rather than building its own — `INSTALLED_LIBMEOS` points at
one, defaulting to `/usr/local/lib/libmeos.so` — and copies it into `kafka-streams-app/lib/`:
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/MobilityKafka
cp "$MEOSAPI/output/meos-idl.json" tools/meos-idl.json
INSTALLED_LIBMEOS="$MDB/.prefix/lib/libmeos.so" ./build-jmeos.sh
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
```

Without `INSTALLED_LIBMEOS` the script clones MobilityDB at `MOBILITYDB_REF` (default
`master`) and builds libmeos itself, which is the same derivation done twice.

**3. Build and run the tests**, resolving the library from where step 2 placed it:

```bash
cd kafka-streams-app
LD_LIBRARY_PATH="$PWD/lib" mvn 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 kafka` over the staged `tools/meos-idl.json` and the installed jar, so the `MeosOps*`
facades are regenerated by the build itself; `meos.lib.dir` is where the tests find `libmeos.so`.

`generate-sources` runs `tools/codegen_jvm.py --engine kafka --catalog ../tools/meos-idl.json
--jar <the installed jar> --out target/generated-facades`, so the `MeosOps*` facades are
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`).
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,11 @@ Spatial predicates today use pure-Java great-circle (`Haversine`) and planar seg

The spatial predicates route through MEOS via the [JMEOS](https://github.com/MobilityDB/JMEOS)
bridge, so the build needs the JMEOS jar and the native `libmeos.so`. Neither is
committed to this repository — generate them from source with the helper script,
which clones MobilityDB and JMEOS at pinned, immutable refs, builds `libmeos.so`,
builds the jar, installs the jar into the local Maven repository, and stages
`libmeos.so` for the runtime:

```
./build-jmeos.sh
```

Run it once (re-run it only to bump the pinned MobilityDB/JMEOS refs at the top of
the script). After it succeeds, JMEOS resolves as an ordinary Maven dependency.
committed to this repository — both are derived from source: derive `libmeos.so`
and the catalog from MobilityDB master, build the JMEOS jar and install it as
`org.jmeos:meos:1.0`, then build. `GENERATION.md` gives the exact commands, the same
ones MobilitySpark and MobilityFlink use. Once the jar is installed, JMEOS resolves
as an ordinary Maven dependency.

### Build the app

Expand Down
4 changes: 2 additions & 2 deletions benchmark/docs/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ gone idle. The trailing settle time is excluded from the wall; each consumed
record runs the cell's MEOS predicate, so this is the steady-state per-event
processing rate, directly comparable to the MobilityFlink figures.

Run from `kafka-streams-app/` after `../build-jmeos.sh` (which installs JMEOS into
the local Maven repository and stages `libmeos.so` under `lib/`). The test-scope
Run after building the chain (see `GENERATION.md`), which installs JMEOS as
`org.jmeos:meos:1.0` and libmeos under `/usr/local/lib`. The test-scope
classpath that `mvn` reconstructs already carries JMEOS and the embedded broker, so
no jar is referenced by path:

Expand Down
6 changes: 3 additions & 3 deletions binding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<dependencies>
<dependency>
<groupId>com.mobilitydb</groupId>
<artifactId>jmeos</artifactId>
<groupId>org.jmeos</groupId>
<artifactId>meos</artifactId>
<version>${jmeos.version}</version>
</dependency>
<dependency>
Expand Down Expand Up @@ -87,7 +87,7 @@
<argument>--catalog</argument>
<argument>${project.basedir}/../tools/meos-idl.json</argument>
<argument>--jar</argument>
<argument>${settings.localRepository}/com/mobilitydb/jmeos/${jmeos.version}/jmeos-${jmeos.version}.jar</argument>
<argument>${settings.localRepository}/org/jmeos/meos/${jmeos.version}/meos-${jmeos.version}.jar</argument>
<argument>--out</argument>
<argument>${project.build.directory}/generated-facades</argument>
</arguments>
Expand Down
Loading
Loading