Skip to content

feat: layers - #577

Open
sgammon wants to merge 74 commits into
mainfrom
feat/layers
Open

feat: layers#577
sgammon wants to merge 74 commits into
mainfrom
feat/layers

Conversation

@sgammon

@sgammon sgammon commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Support and wiring for Native Image Layers (oracle/graal#7626)

@sgammon sgammon self-assigned this Apr 23, 2026
@sgammon sgammon added the feature Mainline feature work label Apr 23, 2026
@github-actions

github-actions Bot commented Apr 23, 2026

Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

Snapshot Warnings

⚠️: The number of snapshots compared for the base SHA (0) and the head SHA (1) do not match. You may see unexpected additions in the diff.
Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice.

License Issues

pom.xml

PackageVersionLicenseIssue Type
org.graalvm.truffle:truffle-compiler24.1.1NullUnknown License

OpenSSF Scorecard

Scorecard details
PackageVersionScoreDetails
maven/org.graalvm.compiler:compiler 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.nativeimage:native-image-base 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.nativeimage:objectfile 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.nativeimage:pointsto 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.nativeimage:svm 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.polyglot:polyglot 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.sdk:collections 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.sdk:graal-sdk 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.sdk:nativeimage 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.sdk:word 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed
maven/org.graalvm.truffle:truffle-compiler 24.1.1 🟢 4
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 0Found 1/22 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 9license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies🟢 8dependency not pinned by hash detected -- score normalized to 8
Fuzzing⚠️ 0project is not fuzzed

Scanned Files

  • pom.xml

jesseschalken and others added 26 commits April 26, 2026 10:15
Adds binary distribution mappings for GraalVM Community Edition and
Oracle GraalVM across all supported platforms for JDK 24 (24.0.0,
24.0.1, 24.0.2) and JDK 25 (25.0.0, 25.0.1, 25.0.2). Updates
_LatestJvmRelease to 25. Adds "23", "24", and "25" to
TARGET_JAVA_VERSIONS so that the java23/java24/java25 platform
constraints are generated by graalvm/platform/jvm/BUILD.bazel.

Note: macOS x64 is not available for JDK 25.0.2 (dropped upstream).

Signed-off-by: Jesse Schalken <me@jesseschalken.com>
(cherry picked from commit 0c96148)
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Jesse Schalken <me@jesseschalken.com>
(cherry picked from commit f3683e0)
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
sgammon added 4 commits April 26, 2026 10:15
…own limits

Cover the producer→consumer round-trip story (cc_binary deps =
[native_image_target] just works), the four declared headers per
target, the executable_name override needed to drop the default
%target%-bin suffix, the extra_headers escape hatch, and the
known same-package-collision limitation on graal_isolate.h.
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Without it, javac falls back to a stock JDK that doesn't expose the
`org.graalvm.nativeimage` system module, so `Main.java`'s @centrypoint
imports fail to resolve. The layers integration test already does this;
mirror the registration here so the per-image headers Native Image
emits (driven by the @centrypoint added in c683610) actually compile.

Signed-off-by: Sam Gammon <sam@elide.dev>
sgammon added 3 commits April 26, 2026 10:22
The graalvm/jvm and bootstrap toolchain registrations are gated on
`--java_runtime_version=graalvm_21` via `prefix_version_setting`. Without
that flag, Bazel falls through to a remote JDK that lacks the
`org.graalvm.nativeimage` system module, so the @centrypoint imports in
Main.java fail to compile. The layers integration test pins this in its
own .bazelrc; mirror the pattern here so CI selects GraalVM's javac.

Signed-off-by: Sam Gammon <sam@elide.dev>
Buildifier's `function-docstring-return` warning was firing on
`declare_shared_library_headers` and `build_shared_library_cc_info` —
both had Args sections but the Returns description was prose, not a
recognized `Returns:` section. Restructured all three functions
(including the private `_image_basename_from_binary`) to use the
repo's Google-style Args/Returns convention. No behavioral change.

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class support for GraalVM Native Image Layers (.nil) and expands the rules to be Bazel-9-compatible by introducing a version-adaptive cc_shim for CcInfo/cc_common/JavaInfo. It also extends the GraalVM repository rule to support custom download URLs (EA/nightly/dev builds) and updates CI/integration samples to exercise the new behavior across Bazel/GraalVM versions.

Changes:

  • Add native_image_layer rule + layers support in native_image, including layer arg propagation, classpath layering, and runtime shared-lib staging/RPATH wiring.
  • Introduce rules_graalvm_cc_shim (WORKSPACE + Bzlmod) to bridge Bazel 4–9+ C++/Java provider API differences.
  • Add custom-URL support to graalvm_repository and expand integration/CI matrix to cover Bazel 4–9 and GraalVM 25 (plus layered build samples).

Reviewed changes

Copilot reviewed 113 out of 126 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/versions/bazel4.bazelrc Adds Bazel 4-specific bazelrc indirection.
tools/bazel/bazel4.bazelrc Placeholder Bazel 4 bazelrc file.
tools/bazel/base.bazelrc Changes Bazel defaults (incl. direct-deps checking).
tools/BUILD.bazel Excludes example/* from buildifier target.
tests/analysis/nativeimage/native_rules_testsuite.bzl Adds analysis tests for native_image_layer + sizes helper targets.
tests/analysis/legacy/legacy_rules_testsuite.bzl Marks analysis test-generated targets as small.
tests/analysis/analysis_tests.bzl Marks analysis test-generated targets as small.
internal/toolchain.bzl Adds version field to GraalVM toolchain provider/attr.
internal/native_image/toolchain.bzl Routes cc_common calls through cc_shim.
internal/native_image/settings.bzl Introduces NativeImageLayerInfo provider.
internal/native_image/rules.bzl Wires layers + RPATH/shared-lib staging + shared-library CcInfo surfacing.
internal/native_image/layer_rules.bzl Implements native-image layer action and NativeImageLayerInfo propagation.
internal/native_image/layer_builder.bzl Adds layer-create/use arg assembly + directive validation helpers.
internal/native_image/common.bzl Adds layer attrs + cc deps attrs + switches to cc_shim providers.
internal/native_image/classic.bzl Updates legacy rule to use cc_shim.JavaInfo.
internal/native_image/cc_info.bzl Adds helpers to surface CcInfo for shared_library=True native images.
internal/native_image/builder.bzl Refactors native-image arg building; adds cc deps (static/dynamic) plumbing.
internal/native_image/action_utils.bzl Centralizes Graal action env forwarding wrapper.
internal/native_image/BUILD.bazel Exports new internal .bzl files.
internal/graalvm_bindist.bzl Adds custom URL download path + toolchain version propagation.
internal/deps.bzl Registers rules_graalvm_cc_shim repo in WORKSPACE-mode deps setup.
internal/config.bzl Adds Java versions 23–25 to allowed target versions list.
internal/cc_shim_extensions.bzl Adds Bzlmod extension for generating rules_graalvm_cc_shim.
internal/cc_shim.bzl Adds repo rule that writes Bazel-version-specific cc_shim.bzl.
internal/argutil.bzl Adds version-aware gating for experimental native-image args.
graalvm/repositories.bzl Exposes custom URL parameters in the public repository macro.
graalvm/nativeimage/rules.bzl Extends native_image macro with layers + cc deps + extra headers + intermediate dir.
graalvm/nativeimage/layer_rules.bzl Adds public native_image_layer macro and validates directives/layers.
graalvm/nativeimage/BUILD.bazel Exports public layer_rules.bzl.
graalvm/defs.bzl Re-exports native_image_layer and NativeImageLayerInfo.
extensions.bzl Forwards custom-URL attributes through the Bzlmod graalvm extension.
example/integration_tests/shared-lib/sample/Main.java Adds a @CEntryPoint to validate shared-lib header generation.
example/integration_tests/shared-lib/MODULE.bazel Registers bootstrap runtime toolchain for sample.
example/integration_tests/shared-lib/.bazelrc Pins runtime toolchain version for sample.
example/integration_tests/layers/sample/exe/Main.java Adds layered example executable source.
example/integration_tests/layers/sample/exe/BUILD.bazel Adds Java library target for layered example.
example/integration_tests/layers/sample/dyn.c Adds trivial dynamic lib for cc_deps_dynamic wiring sample.
example/integration_tests/layers/sample/cc2/BUILD.bazel Adds second shared-lib producer for dedup/coexistence testing.
example/integration_tests/layers/sample/cc/run_dedup.sh Adds runtime check script for shared-lib dedup consumer.
example/integration_tests/layers/sample/cc/run_consumer.sh Adds runtime check script for shared-lib consumer.
example/integration_tests/layers/sample/cc/dedup_consumer.c Adds C consumer that uses two shared libs with separate isolates.
example/integration_tests/layers/sample/cc/consumer.c Adds C consumer that calls into generated shared library API.
example/integration_tests/layers/sample/cc/BUILD.bazel Adds shared-lib producer + C consumers + sh_tests.
example/integration_tests/layers/sample/base/Other.java Adds base-layer Java code for layered build sample.
example/integration_tests/layers/sample/base/BUILD.bazel Adds Java library for base layer sample.
example/integration_tests/layers/sample/api2/SharedApi2.java Adds second shared-lib Java API for dedup scenario.
example/integration_tests/layers/sample/api2/BUILD.bazel Adds Java library for api2.
example/integration_tests/layers/sample/api/SharedApi.java Adds shared-lib Java API with @CEntryPoint.
example/integration_tests/layers/sample/api/BUILD.bazel Adds Java library for api.
example/integration_tests/layers/sample/BUILD.bazel Adds layer + consuming image + cc_deps_dynamic sample wiring.
example/integration_tests/layers/WORKSPACE.bazel Declares workspace for layers integration test.
example/integration_tests/layers/MODULE.bazel Full layered integration test module (Bazel 9 + GraalVM 25 EA via URL).
example/integration_tests/layers/.bazelversion Pins Bazel 9.1.0 for layers integration test.
example/integration_tests/layers/.bazelrc Enables bzlmod and pins GraalVM runtime version for layers test.
example/integration_tests/graalvm-oracle-25/sample/Main.java Adds Oracle GVM 25 sample source.
example/integration_tests/graalvm-oracle-25/sample/BUILD.bazel Adds Oracle GVM 25 build targets.
example/integration_tests/graalvm-oracle-25/WORKSPACE.bazel Adds WORKSPACE-mode Oracle GVM 25 integration test.
example/integration_tests/graalvm-oracle-25/MODULE.bazel Adds placeholder MODULE.bazel for sample.
example/integration_tests/graalvm-oracle-25/.gitignore Ignores Bazel output dirs.
example/integration_tests/graalvm-oracle-25/.bazelversion Pins Bazel 7.0.0 for sample.
example/integration_tests/graalvm-oracle-25/.bazelrc Adds sample bazelrc placeholder.
example/integration_tests/graalvm-ce-25/sample/Main.java Adds CE GVM 25 sample source.
example/integration_tests/graalvm-ce-25/sample/BUILD.bazel Adds CE GVM 25 build targets.
example/integration_tests/graalvm-ce-25/WORKSPACE.bazel Adds WORKSPACE-mode CE GVM 25 integration test.
example/integration_tests/graalvm-ce-25/MODULE.bazel Adds placeholder MODULE.bazel for sample.
example/integration_tests/graalvm-ce-25/.gitignore Ignores Bazel output dirs.
example/integration_tests/graalvm-ce-25/.bazelversion Pins Bazel 7.0.0 for sample.
example/integration_tests/graalvm-ce-25/.bazelrc Adds sample bazelrc placeholder.
example/integration_tests/custom-url/sample/Main.java Adds custom-URL integration sample source.
example/integration_tests/custom-url/sample/BUILD.bazel Adds targets to force custom-URL toolchain fetch/wiring.
example/integration_tests/custom-url/WORKSPACE.bazel Declares workspace for custom-url sample.
example/integration_tests/custom-url/MODULE.bazel Exercises url_per_platform/hash/prefix wiring for custom downloads.
example/integration_tests/custom-url/.bazelversion Pins Bazel 9.1.0 for custom-url sample.
example/integration_tests/custom-url/.bazelrc Enables bzlmod and pins runtime version for sample.
example/integration_tests/bzlmod/MODULE.bazel.lock Updates lockfile for extension + toolchain selection changes.
example/integration_tests/bzlmod/MODULE.bazel Bumps sample GraalVM selection to Java/GraalVM 25.
example/integration_tests/bazel9/sample/Main.java Adds Bazel 9 bzlmod sample source.
example/integration_tests/bazel9/sample/BUILD.bazel Adds Bazel 9 bzlmod sample targets.
example/integration_tests/bazel9/WORKSPACE.bazel Adds Bazel 9 sample WORKSPACE minimal deps.
example/integration_tests/bazel9/MODULE.bazel Adds Bazel 9 bzlmod sample module wiring.
example/integration_tests/bazel9/.bazelversion Pins Bazel 9.1.0 for sample.
example/integration_tests/bazel9/.bazelrc Enables bzlmod and pins runtime version.
example/integration_tests/bazel8/sample/Main.java Adds Bazel 8 bzlmod sample source.
example/integration_tests/bazel8/sample/BUILD.bazel Adds Bazel 8 bzlmod sample targets.
example/integration_tests/bazel8/WORKSPACE.bazel Adds Bazel 8 sample WORKSPACE minimal deps.
example/integration_tests/bazel8/MODULE.bazel.lock Adds Bazel 8 module lockfile.
example/integration_tests/bazel8/MODULE.bazel Adds Bazel 8 bzlmod sample module wiring.
example/integration_tests/bazel8/.bazelversion Pins Bazel 8.0.0 for sample.
example/integration_tests/bazel8/.bazelrc Enables bzlmod and pins runtime version.
example/integration_tests/bazel4/sample/Main.java Adds Bazel 4 sample source.
example/integration_tests/bazel4/sample/BUILD.bazel Adds Bazel 4 WORKSPACE-mode sample targets (legacy rule path).
example/integration_tests/bazel4/WORKSPACE.bazel Adds Bazel 4 WORKSPACE-mode integration test wiring.
example/integration_tests/bazel4/.gitignore Ignores Bazel output dirs.
example/integration_tests/bazel4/.bazelversion Pins Bazel 4.2.4 for sample.
example/integration_tests/bazel4/.bazelrc Adds sample bazelrc placeholder.
docs/superpowers/specs/2026-04-25-shared-library-ccinfo-design.md Adds design spec for shared-library CcInfo plumbing.
docs/shared-libraries.md Documents consuming shared libs via CcInfo and extra_headers.
WORKSPACE.bazel Registers rules_graalvm_cc_shim repo for WORKSPACE-mode usage.
MODULE.bazel Adds rules_cc dep, bumps several dev deps, registers cc_shim extension repo.
.github/workflows/on.pr.yml Updates macOS Intel runner image.
.github/workflows/module.build.yml Expands CI integration matrix (Bazel 4/8/9, GVM 25, layers, custom URL).
.github/workflows/BUILD.bazel Excludes example/* from workflow buildifier target.
.bazelversion Bumps repo default Bazel version to 9.1.0.
.bazelci/presubmit.yml Bumps presubmit Bazel version and pins buildifier version.
.aspect/bazelrc/performance.bazelrc Updates Aspect bazelrc flags to common and adds runfiles link tuning.
.aspect/bazelrc/javascript.bazelrc Adjusts debug NODE_OPTIONS handling.
.aspect/bazelrc/java.bazelrc Adds Aspect-recommended Java flag set.
.aspect/bazelrc/debug.bazelrc Moves debug test flags under common:debug.
.aspect/bazelrc/correctness.bazelrc Moves flags to common and updates some correctness defaults.
.aspect/bazelrc/convenience.bazelrc Moves convenience flags to common.
.aspect/bazelrc/ci.bazelrc Moves CI flags to common and trims some recommendations.
.aspect/bazelrc/bazel7.bazelrc Adds Bazel7-specific --check_direct_dependencies=off and other tunings.
.aspect/bazelrc/bazel6.bazelrc Adds Bazel6-specific flag handling and restores removed tunings.
Comments suppressed due to low confidence (1)

internal/native_image/builder.bzl:327

  • allow_fallback no longer has any effect: --no-fallback is never emitted. This changes the default behavior (fallback becomes allowed even when allow_fallback = False) and is likely a regression. Consider reintroducing the --no-fallback flag when ctx.attr.allow_fallback is false (ideally near output-mode configuration).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/argutil.bzl
Comment thread graalvm/nativeimage/layer_rules.bzl Outdated
Comment thread internal/native_image/layer_builder.bzl
Comment thread internal/native_image/layer_rules.bzl
Comment thread internal/native_image/rules.bzl
Comment thread tools/bazel/base.bazelrc
sgammon added 2 commits April 26, 2026 11:21
- argutil.bzl: rewrite `experimental_args()` docstring to match the
  actual two-branch behavior (gated for 22+, bare otherwise) — the
  previous wording promised a 21-only "open without close" branch
  that the constants `_EXPERIMENTAL_OPEN_MIN_MAJOR=22` /
  `_EXPERIMENTAL_CLOSE_MIN_MAJOR=22` never produce.
- layer_rules.bzl (public + internal): swap "TreeArtifact / written
  to <name>.nil/" docstring wording for "single-file archive at
  <name>.nil" to match the `declare_file` reality.
- layer_builder.bzl: clarify `layer_tree` parameter doc — name is
  legacy from a TreeArtifact prototype; the value is a `File`.
- layer_rules.bzl: pin `transitive_layer_files` depset to
  `order = "topological"` so iteration is contractually
  ancestors-before-descendants for `-H:LayerUse` emission, instead
  of relying on default-order semantics.
- rules.bzl: drop redundant `parent_infos or` from the RPATH
  emission guard — `needs_rpath` already covers it.

No behavioral change beyond the depset-order pinning (which matches
prior empirical behavior anyway).

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
@sgammon sgammon changed the title [WIP] feat: layers feat: layers Apr 26, 2026
@sgammon
sgammon marked this pull request as ready for review April 26, 2026 18:25
Signed-off-by: Sam Gammon <sam@elide.dev>
@sonarqubecloud

Copy link
Copy Markdown

mitchjust-canva and others added 12 commits June 9, 2026 08:30
Replace the unreleased `register_all` bzlmod tag attribute with a `platforms`
selector and make all supported platforms the default. Toolchain selection is
lazy — Bazel only fetches the SDK for a platform whose toolchain is actually
chosen — so registering every platform is free for host-only builds and makes
RBE resolve a matching toolchain out of the box.

  platforms unset / [] / ["all"]      -> all 5 platforms (default)
  platforms ["host"]                  -> host only (escape hatch)
  platforms ["linux-x64", ...]        -> explicit subset

`register_all` is removed from the bzlmod tag (it was never released) but kept as
a deprecated alias on the `graalvm_repository` macro for the legacy WORKSPACE
entry point: True -> all, False -> host only. The two cannot be combined.

The generated `@graalvm_toolchains//` repo gains ergonomic host aliases
(`:native_image`, `:java_runtime`) alongside the existing back-compat aliases,
emitted only when the host platform is in the selected set. A single
`register_toolchains("@graalvm_toolchains//:all")` is the canonical registration
for any selection.

Host/SDK dedup: in multi-platform mode the host platform's toolchain references
the primary `@<name>//` SDK repo (which users also address directly) instead of a
duplicate `@<name>_<host>//`, so the host SDK is downloaded only once.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- README: replace the `register_all` section with `platforms` docs — all
  platforms by default (lazy fetch, RBE-ready), `["host"]` / explicit-subset
  escape hatches, and the addressable per-platform / host alias labels.
- bzlmod_all_platforms: drop the removed `register_all = True` tag attribute;
  the all-platforms behavior is now the default. Regenerate its lockfile.
- Regenerate the root lockfile, which now dogfoods the all-platforms default.

Existing host-build integration tests are intentionally left untouched: the
default flip is additive and lazy, so they keep working unchanged (their
lockfiles self-heal under the default `--lockfile_mode=update` on next run).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ider

Toolchain *resolution* was already per-platform, but anything reaching into the
SDK by raw `@graalvm//:lib/...` label still hit the host download — so a macOS
host driving a Linux native-image build over RBE would pull macOS SDK files even
though the native-image toolchain resolved to Linux.

Surface the platform-correct files through `GraalVMToolchainInfo` instead. New
fields (all resolved per-platform, since each `graalvm_sdk` lives in its own SDK
repo): `home`, `jdk_runtime`, `class_roots`, and `static_link_libs`. `gvm_files`
is retained for back-compat.

- `class_roots` filegroup (`lib/modules`, `lib/jrt-fs.jar`, `lib/ct.sym`) added to
  the JDK BUILD template.
- `static_link_libs` exposed as `cc_library` targets bundling the SVM + JDK static
  archives for a fully-static native link. Linux's libc split is a user knob:
  `@rules_graalvm//graalvm/config:libc` (glibc default) drives a `select()`, with
  `:static_link_libs_{glibc,musl}` also addressable explicitly. macOS/Windows have
  a single flat static-lib set.
- The provider carries the `static_link_libs` *target* (consumer indexes
  `target[CcInfo]`) rather than a `CcInfo` value, so `toolchain.bzl` never
  references the `CcInfo` symbol — which Bazel 9 has moved out of the global scope
  and which this file is loaded under across Bazel 6-9.

Existing `@graalvm//:{jdk,native-image,lib/*}` labels and `gvm_files` are
unchanged; the new fields are additive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an `sdk_probe` rule + `sdk_probe_test` to the bzlmod_all_platforms example.
The probe records the file paths the resolved GraalVM toolchain surfaces
(`class_roots` + `static_link_libs`); the test asserts they all originate from a
single SDK repo (no host/target mix), and — given an expected token — that it is
the target platform's repo.

Because `ctx.actions.write` is in-process, the probe needs no executor for the
selected platform, so the macOS-host -> Linux-target scenario is checkable
locally and in CI with `--platforms` (RBE only required to actually execute a
remote build). Verified from a macOS host targeting linux-x64: every SDK file —
class roots, glibc JDK static libs, and SVM clibraries — resolves from
`graalvm_linux_x64`, not the host SDK.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a README subsection showing how a custom rule reads platform-correct SDK
files (`static_link_libs`, `class_roots`, `jdk_runtime`, ...) from the resolved
GraalVM toolchain instead of host-pinned `@graalvm//:lib/...` labels, and explain
the libc knob: `static_link_libs` follows `//graalvm/config:libc` for direct
references, while `static_link_libs_musl` is the field to read for a musl link
through the toolchain (the flag does not survive the toolchain's exec config).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an `sdk-file-selection` job to the module build workflow that resolves the
linux/aarch64 GraalVM toolchain from the x86_64 runner and asserts every SDK file
the toolchain provider surfaces comes from `graalvm_linux_aarch64`, not the host
SDK. This is the file-selection guard and needs no RBE (`ctx.actions.write` is
in-process). A full remote-execution smoke test on BuildBuddy is left as a
follow-up — it needs RBE-platform exec_properties (container image) for the
example, which can't be validated without the account.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two gaps in the `static_link_libs` globs, found testing against real SDKs:

- The SVM macro static libs (truffle's `lib/svm/macros/**/libffi.a`) were not
  globbed at all, so a consumer linking `libffi` (e.g. HEATWAVE's
  `truffle_libs = ["libffi"]`) lost those symbols.
- `lib/svm/clibraries/*/*.a` was one level deep — fine for the flat layout
  (CE 21, macOS) but it misses the libc-nested clibraries that GraalVM 24/25 ship
  (`clibraries/<plat>/{glibc,musl}/{libjvm,liblibchelper,libsvm_container}.a`),
  the exact path from the original analysis-failure report.

Switch both `static_link_libs_{glibc,musl}` to recursive `**` globs over
`clibraries`, `macros`, and `static`, with a per-variant `exclude` of the other
libc dir. This is layout-agnostic: flat, platform-nested, and libc-nested SDKs
all resolve correctly, and the exclude is a no-op on flat layouts (both variants
identical there). Verified the bundle now contains `libjvm`, `liblibchelper`, and
`libffi` for a linux-x64 target resolved from a macOS host.

Also harden the probe test: `provenance_test.sh` now asserts required archives
are present (not just single-repo origin) — an origin-only check could not catch
a missing `libjvm`/`libffi`. The committed `sdk_probe_test` and the CI job both
require `libjvm,liblibchelper,libffi`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ch detection

(1) maven_resource_bundle is no longer inert: when set (custom-URL toolchains),
the bundle is downloaded + extracted under maven-bundle/ and exposed as the
`maven_resource_bundle` filegroup. New `maven_resource_bundle_sha256` attr
(threaded extension -> graalvm_repository -> bindist rule, validated to require
the bundle URL, sha256: prefix stripped, non-hermetic warning) makes the download
hash-checked + hash-locked. Verified via the layers example: 2106-file maven tree
extracted, filegroup resolves, sha256 verified on fetch.

(2) Bazel 4: replace the single repository_ctx.os.arch use (added in Bazel 7) with
a _host_arch() helper that falls back to `uname -m` (normalizing arm64->aarch64)
/ %PROCESSOR_ARCHITECTURE%. The bazel4 integration example now builds clean under
Bazel 4.2.4; no further pre-7 gap surfaced, so Bazel 4 stays in CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…resource cache into the intermediate dir

With the optimizing Truffle runtime active, the native-image builder installs the
`truffleattach` internal resource into the polyglot resource cache (default
`$HOME/.cache/org.graalvm.polyglot`). On remote executors (RBE) where `$HOME` and
`/tmp` are not writable, the install fails and the build aborts with "resource cache
folder ... is not a readable and writable directory" (JDKSupport/InternalResourceCache).

Add an opt-in `relocate_polyglot_cache` bool attr: when set (and `emit_intermediate_dir`
is True), pass `-J-Dpolyglot.engine.userResourceCache=<intermediate_dir>/polyglot-resources`
to the builder JVM. The value is resolved `toAbsolutePath()` against the builder's CWD (the
exec root), landing inside the declared TreeArtifact, which is writable on every executor.
Builder-JVM only; the image's own runtime resource cache is untouched. No-op by default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Mainline feature work

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants