From 0c9769051a00d330af3ccb9dbb589269b2d34d9a Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Fri, 13 Nov 2026 21:28:48 +0100 Subject: [PATCH 1/7] build: depend on RumbleDB through the local Maven repository instead of a system-scoped jar fetch-rumble.sh now builds Rumble's thin jar and installs it with its own pom, so Rumble's runtime dependencies resolve transitively and the prod profile no longer unzips the fat jar. The version comes from the pinned commit via .mvn/maven.config. Spark stays declared because it is provided-scoped in Rumble. --- .../src/integrations/rumble/executable/dev.ts | 20 +++------- packages/rumble-lsp-wrapper/.gitignore | 1 + packages/rumble-lsp-wrapper/pom.xml | 33 ++-------------- packages/rumble-lsp-wrapper/scripts/build.mjs | 9 ++++- .../scripts/fetch-rumble.sh | 39 +++++++++++++------ 5 files changed, 43 insertions(+), 59 deletions(-) diff --git a/packages/language-server/src/integrations/rumble/executable/dev.ts b/packages/language-server/src/integrations/rumble/executable/dev.ts index d4d977c5..04235056 100644 --- a/packages/language-server/src/integrations/rumble/executable/dev.ts +++ b/packages/language-server/src/integrations/rumble/executable/dev.ts @@ -9,11 +9,6 @@ import { WrapperLaunchConfig } from "./index.js"; const PACKAGE_ROOT = findPackageRoot(); const WRAPPER_DEVELOPMENT_FOLDER = path.join(PACKAGE_ROOT, "../rumble-lsp-wrapper"); const WRAPPER_JAR_DEVELOPMENT_FOLDER = path.join(WRAPPER_DEVELOPMENT_FOLDER, "target"); -const RUMBLE_JAR_DEVELOPMENT_PATH = path.join( - WRAPPER_DEVELOPMENT_FOLDER, - "generated-resources", - "rumbledb-current-jar-with-dependencies.jar", -); const WRAPPER_PACKAGE_JSON_PATH = path.join(WRAPPER_DEVELOPMENT_FOLDER, "package.json"); const WRAPPER_RUNTIME_CLASSPATH_FILE = "runtime-classpath.txt"; @@ -22,20 +17,15 @@ const WRAPPER_MAIN_CLASS = "org.jsoniq.lsp.wrapper.Main"; export function resolveDevLaunchConfig(): WrapperLaunchConfig | undefined { const localJarPath = resolveWrapperJarPath(); const classpathPath = path.join(WRAPPER_JAR_DEVELOPMENT_FOLDER, WRAPPER_RUNTIME_CLASSPATH_FILE); - if ( - localJarPath === undefined || - !fs.existsSync(classpathPath) || - !fs.existsSync(RUMBLE_JAR_DEVELOPMENT_PATH) - ) { + if (localJarPath === undefined || !fs.existsSync(classpathPath)) { return undefined; } const runtimeClasspath = fs.readFileSync(classpathPath, "utf8").trim(); - const classpathEntries = [ - localJarPath, - RUMBLE_JAR_DEVELOPMENT_PATH, - ...runtimeClasspath.split(path.delimiter), - ].filter((entry): entry is string => entry !== undefined && entry.length > 0); + // The runtime classpath includes RumbleDB and its dependencies from the local Maven repository. + const classpathEntries = [localJarPath, ...runtimeClasspath.split(path.delimiter)].filter( + (entry): entry is string => entry !== undefined && entry.length > 0, + ); const classpath = [...new Set(classpathEntries)].join(path.delimiter); return { diff --git a/packages/rumble-lsp-wrapper/.gitignore b/packages/rumble-lsp-wrapper/.gitignore index bce9c2dc..10003002 100644 --- a/packages/rumble-lsp-wrapper/.gitignore +++ b/packages/rumble-lsp-wrapper/.gitignore @@ -1,3 +1,4 @@ target/ /rumbledb generated-resources/ +.mvn/maven.config diff --git a/packages/rumble-lsp-wrapper/pom.xml b/packages/rumble-lsp-wrapper/pom.xml index 1339379f..95ec6852 100644 --- a/packages/rumble-lsp-wrapper/pom.xml +++ b/packages/rumble-lsp-wrapper/pom.xml @@ -21,17 +21,16 @@ 17 17 UTF-8 - ${project.basedir}/generated-resources/rumbledb-current-jar-with-dependencies.jar com.github.rumbledb rumbledb - local - system - ${rumble.local.jar} + + ${rumble.version} + org.apache.spark spark-sql_2.13 @@ -176,32 +175,6 @@ prod - - org.apache.maven.plugins - maven-antrun-plugin - 3.2.0 - - - unpack-rumble-classes - - run - - process-classes - - - - - - - - - - - - - - - org.apache.maven.plugins maven-shade-plugin diff --git a/packages/rumble-lsp-wrapper/scripts/build.mjs b/packages/rumble-lsp-wrapper/scripts/build.mjs index 7cc7a022..c4ad09d8 100644 --- a/packages/rumble-lsp-wrapper/scripts/build.mjs +++ b/packages/rumble-lsp-wrapper/scripts/build.mjs @@ -50,9 +50,14 @@ function computeBuildKey() { addDirectoryToHash(hash, path.join(packageDir, "src", "main")); addFileToHash(hash, path.join(packageDir, "generated-resources", "rumble-build.properties")); - const rumbleJar = fs.realpathSync( - path.join(packageDir, "generated-resources", "rumbledb-current-jar-with-dependencies.jar"), + const rumbleBuildProperties = fs.readFileSync( + path.join(packageDir, "generated-resources", "rumble-build.properties"), + "utf8", ); + const rumbleJar = /^rumble\.jar=(.*)$/m.exec(rumbleBuildProperties)?.[1]; + if (!rumbleJar) { + throw new Error("rumble-build.properties does not name the Rumble jar"); + } const rumbleJarStat = fs.statSync(rumbleJar); hash.update(`rumbleJar=${rumbleJar}\0${rumbleJarStat.size}\0${rumbleJarStat.mtimeMs}\0`); return hash.digest("hex"); diff --git a/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh b/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh index 438a8054..047e46dc 100755 --- a/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh +++ b/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh @@ -12,13 +12,14 @@ WRAPPER_CLASSES_DIR="$WRAPPER_TARGET_DIR/classes" WRAPPER_METADATA_FILE="$WRAPPER_GENERATED_RESOURCES_DIR/rumble-build.properties" WRAPPER_COMPILED_METADATA_FILE="$WRAPPER_CLASSES_DIR/rumble-build.properties" -WRAPPER_RUMBLE_JAR_LINK="$WRAPPER_GENERATED_RESOURCES_DIR/rumbledb-current-jar-with-dependencies.jar" WRAPPER_BUILD_STAMP="$WRAPPER_GENERATED_RESOURCES_DIR/rumble-build.stamp" RUMBLE_REPO_URL="https://github.com/RumbleDB/rumble.git" RUMBLE_REQUESTED_COMMIT="939a4769f2e20fb54a7c576a9fa11c08df2ea8e6" RUMBLE_TARGET_DIR="$RUMBLE_DIR/target" RUMBLE_BUILD_CACHE_DIR="$WRAPPER_DIR/.cache/rumble/$RUMBLE_REQUESTED_COMMIT" +# Maven reads this on every run, so the wrapper depends on whatever version the pinned commit declares. +WRAPPER_MAVEN_CONFIG="$WRAPPER_DIR/.mvn/maven.config" ensure_rumble_checkout() { if [ ! -d "$RUMBLE_DIR" ]; then @@ -51,7 +52,16 @@ ensure_rumble_checkout() { git -C "$RUMBLE_DIR" fetch --depth 1 origin "$RUMBLE_REQUESTED_COMMIT" git -C "$RUMBLE_DIR" -c advice.detachedHead=false checkout --detach FETCH_HEAD >/dev/null # A jar from before the move is stale, even if no build stamp says so. - rm -f "$RUMBLE_TARGET_DIR"/rumbledb-*-jar-with-dependencies.jar + remove_rumble_jars +} + +# Rumble's thin jar, without the -tests, -sources, -javadoc or -jar-with-dependencies variants. +list_rumble_jars() { + ls -1t "$1"/rumbledb-*.jar 2>/dev/null | grep -E '/rumbledb-[0-9][^/]*\.jar$' | grep -vE -- '-(tests|sources|javadoc|jar-with-dependencies)\.jar$' || true +} + +remove_rumble_jars() { + list_rumble_jars "$RUMBLE_TARGET_DIR" | while IFS= read -r jar; do rm -f "$jar"; done } detect_rumble_ref() { @@ -99,9 +109,9 @@ stamp_commit_matches_checkout() { } resolve_rumble_jar() { - jar_path=$(ls -1t "$RUMBLE_TARGET_DIR"/rumbledb-*-jar-with-dependencies.jar 2>/dev/null | head -n 1 || true) + jar_path=$(list_rumble_jars "$RUMBLE_TARGET_DIR" | head -n 1) if [ -z "$jar_path" ]; then - jar_path=$(ls -1t "$RUMBLE_BUILD_CACHE_DIR"/rumbledb-*-jar-with-dependencies.jar 2>/dev/null | head -n 1 || true) + jar_path=$(list_rumble_jars "$RUMBLE_BUILD_CACHE_DIR" | head -n 1) fi if [ -z "$jar_path" ]; then return 1 @@ -125,14 +135,18 @@ cache_rumble_jar() { extract_rumble_version_from_jar() { jar_file=$(basename "$1") version=${jar_file#rumbledb-} - version=${version%-jar-with-dependencies.jar} + version=${version%.jar} printf '%s\n' "$version" } -update_rumble_jar_link() { - mkdir -p "$WRAPPER_GENERATED_RESOURCES_DIR" - ln -sf "$RUMBLE_JAR" "$WRAPPER_RUMBLE_JAR_LINK" - echo "Linked Rumble jar to $WRAPPER_RUMBLE_JAR_LINK" >&2 +# Installs the jar with Rumble's own pom, so that Maven resolves its dependencies transitively. +# This runs on every build: ~/.m2 may hold a 3.1.0 installed from another commit (for example from the CI cache). +install_rumble_jar() { + rumble_version=$(extract_rumble_version_from_jar "$RUMBLE_JAR") + (cd "$RUMBLE_DIR" && mvn -q install:install-file -Dfile="$RUMBLE_JAR" -DpomFile=pom.xml) + mkdir -p "$(dirname "$WRAPPER_MAVEN_CONFIG")" + printf -- '-Drumble.version=%s\n' "$rumble_version" >"$WRAPPER_MAVEN_CONFIG" + echo "Installed Rumble $rumble_version into the local Maven repository" >&2 } ensure_rumble_checkout @@ -142,7 +156,7 @@ RUMBLE_COMMIT_SHORT=$(git -C "$RUMBLE_DIR" rev-parse --short HEAD) RUMBLE_CURRENT_REF=$(detect_rumble_ref) # The jar was built from another commit, so it must not be used for this one. if [ -f "$WRAPPER_BUILD_STAMP" ] && ! stamp_commit_matches_checkout; then - rm -f "$RUMBLE_TARGET_DIR"/rumbledb-*-jar-with-dependencies.jar + remove_rumble_jars fi RUMBLE_JAR=$(resolve_rumble_jar 2>/dev/null || true) if [ -n "$RUMBLE_JAR" ]; then @@ -157,7 +171,8 @@ fi if [ -z "$RUMBLE_JAR" ]; then echo "Building Rumble from source..." >&2 - (cd "$RUMBLE_DIR" && mvn -q -DskipTests clean compile assembly:single) + # maven.test.skip also skips the -tests jar; javadoc and sources jars are not needed either. + (cd "$RUMBLE_DIR" && mvn -q -Dmaven.test.skip -Dmaven.javadoc.skip -Dmaven.source.skip clean package) RUMBLE_JAR=$(resolve_rumble_jar) cache_rumble_jar CURRENT_BUILD_SIGNATURE=$(build_signature) @@ -165,7 +180,7 @@ elif [ ! -f "$WRAPPER_BUILD_STAMP" ]; then echo "Adopting existing Rumble jar for commit $RUMBLE_COMMIT_SHORT..." >&2 fi -update_rumble_jar_link +install_rumble_jar write_metadata_file "$WRAPPER_METADATA_FILE" if [ -d "$WRAPPER_CLASSES_DIR" ]; then write_metadata_file "$WRAPPER_COMPILED_METADATA_FILE" From efa4cbfadd9ff6c9aefc68c2c45f368e746b1724 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Fri, 13 Nov 2026 21:33:14 +0100 Subject: [PATCH 2/7] ci: rename the RumbleDB jar cache step now that the jar is no longer assembled --- .github/workflows/ci.yml | 2 +- .github/workflows/release-dev.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78fc2379..55303b8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: java-version: "17" cache: maven - - name: Cache assembled RumbleDB JAR + - name: Cache built RumbleDB JAR uses: actions/cache@v5 with: path: packages/rumble-lsp-wrapper/.cache/rumble diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index fe7201c2..c97b4b75 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -34,7 +34,7 @@ jobs: java-version: "17" cache: maven - - name: Cache assembled RumbleDB JAR + - name: Cache built RumbleDB JAR uses: actions/cache@v5 with: path: packages/rumble-lsp-wrapper/.cache/rumble diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3cd776be..42a25ea3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: java-version: "17" cache: maven - - name: Cache assembled RumbleDB JAR + - name: Cache built RumbleDB JAR uses: actions/cache@v5 with: path: packages/rumble-lsp-wrapper/.cache/rumble From 3a1860e7c787739995c912363e0ee97c07392b14 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Mon, 16 Nov 2026 14:09:38 +0100 Subject: [PATCH 3/7] build: install each RumbleDB build under a version named after its contents The local Maven repository is shared by every checkout, so a plain 3.1.0 was overwritten by whichever checkout or Rumble build installed last. The version now comes from a hash of the jar and pom, the install is skipped when that version is already present, and the dev build cache key follows it. rumble.version gets a placeholder default so goals such as clean work before fetch-rumble.sh has run. --- .../src/integrations/rumble/executable/dev.ts | 2 +- packages/rumble-lsp-wrapper/pom.xml | 4 +- packages/rumble-lsp-wrapper/scripts/build.mjs | 13 +---- .../scripts/fetch-rumble.sh | 52 ++++++++++++++++--- 4 files changed, 51 insertions(+), 20 deletions(-) diff --git a/packages/language-server/src/integrations/rumble/executable/dev.ts b/packages/language-server/src/integrations/rumble/executable/dev.ts index 04235056..0dba77b5 100644 --- a/packages/language-server/src/integrations/rumble/executable/dev.ts +++ b/packages/language-server/src/integrations/rumble/executable/dev.ts @@ -24,7 +24,7 @@ export function resolveDevLaunchConfig(): WrapperLaunchConfig | undefined { const runtimeClasspath = fs.readFileSync(classpathPath, "utf8").trim(); // The runtime classpath includes RumbleDB and its dependencies from the local Maven repository. const classpathEntries = [localJarPath, ...runtimeClasspath.split(path.delimiter)].filter( - (entry): entry is string => entry !== undefined && entry.length > 0, + (entry) => entry.length > 0, ); const classpath = [...new Set(classpathEntries)].join(path.delimiter); diff --git a/packages/rumble-lsp-wrapper/pom.xml b/packages/rumble-lsp-wrapper/pom.xml index 95ec6852..4cb59db9 100644 --- a/packages/rumble-lsp-wrapper/pom.xml +++ b/packages/rumble-lsp-wrapper/pom.xml @@ -21,13 +21,15 @@ 17 17 UTF-8 + + 0-run-scripts-fetch-rumble.sh com.github.rumbledb rumbledb - + ${rumble.version} diff --git a/packages/rumble-lsp-wrapper/scripts/build.mjs b/packages/rumble-lsp-wrapper/scripts/build.mjs index c4ad09d8..975a47e0 100644 --- a/packages/rumble-lsp-wrapper/scripts/build.mjs +++ b/packages/rumble-lsp-wrapper/scripts/build.mjs @@ -49,17 +49,8 @@ function computeBuildKey() { addFileToHash(hash, path.join(packageDir, "pom.xml")); addDirectoryToHash(hash, path.join(packageDir, "src", "main")); addFileToHash(hash, path.join(packageDir, "generated-resources", "rumble-build.properties")); - - const rumbleBuildProperties = fs.readFileSync( - path.join(packageDir, "generated-resources", "rumble-build.properties"), - "utf8", - ); - const rumbleJar = /^rumble\.jar=(.*)$/m.exec(rumbleBuildProperties)?.[1]; - if (!rumbleJar) { - throw new Error("rumble-build.properties does not name the Rumble jar"); - } - const rumbleJarStat = fs.statSync(rumbleJar); - hash.update(`rumbleJar=${rumbleJar}\0${rumbleJarStat.size}\0${rumbleJarStat.mtimeMs}\0`); + // The Rumble version in here is named after the jar's contents, so it changes whenever Rumble does. + addFileToHash(hash, path.join(packageDir, ".mvn", "maven.config")); return hash.digest("hex"); } diff --git a/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh b/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh index 047e46dc..9cac96c3 100755 --- a/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh +++ b/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh @@ -18,7 +18,7 @@ RUMBLE_REPO_URL="https://github.com/RumbleDB/rumble.git" RUMBLE_REQUESTED_COMMIT="939a4769f2e20fb54a7c576a9fa11c08df2ea8e6" RUMBLE_TARGET_DIR="$RUMBLE_DIR/target" RUMBLE_BUILD_CACHE_DIR="$WRAPPER_DIR/.cache/rumble/$RUMBLE_REQUESTED_COMMIT" -# Maven reads this on every run, so the wrapper depends on whatever version the pinned commit declares. +# Maven reads this on every run, so the wrapper depends on the Rumble build that this script installed. WRAPPER_MAVEN_CONFIG="$WRAPPER_DIR/.mvn/maven.config" ensure_rumble_checkout() { @@ -139,14 +139,52 @@ extract_rumble_version_from_jar() { printf '%s\n' "$version" } +# The local Maven repository is shared by every checkout, worktree and Rumble build on this machine, +# so a plain 3.1.0 would be overwritten by whichever of them installed last. +# Naming the version after the jar and pom contents means that a version is only ever installed with +# the same contents, and that a different build always gets a different version. +compute_rumble_maven_version() { + contents_hash=$( + { + git hash-object "$RUMBLE_JAR" + git hash-object "$RUMBLE_DIR/pom.xml" + } | git hash-object --stdin | cut -c 1-12 + ) + printf '%s-local-%s\n' "$(extract_rumble_version_from_jar "$RUMBLE_JAR")" "$contents_hash" +} + +# Rumble's pom with the project version replaced. Rumble's pom has no parent, so the first is the project's. +write_rumble_maven_pom() { + awk -v version="$1" ' + !done && /[^<]*<\/version>/ { sub(/[^<]*<\/version>/, "" version ""); done = 1 } + { print } + ' "$RUMBLE_DIR/pom.xml" >"$2" + if ! grep -q "$1" "$2"; then + echo "Could not set the version in a copy of $RUMBLE_DIR/pom.xml" >&2 + exit 1 + fi +} + # Installs the jar with Rumble's own pom, so that Maven resolves its dependencies transitively. -# This runs on every build: ~/.m2 may hold a 3.1.0 installed from another commit (for example from the CI cache). install_rumble_jar() { - rumble_version=$(extract_rumble_version_from_jar "$RUMBLE_JAR") - (cd "$RUMBLE_DIR" && mvn -q install:install-file -Dfile="$RUMBLE_JAR" -DpomFile=pom.xml) - mkdir -p "$(dirname "$WRAPPER_MAVEN_CONFIG")" - printf -- '-Drumble.version=%s\n' "$rumble_version" >"$WRAPPER_MAVEN_CONFIG" - echo "Installed Rumble $rumble_version into the local Maven repository" >&2 + rumble_maven_version=$(compute_rumble_maven_version) + installed_dir="$HOME/.m2/repository/com/github/rumbledb/rumbledb/$rumble_maven_version" + # Skipping saves starting Maven. With a localRepository set in settings.xml, the jar is just reinstalled every time. + if [ -f "$installed_dir/rumbledb-$rumble_maven_version.jar" ] && [ -f "$installed_dir/rumbledb-$rumble_maven_version.pom" ]; then + echo "Rumble $rumble_maven_version is already in the local Maven repository" >&2 + else + rumble_maven_pom="$WRAPPER_GENERATED_RESOURCES_DIR/rumbledb.pom" + mkdir -p "$WRAPPER_GENERATED_RESOURCES_DIR" + write_rumble_maven_pom "$rumble_maven_version" "$rumble_maven_pom" + (cd "$RUMBLE_DIR" && mvn -q install:install-file -Dfile="$RUMBLE_JAR" -DpomFile="$rumble_maven_pom") + echo "Installed Rumble $rumble_maven_version into the local Maven repository" >&2 + fi + + maven_config_line="-Drumble.version=$rumble_maven_version" + if [ "$(cat "$WRAPPER_MAVEN_CONFIG" 2>/dev/null || true)" != "$maven_config_line" ]; then + mkdir -p "$(dirname "$WRAPPER_MAVEN_CONFIG")" + printf '%s\n' "$maven_config_line" >"$WRAPPER_MAVEN_CONFIG" + fi } ensure_rumble_checkout From 7d67f5e836d5e9b9e6731bee167ff21ae6d2fc35 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Mon, 16 Nov 2026 14:12:48 +0100 Subject: [PATCH 4/7] refactor: simplify the RumbleDB fetch script and dev classpath Write the build metadata once, after the jar is known, and cache the jar and the build signature in one place. Drop checks that can no longer fail: the change check on maven.config, the extra mkdir, the empty jar case in the metadata, and the classpath dedupe in dev.ts. --- .../src/integrations/rumble/executable/dev.ts | 7 ++--- .../scripts/fetch-rumble.sh | 31 +++++-------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/packages/language-server/src/integrations/rumble/executable/dev.ts b/packages/language-server/src/integrations/rumble/executable/dev.ts index 0dba77b5..c77118e8 100644 --- a/packages/language-server/src/integrations/rumble/executable/dev.ts +++ b/packages/language-server/src/integrations/rumble/executable/dev.ts @@ -23,10 +23,9 @@ export function resolveDevLaunchConfig(): WrapperLaunchConfig | undefined { const runtimeClasspath = fs.readFileSync(classpathPath, "utf8").trim(); // The runtime classpath includes RumbleDB and its dependencies from the local Maven repository. - const classpathEntries = [localJarPath, ...runtimeClasspath.split(path.delimiter)].filter( - (entry) => entry.length > 0, - ); - const classpath = [...new Set(classpathEntries)].join(path.delimiter); + const classpath = [localJarPath, ...runtimeClasspath.split(path.delimiter)] + .filter((entry) => entry.length > 0) + .join(path.delimiter); return { args: ["-cp", classpath, WRAPPER_MAIN_CLASS, "--daemon"], diff --git a/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh b/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh index 9cac96c3..7e4b71bf 100755 --- a/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh +++ b/packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh @@ -76,10 +76,7 @@ detect_rumble_ref() { write_metadata_file() { metadata_file=$1 - rumble_version="" - if [ -n "$RUMBLE_JAR" ]; then - rumble_version=$(extract_rumble_version_from_jar "$RUMBLE_JAR") - fi + rumble_version=$(extract_rumble_version_from_jar "$RUMBLE_JAR") mkdir -p "$(dirname "$metadata_file")" cat >"$metadata_file" <&2 else + # write_metadata_file has created the generated resources folder. rumble_maven_pom="$WRAPPER_GENERATED_RESOURCES_DIR/rumbledb.pom" - mkdir -p "$WRAPPER_GENERATED_RESOURCES_DIR" write_rumble_maven_pom "$rumble_maven_version" "$rumble_maven_pom" (cd "$RUMBLE_DIR" && mvn -q install:install-file -Dfile="$RUMBLE_JAR" -DpomFile="$rumble_maven_pom") echo "Installed Rumble $rumble_maven_version into the local Maven repository" >&2 fi - maven_config_line="-Drumble.version=$rumble_maven_version" - if [ "$(cat "$WRAPPER_MAVEN_CONFIG" 2>/dev/null || true)" != "$maven_config_line" ]; then - mkdir -p "$(dirname "$WRAPPER_MAVEN_CONFIG")" - printf '%s\n' "$maven_config_line" >"$WRAPPER_MAVEN_CONFIG" - fi + mkdir -p "$(dirname "$WRAPPER_MAVEN_CONFIG")" + printf -- '-Drumble.version=%s\n' "$rumble_maven_version" >"$WRAPPER_MAVEN_CONFIG" } ensure_rumble_checkout @@ -197,32 +191,21 @@ if [ -f "$WRAPPER_BUILD_STAMP" ] && ! stamp_commit_matches_checkout; then remove_rumble_jars fi RUMBLE_JAR=$(resolve_rumble_jar 2>/dev/null || true) -if [ -n "$RUMBLE_JAR" ]; then - cache_rumble_jar -fi -CURRENT_BUILD_SIGNATURE=$(build_signature) - -write_metadata_file "$WRAPPER_METADATA_FILE" -if [ -d "$WRAPPER_CLASSES_DIR" ]; then - write_metadata_file "$WRAPPER_COMPILED_METADATA_FILE" -fi - if [ -z "$RUMBLE_JAR" ]; then echo "Building Rumble from source..." >&2 # maven.test.skip also skips the -tests jar; javadoc and sources jars are not needed either. (cd "$RUMBLE_DIR" && mvn -q -Dmaven.test.skip -Dmaven.javadoc.skip -Dmaven.source.skip clean package) RUMBLE_JAR=$(resolve_rumble_jar) - cache_rumble_jar - CURRENT_BUILD_SIGNATURE=$(build_signature) elif [ ! -f "$WRAPPER_BUILD_STAMP" ]; then echo "Adopting existing Rumble jar for commit $RUMBLE_COMMIT_SHORT..." >&2 fi +cache_rumble_jar -install_rumble_jar write_metadata_file "$WRAPPER_METADATA_FILE" if [ -d "$WRAPPER_CLASSES_DIR" ]; then write_metadata_file "$WRAPPER_COMPILED_METADATA_FILE" fi -printf '%s' "$CURRENT_BUILD_SIGNATURE" >"$WRAPPER_BUILD_STAMP" +install_rumble_jar +build_signature >"$WRAPPER_BUILD_STAMP" echo "Prepared Rumble $(extract_rumble_version_from_jar "$RUMBLE_JAR") at commit $RUMBLE_COMMIT_SHORT ($RUMBLE_CURRENT_REF)." >&2 From 28a0ba14e49f9f3cfebcde10b3e24ecf7466691c Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Mon, 16 Nov 2026 14:22:35 +0100 Subject: [PATCH 5/7] ci: run the wrapper tests against the shaded release jar Test CI only builds the wrapper for development, so changes to the shaded release jar were first exercised at release time. The prod profile now skips surefire and runs the same tests with failsafe against the shaded jar, with only the test dependencies besides it on the classpath. A new workflow runs the prod build on changes to the wrapper. --- .github/workflows/wrapper-prod.yml | 55 +++++++++++++++++ packages/rumble-lsp-wrapper/pom.xml | 60 ++++++++++++++----- packages/rumble-lsp-wrapper/scripts/build.mjs | 3 +- 3 files changed, 103 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/wrapper-prod.yml diff --git a/.github/workflows/wrapper-prod.yml b/.github/workflows/wrapper-prod.yml new file mode 100644 index 00000000..fd71c0dd --- /dev/null +++ b/.github/workflows/wrapper-prod.yml @@ -0,0 +1,55 @@ +name: Wrapper release jar + +# Test CI only builds the wrapper for development, against Maven's classpath. +# This builds the shaded release jar and runs the tests against it, so packaging problems show up before a release. +on: + push: + branches: + - main + paths: + - "packages/rumble-lsp-wrapper/**" + - ".github/workflows/wrapper-prod.yml" + pull_request: + paths: + - "packages/rumble-lsp-wrapper/**" + - ".github/workflows/wrapper-prod.yml" + +env: + HUSKY: 0 + +jobs: + release-jar: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v6 + + - name: Set up pnpm + uses: pnpm/action-setup@v6 + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: 26 + cache: pnpm + + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: "17" + cache: maven + + - name: Cache built RumbleDB JAR + uses: actions/cache@v5 + with: + path: packages/rumble-lsp-wrapper/.cache/rumble + key: rumbledb-${{ runner.os }}-java17-${{ hashFiles('packages/rumble-lsp-wrapper/scripts/fetch-rumble.sh') }} + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + # The prod profile runs the wrapper's tests against the shaded jar. + - name: Build and test release jar + run: pnpm --filter rumble-lsp-wrapper run build:prod diff --git a/packages/rumble-lsp-wrapper/pom.xml b/packages/rumble-lsp-wrapper/pom.xml index 4cb59db9..c273a7f8 100644 --- a/packages/rumble-lsp-wrapper/pom.xml +++ b/packages/rumble-lsp-wrapper/pom.xml @@ -21,6 +21,21 @@ 17 17 UTF-8 + + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.invoke=ALL-UNNAMED + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED + --add-opens=java.base/java.io=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED + --add-opens=java.base/java.nio=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/java.util.concurrent=ALL-UNNAMED + --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + --add-opens=java.base/sun.nio.cs=ALL-UNNAMED + --add-opens=java.base/sun.security.action=ALL-UNNAMED + --add-opens=java.base/sun.util.calendar=ALL-UNNAMED + --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED 0-run-scripts-fetch-rumble.sh @@ -118,20 +133,7 @@ maven-surefire-plugin 3.6.0 - --add-opens=java.base/java.lang=ALL-UNNAMED - --add-opens=java.base/java.lang.invoke=ALL-UNNAMED - --add-opens=java.base/java.lang.reflect=ALL-UNNAMED - --add-opens=java.base/java.io=ALL-UNNAMED - --add-opens=java.base/java.net=ALL-UNNAMED - --add-opens=java.base/java.nio=ALL-UNNAMED - --add-opens=java.base/java.util=ALL-UNNAMED - --add-opens=java.base/java.util.concurrent=ALL-UNNAMED - --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED - --add-opens=java.base/sun.nio.ch=ALL-UNNAMED - --add-opens=java.base/sun.nio.cs=ALL-UNNAMED - --add-opens=java.base/sun.security.action=ALL-UNNAMED - --add-opens=java.base/sun.util.calendar=ALL-UNNAMED - --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED + ${spark.jvm.args} @@ -177,6 +179,36 @@ prod + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.6.0 + + ${spark.jvm.args} + ${project.build.directory}/${project.build.finalName}-all.jar + + compile+runtime + + **/*Test.java + + + + + + integration-test + verify + + + + org.apache.maven.plugins maven-shade-plugin diff --git a/packages/rumble-lsp-wrapper/scripts/build.mjs b/packages/rumble-lsp-wrapper/scripts/build.mjs index 975a47e0..8e0bfebf 100644 --- a/packages/rumble-lsp-wrapper/scripts/build.mjs +++ b/packages/rumble-lsp-wrapper/scripts/build.mjs @@ -87,7 +87,8 @@ if (isProdBuild) { } else { mvnArgs.push("-DskipTests"); } -mvnArgs.push("package", `-Drevision=${packageJson.version}`); +// The prod profile runs the tests against the shaded jar, after the package phase. +mvnArgs.push(isProdBuild ? "verify" : "package", `-Drevision=${packageJson.version}`); execFileSync("mvn", mvnArgs, { cwd: packageDir, From eeebcf3a771dc9dfaeb0d953a1c56f5161baa73a Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Mon, 16 Nov 2026 14:26:10 +0100 Subject: [PATCH 6/7] ci: run the language server tests against the wrapper release jar JSONIQ_LSP_WRAPPER_JAR makes the language server start the given jar with -jar, as a release does, instead of the development build or the released jar. The release jar workflow uses it to run the server tests against the shaded jar it just built, and now also runs when the server's wrapper integration changes. --- .github/workflows/wrapper-prod.yml | 17 +++++++++- .../integrations/rumble/executable/index.ts | 31 ++++++++++++++----- .../integrations/rumble/executable/prod.ts | 7 ++--- .../integrations/rumble/executable/utils.ts | 24 ++++++++++++++ .../tests/wrapper/executable-utils.test.ts | 23 ++++++++++++++ 5 files changed, 88 insertions(+), 14 deletions(-) diff --git a/.github/workflows/wrapper-prod.yml b/.github/workflows/wrapper-prod.yml index fd71c0dd..edf263cc 100644 --- a/.github/workflows/wrapper-prod.yml +++ b/.github/workflows/wrapper-prod.yml @@ -1,17 +1,20 @@ name: Wrapper release jar # Test CI only builds the wrapper for development, against Maven's classpath. -# This builds the shaded release jar and runs the tests against it, so packaging problems show up before a release. +# This builds the shaded release jar and runs the wrapper and language server tests against it, +# so packaging problems show up before a release. on: push: branches: - main paths: - "packages/rumble-lsp-wrapper/**" + - "packages/language-server/src/integrations/rumble/**" - ".github/workflows/wrapper-prod.yml" pull_request: paths: - "packages/rumble-lsp-wrapper/**" + - "packages/language-server/src/integrations/rumble/**" - ".github/workflows/wrapper-prod.yml" env: @@ -53,3 +56,15 @@ jobs: # The prod profile runs the wrapper's tests against the shaded jar. - name: Build and test release jar run: pnpm --filter rumble-lsp-wrapper run build:prod + + - name: Generate grammar + run: pnpm run generate:grammar + + - name: Build language server assets + run: pnpm --filter jsoniq-language-server run build:assets + + # The language server starts the release jar with -jar, as it does for users. + - name: Test language server with release jar + run: | + export JSONIQ_LSP_WRAPPER_JAR="$(ls "$PWD"/packages/rumble-lsp-wrapper/target/rumble-lsp-wrapper-*-all.jar)" + pnpm run test:server diff --git a/packages/language-server/src/integrations/rumble/executable/index.ts b/packages/language-server/src/integrations/rumble/executable/index.ts index 48ca1f20..bf405e60 100644 --- a/packages/language-server/src/integrations/rumble/executable/index.ts +++ b/packages/language-server/src/integrations/rumble/executable/index.ts @@ -5,7 +5,7 @@ import { createLogger } from "server/utils/logger.js"; import { resolveDevLaunchConfig } from "./dev.js"; import { DownloadProgressReporter } from "./download.js"; import { resolveProdLaunchConfig } from "./prod.js"; -import { SPARK_JVM_ARGS, sparkConfToJvmArgs } from "./utils.js"; +import { resolveWrapperJarOverride, SPARK_JVM_ARGS, sparkConfToJvmArgs } from "./utils.js"; const logger = createLogger("wrapper:jar-resolution"); @@ -20,13 +20,7 @@ export interface WrapperResolutionOptions { export async function resolveWrapperLaunchConfig( options: WrapperResolutionOptions = {}, ): Promise { - const devConfig = resolveDevLaunchConfig(); - const config = devConfig ?? (await resolveProdLaunchConfig(options)); - if (devConfig === undefined) { - logger.debug( - "No development wrapper configuration found, falling back to production configuration.", - ); - } + const config = await resolveLaunchConfig(options); const sparkConfArgs = sparkConfToJvmArgs(buildSparkConf(serverConfig.wrapper), (key) => logger.warn( @@ -38,3 +32,24 @@ export async function resolveWrapperLaunchConfig( args: [...SPARK_JVM_ARGS, ...sparkConfArgs, ...config.args], }; } + +async function resolveLaunchConfig( + options: WrapperResolutionOptions, +): Promise { + const overrideConfig = resolveWrapperJarOverride(); + if (overrideConfig !== undefined) { + logger.info( + `Using the wrapper jar from JSONIQ_LSP_WRAPPER_JAR: ${process.env.JSONIQ_LSP_WRAPPER_JAR}`, + ); + return overrideConfig; + } + + const devConfig = resolveDevLaunchConfig(); + if (devConfig !== undefined) { + return devConfig; + } + logger.debug( + "No development wrapper configuration found, falling back to production configuration.", + ); + return resolveProdLaunchConfig(options); +} diff --git a/packages/language-server/src/integrations/rumble/executable/prod.ts b/packages/language-server/src/integrations/rumble/executable/prod.ts index c7e750ad..04ef663e 100644 --- a/packages/language-server/src/integrations/rumble/executable/prod.ts +++ b/packages/language-server/src/integrations/rumble/executable/prod.ts @@ -6,7 +6,7 @@ import { createLogger } from "server/utils/logger.js"; import { createTerminalProgressReporter, downloadWithProgress } from "./download.js"; import { type WrapperLaunchConfig, type WrapperResolutionOptions } from "./index.js"; -import { computeFileSha256, getWrapperCacheDirectory } from "./utils.js"; +import { computeFileSha256, getWrapperCacheDirectory, jarLaunchConfig } from "./utils.js"; /// Production environment: use package assets instead of compiled output. const PACKAGE_ROOT = findPackageRoot(); @@ -108,8 +108,5 @@ export async function resolveProductionJarPath( export async function resolveProdLaunchConfig( options: WrapperResolutionOptions = {}, ): Promise { - const cachedJarPath = await resolveProductionJarPath(options); - return { - args: ["-jar", cachedJarPath, "--daemon"], - }; + return jarLaunchConfig(await resolveProductionJarPath(options)); } diff --git a/packages/language-server/src/integrations/rumble/executable/utils.ts b/packages/language-server/src/integrations/rumble/executable/utils.ts index 54e9bf53..a1b513c7 100644 --- a/packages/language-server/src/integrations/rumble/executable/utils.ts +++ b/packages/language-server/src/integrations/rumble/executable/utils.ts @@ -3,6 +3,8 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; +import { type WrapperLaunchConfig } from "./index.js"; + const LANGUAGE_SERVER_CACHE_DIRNAME = "jsoniq-language-server"; const WRAPPER_CACHE_SUBDIRECTORY = "wrapper"; @@ -36,6 +38,28 @@ export function getBaseCacheDirectory( return path.join(os.homedir(), ".cache"); } +/** Runs a shaded wrapper jar the way a release does. */ +export function jarLaunchConfig(jarPath: string): WrapperLaunchConfig { + return { args: ["-jar", jarPath, "--daemon"] }; +} + +/** + * JSONIQ_LSP_WRAPPER_JAR runs the given wrapper jar instead of the development build or the + * released jar, for example to test a locally built release jar. + */ +export function resolveWrapperJarOverride( + env: NodeJS.ProcessEnv = process.env, +): WrapperLaunchConfig | undefined { + const jarPath = env.JSONIQ_LSP_WRAPPER_JAR; + if (jarPath === undefined || jarPath.length === 0) { + return undefined; + } + if (!fs.existsSync(jarPath)) { + throw new Error(`JSONIQ_LSP_WRAPPER_JAR is set to '${jarPath}', which does not exist.`); + } + return jarLaunchConfig(path.resolve(jarPath)); +} + export function getWrapperCacheDirectory( env: NodeJS.ProcessEnv = process.env, platform: NodeJS.Platform = process.platform, diff --git a/packages/language-server/tests/wrapper/executable-utils.test.ts b/packages/language-server/tests/wrapper/executable-utils.test.ts index d0e346ba..4c9871d8 100644 --- a/packages/language-server/tests/wrapper/executable-utils.test.ts +++ b/packages/language-server/tests/wrapper/executable-utils.test.ts @@ -1,13 +1,36 @@ import os from "node:os"; import path from "node:path"; +import { fileURLToPath } from "node:url"; import { getBaseCacheDirectory, getWrapperCacheDirectory, + resolveWrapperJarOverride, sparkConfToJvmArgs, } from "server/integrations/rumble/executable/utils"; import { describe, expect, it } from "vitest"; +describe("wrapper jar override", () => { + it("is not used when JSONIQ_LSP_WRAPPER_JAR is unset or empty", () => { + expect(resolveWrapperJarOverride({})).toBeUndefined(); + expect(resolveWrapperJarOverride({ JSONIQ_LSP_WRAPPER_JAR: "" })).toBeUndefined(); + }); + + it("runs the given jar like a release", () => { + const jarPath = fileURLToPath(import.meta.url); + expect(resolveWrapperJarOverride({ JSONIQ_LSP_WRAPPER_JAR: jarPath })).toEqual({ + args: ["-jar", jarPath, "--daemon"], + }); + }); + + it("fails when the jar does not exist", () => { + const jarPath = path.join(os.tmpdir(), "jsoniq-lsp-missing-wrapper.jar"); + expect(() => resolveWrapperJarOverride({ JSONIQ_LSP_WRAPPER_JAR: jarPath })).toThrow( + jarPath, + ); + }); +}); + describe("wrapper executable cache directories", () => { it("uses JSONIQ_LSP_CACHE_DIR when explicitly provided", () => { expect( From 471bf77c47e65aa33ebd4a198e1a2f70edb5db58 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Mon, 16 Nov 2026 14:30:52 +0100 Subject: [PATCH 7/7] docs: add a changeset and document the wrapper jar override and Maven versions --- .changeset/wrapper-maven-dependency.md | 6 ++++++ packages/language-server/README.md | 2 +- packages/rumble-lsp-wrapper/README.md | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/wrapper-maven-dependency.md diff --git a/.changeset/wrapper-maven-dependency.md b/.changeset/wrapper-maven-dependency.md new file mode 100644 index 00000000..a45c001d --- /dev/null +++ b/.changeset/wrapper-maven-dependency.md @@ -0,0 +1,6 @@ +--- +"rumble-lsp-wrapper": patch +"jsoniq-language-server": patch +--- + +Build the wrapper jar with RumbleDB as a regular Maven dependency. The jar now contains a single version of each library: it used to mix classes from two versions of some, such as `jackson-core` 2.18.2 and 2.18.6. diff --git a/packages/language-server/README.md b/packages/language-server/README.md index 99e74665..2d70ed5a 100644 --- a/packages/language-server/README.md +++ b/packages/language-server/README.md @@ -24,7 +24,7 @@ Files are parsed with ANTLR grammars for both languages, which keeps these featu Type-checking diagnostics, inferred types and running queries come from RumbleDB, through the [Java wrapper](https://github.com/RumbleDB/language-tools/tree/main/packages/rumble-lsp-wrapper). This needs Java 17 or newer on your `PATH`. -The wrapper JAR is too large to ship in the npm package. The server downloads it from GitHub Releases when it is first needed, checks its SHA-256 against the bundled manifest, and caches it. Set `JSONIQ_LSP_CACHE_DIR` to control where it is stored. +The wrapper JAR is too large to ship in the npm package. The server downloads it from GitHub Releases when it is first needed, checks its SHA-256 against the bundled manifest, and caches it. Set `JSONIQ_LSP_CACHE_DIR` to control where it is stored. To use another wrapper JAR, such as one you built yourself, set `JSONIQ_LSP_WRAPPER_JAR` to its path. If you don't want any of this, set `wrapper.enabled` to `false` (see below) and the server runs on the parser alone. diff --git a/packages/rumble-lsp-wrapper/README.md b/packages/rumble-lsp-wrapper/README.md index 6df505d5..7c36aa52 100644 --- a/packages/rumble-lsp-wrapper/README.md +++ b/packages/rumble-lsp-wrapper/README.md @@ -14,7 +14,9 @@ pnpm run build:wrapper This fetches RumbleDB at the commit pinned in `scripts/fetch-rumble.sh`, builds it, and then builds the wrapper. Both steps are cached: the wrapper is only rebuilt when its Java sources, Maven configuration, version or RumbleDB JAR change. To skip the cache, run `pnpm run build:force` in this package. Production builds are never cached. -Run the tests with `pnpm test` in this package, and format the Java code with `pnpm run fmt`. +Each RumbleDB build is installed into the local Maven repository under its own version, such as `3.1.0-local-660355a3f22b`, named after the jar's contents. Old versions stay in `~/.m2/repository/com/github/rumbledb/rumbledb/` and can be deleted. + +Run the tests with `pnpm test` in this package, and format the Java code with `pnpm run fmt`. `pnpm run build:prod` runs the same tests against the shaded release jar. When a local build exists, the language server uses it. Otherwise it falls back to the JAR from GitHub Releases.