This is an automated email from the ASF dual-hosted git repository. luigidemasi pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kit.git
commit a8d70365eba7d7edc19835e34a0182e2d7f95cee Author: Luigi De Masi <[email protected]> AuthorDate: Wed Nov 18 00:32:56 2026 +0100 Enable native terminal access in the standalone launcher Match Camel JBang native-access configuration for Aesh terminal probing on Java 25. Read the shipped JVM options in the standalone process test and retain strict empty-stderr and Unicode assertions. Document the matching option for direct Java invocation. Co-authored-by: OpenAI Codex <[email protected]> --- docs/modules/ROOT/pages/contributing.adoc | 4 ++++ .../camel/kit/HostedCliCompatibilityTest.java | 21 +++++++++++++++++++-- kit/camel-kit-main/dist/CamelKit.java | 1 + .../src/main/jbang/main/CamelKit.java | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/modules/ROOT/pages/contributing.adoc b/docs/modules/ROOT/pages/contributing.adoc index 3b8ff6fb..b35ef1da 100644 --- a/docs/modules/ROOT/pages/contributing.adoc +++ b/docs/modules/ROOT/pages/contributing.adoc @@ -26,6 +26,10 @@ repository root. jbang kit/camel-kit-main/src/main/jbang/main/CamelKit.java --help ---- +The standalone JBang launcher enables native access for its terminal libraries. When invoking +`org.apache.camel.kit.CamelKitMain` directly with `java`, include `--enable-native-access=ALL-UNNAMED` +before the main class, as the launcher does. + [cols="1,3"] |=== | Module | Content diff --git a/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java b/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java index d1854283..58b4209e 100644 --- a/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java +++ b/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java @@ -118,8 +118,25 @@ class HostedCliCompatibilityTest { + quote("-Duser.home=" + directory) + "\n" + entryPoint.getName() + "\n"); List<String> command = new ArrayList<>( - List.of(Path.of(System.getProperty("java.home"), "bin", "java").toString(), - "@" + javaArguments)); + List.of(Path.of(System.getProperty("java.home"), "bin", "java").toString())); + if (entryPoint == CamelKitMain.class) { + Path root = Path + .of(HostedCliCompatibilityTest.class.getProtectionDomain().getCodeSource().getLocation().toURI()); + Path launcher = Path.of("kit/camel-kit-main/src/main/jbang/main/CamelKit.java"); + while (root != null && !Files.isRegularFile(root.resolve(launcher))) { + root = root.getParent(); + } + assertNotNull(root, "Could not locate the shipped JBang launcher"); + List<String> source = Files.readAllLines(root.resolve(launcher)); + assertEquals(source, Files.readAllLines(root.resolve("kit/camel-kit-main/dist/CamelKit.java")), + "Source and distribution launchers must have the same JVM options and dependencies"); + for (String line : source) { + if (line.startsWith("//JAVA_OPTIONS ")) { + command.addAll(List.of(line.substring("//JAVA_OPTIONS ".length()).trim().split("\\s+"))); + } + } + } + command.add("@" + javaArguments); command.addAll(List.of(arguments)); Path out = directory.resolve("stdout"), err = directory.resolve("stderr"); var builder = new ProcessBuilder(command).directory(directory.toFile()) diff --git a/kit/camel-kit-main/dist/CamelKit.java b/kit/camel-kit-main/dist/CamelKit.java index 8e369f0a..2691f336 100755 --- a/kit/camel-kit-main/dist/CamelKit.java +++ b/kit/camel-kit-main/dist/CamelKit.java @@ -1,6 +1,7 @@ ///usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 21+ +//JAVA_OPTIONS --enable-native-access=ALL-UNNAMED //REPOS central=https://repo1.maven.org/maven2/,apache_snap=https://repository.apache.org/snapshots //REPOS central_snap=https://central.sonatype.com/repository/maven-snapshots/ diff --git a/kit/camel-kit-main/src/main/jbang/main/CamelKit.java b/kit/camel-kit-main/src/main/jbang/main/CamelKit.java index 8e369f0a..2691f336 100644 --- a/kit/camel-kit-main/src/main/jbang/main/CamelKit.java +++ b/kit/camel-kit-main/src/main/jbang/main/CamelKit.java @@ -1,6 +1,7 @@ ///usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 21+ +//JAVA_OPTIONS --enable-native-access=ALL-UNNAMED //REPOS central=https://repo1.maven.org/maven2/,apache_snap=https://repository.apache.org/snapshots //REPOS central_snap=https://central.sonatype.com/repository/maven-snapshots/
