Support -H:+CompatibilityMode in build tools#822
Open
Conversation
a68e069 to
e678a1f
Compare
53f7072 to
f999bc4
Compare
vjovanov
commented
Feb 2, 2026
| “Compatibility Mode detected (-H:+CompatibilityMode); skipping native-image test build/run, JVM tests will run instead.” | ||
| * Maven: native test goal short-circuits after environment setup; once-per-build log: | ||
| + | ||
| “Compatibility Mode detected (-H:+CompatibilityMode); skipping native-image test goal, JVM tests will run instead.” |
vjovanov
commented
Feb 2, 2026
| command.add(xmlLocation.toString()); | ||
| if (compatibilityMode) { | ||
| command.add("-cp=" + getClasspath()); | ||
| command.add("--scan-classpath"); |
Member
Author
There was a problem hiding this comment.
How to decide module-path or class-path?
…vider in Gradle Added computeCompatibilityModeEnabledProvider and wired it to test options. Checks build args and NATIVE_IMAGE_OPTIONS env vars for -H:+CompatibilityMode.
…lper Implements isCompatibilityModeEnabled() and invokes it after configureEnvironment() and before JUnitFeature wiring. Detection checks: buildArgs list, environment map NATIVE_IMAGE_OPTIONS, and System.getenv fallback for -H:+CompatibilityMode. Source plan: plans/fallback-compatibility-mode-junit.md.
…eateTestOptions) Bead description: In createTestOptions, only set main class org.graalvm.junit.platform.NativeImageJUnitLauncher and --features=org.graalvm.junit.platform.JUnitPlatformFeature when !isCompatibilityModeEnabled; keep other wiring as-is. Summary of work: - Gate native JUnit launcher main class and JUnit Platform feature when Compatibility Mode is OFF. - Detect Compatibility Mode via NATIVE_IMAGE_OPTIONS env, task env map, and task buildArgs. - Preserve other test image wiring and behavior. - Add functional test native-gradle-plugin/src/test/groovy/org/graalvm/buildtools/gradle/CompatibilityModeGatingTest.groovy. - Fix Checkstyle variable naming.
…n Compatibility Mode Bead description: Extend onlyIf predicates on test image builder and run tasks to require !isCompatibilityModeEnabled; log once using GraalVMLogger when disabling. Summary of work: - Reuse Provider-based Compatibility Mode detection to check -H:+CompatibilityMode from env and buildArgs. - Skip native test image build/run tasks when Compatibility Mode is enabled with once-only info log. - Centralize wiring in plugin; preserve other test wiring. - Add functional tests for ON/OFF cases.
…tibility Mode Bead description: After configureEnvironment() in execute(), if isCompatibilityModeEnabled() then log info and return early to skip native-image tests; retain skipTests/skipNativeTests/failNoTests behavior otherwise. Summary of work: - Add isCompatibilityModeEnabled() detection from build args and NATIVE_IMAGE_OPTIONS (env + surefire/failsafe env). - Early return in NativeTestMojo.execute() with info log. - Functional tests for OFF/ON via build args and NATIVE_IMAGE_OPTIONS. - Minor Checkstyle whitespace fix.
…allback Update native-gradle-plugin/README.md to document automatic fallback when -H:+CompatibilityMode is enabled: detection via buildArgs and NATIVE_IMAGE_OPTIONS; gating of native JUnit wiring; onlyIf-based skip of native test image build/run; once-per-build info log; how to trigger/verify and how to reset; default OFF behavior unchanged.
…allback Update native-maven-plugin/README.md to document automatic fallback when -H:+CompatibilityMode is enabled: detection via buildArgs and NATIVE_IMAGE_OPTIONS; early return in NativeTestMojo.execute(); once-per-build info log; how to trigger/verify and how to reset; default OFF behavior unchanged.
Add Unreleased feature: Auto-fallback to JVM JUnit when -H:+CompatibilityMode is enabled. Details: - Disables native-image JUnit when the flag is present; JVM tests run automatically. - Detection via build arguments and NATIVE_IMAGE_OPTIONS env var. - Gradle: gate JUnit wiring, skip native test build/run via onlyIf, once-per-build info log. - Maven: short-circuit native test goal after environment setup, once-per-build info log. - Default behavior unchanged when flag is absent.
Bead native-build-tools-80s: Add 'plans/' to .gitignore to keep the working tree clean for subsequent tasks.
fd64919 to
87189e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the Native Image Compatibility Mode flag is enabled (
-H:+CompatibilityMode), the Maven native test goal is automatically short-circuited: native-image based JUnit tests are skipped and tests run on the JVM via Surefire/Failsafe instead.What happens
-H:+CompatibilityModeis detected, thenative:testgoal is skipped early and JVM tests execute (Surefire/Failsafe).Detection sources
-DbuildArgs=...).NATIVE_IMAGE_OPTIONS:<environmentVariables>NATIVE_IMAGE_OPTIONS</environmentVariables>).Behavior details
How to trigger and verify
mvn -Pnative -DbuildArgs=-H:+CompatibilityMode testNATIVE_IMAGE_OPTIONS:NATIVE_IMAGE_OPTIONSin the Surefire/Failsafe plugin environment within the POM.Resetting back to native tests
-H:+CompatibilityModefrom build args and ensureNATIVE_IMAGE_OPTIONSdoes not contain it.References (implementation/tests)