Release v0.10.1
Summary
This is a hotfix release for the 0.10.x
release of rules_graalvm
. This release is identical to 0.10.0
, except that it works over BCR (there were some fingerprint issues when publishing, and that release will be yanked as a result). This release of the rules is pretty big and includes the following major updates:
- Ability to easily use Maven artifacts from the GraalVM team
- Lazy downloads of GraalVM toolchains
- Many bugfixes
- Hermetic compiler support on macOS, Linux, and Windows
- ... and more! See the full set of changes summarized below.
This release includes contributions from:
- Sam Gammon, Elide (@sgammon)
- Mantas Indrašius, Wix (@mantasindrasius)
- Fabian Meumertzheim, Code Intelligence (@fmeum)
This release included @mantasindrasius and @fmeum 's first contributions 🥳 Thank you to all who contributed!
Important
There are some backward-incompatible changes in this release which involve the way toolchains are registered. Most users should have no problem upgrading; if you are using @graalvm_toolchain_config_repo
targets directly, you will need to change them to @graalvm_toolchains
. See the Breaking changes section below for more information.
Installation
Via WORKSPACE.bazel
:
http_archive(
name = "rules_graalvm",
sha256 = "ca6fa64992139a3fd04fd878857319d4b865c80624e6a73967d340be4f64cb52",
strip_prefix = "rules_graalvm-0.10.1",
urls = [
"https://github.com/sgammon/rules_graalvm/releases/download/v0.10.1/rules_graalvm-0.10.1.zip",
],
)
load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")
graalvm_repository(
name = "graalvm",
components = [
# if you need components like `js` or `wasm`, add them here
],
distribution = "ce", # `oracle`, `ce`, or `community`
java_version = "20", # `17`, `20`, or `21`, as supported by the version provided
version = "20.0.2", # earlier version format like `22.x` also supported
)
Artifact | SHA256 |
---|---|
rules_graalvm-0.10.1.zip |
ca6fa64992139a3fd04fd878857319d4b865c80624e6a73967d340be4f64cb52 |
rules_graalvm-0.10.1.tgz |
13fa6527895534a6657a24e702f908d63925cea0e8f9d5d926b6a5f4739f91c2 |
Or, via MODULE.bazel
:
Important
To use Bzlmod with rules_graalvm
, you will need the archive_override
below (until this package is made available on BCR).
bazel_dep(name = "rules_graalvm", version = "0.10.1")
# Until we ship to BCR:
archive_override(
module_name = "rules_graalvm",
urls = ["https://github.com/sgammon/rules_graalvm/releases/download/v0.10.1/rules_graalvm-0.10.1.zip"],
strip_prefix = "rules_graalvm-0.10.1",
integrity = "sha256-ym+mSZITmj/QT9h4hXMZ1LhlyAYk5qc5Z9NAvk9ky1I=",
)
gvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm")
gvm.graalvm(
name = "graalvm",
version = "20.0.2", # earlier version format like `22.x` also supported
distribution = "ce", # `oracle`, `ce`, or `community`
java_version = "20", # `17`, `20`, or `21`, as supported by the version provided
components = [
# if you need components like `js` or `wasm`, add them here
],
)
use_repo(gvm, "graalvm")
register_toolchains("@graalvm//:jvm")
register_toolchains("@graalvm//:sdk")
Artifact | Integrity value |
---|---|
rules_graalvm-0.10.1.zip |
sha256-ym+mSZITmj/QT9h4hXMZ1LhlyAYk5qc5Z9NAvk9ky1I= |
rules_graalvm-0.10.1.tgz |
sha256-E/plJ4lVNKZleiTnAvkI1jklzqDo+dXZJral9HOfkcI= |
Using GraalVM as your Java toolchain
Via WORKSPACE.bazel
:
# graalvm_repository(...)
load("@rules_graalvm//graalvm:workspace.bzl", "register_graalvm_toolchains")
register_graalvm_toolchains()
Via Bzlmod:
register_toolchains("@graalvm//:sdk")
register_toolchains("@graalvm//:jvm")
To use the toolchain, add this to your .bazelrc
:
build --extra_toolchains=@graalvm//:jvm
build --java_runtime_version=graalvm_20
Note
If you name your repository example
and set the Java version to 21
, your java_runtime_version
would be example_21
, and your toolchain repo would be @example_toolchains
.
Release Notes
See below for breaking changes in this release, and then everything else that changed.
Breaking changes
-
The
default_executable_name
attribute and parameter has been renamed toexecutable_name
.
This is because there is no other executable name parameter; setting this attribute will unconditionally change the output binary name. -
Legacy GVM is only usable with the legacy rules.
Previously, it was possible to use a rather old version of GraalVM (Java 11-era) with the new-style rules. This use is no longer supported because older versions ofnative-image
show incompatibilities with Bazel's process wrapper. -
Native image builds will now respect Bazel flags like
--compilation_mode=opt
.
Defaults have been left to GraalVM to maintain backward compatibility with the default case, which builds binaries with-O2
(optimizations on). However, this is still a breaking change because the behavior will be different if--compilation_mode
was being explicitly set to any value other thanopt
. Note that Bazel's default value offastbuild
also applies here, so passing no value at all will result in a behavior change (opt
→fastbuild
). -
The order of options passed to
native-image
has changed.
Attributes likeextra_args
now pass later on the command line (last, actually, forextra_args
); becausenative-image
options are last-wins, this should allow overriding any of the flags injected by the rules. This should offer users a path forward even if the flags passed by the rules are incompatible in some way. This change in the order of action arguments may result in cache misses. Otherwise, this change should be transparent to rule users. -
Hermetic build environment improvements.
The parameteruse_default_shell_env
is no longer passed to the underlyingnative-image
compile action; instead, the toolchain environment is assembled for strict use. Native compiler environment variables likeINCLUDE
,LIB
,DEVELOPER_DIR
, andSDKROOT
no longer need to be passed via--action_env
. -
Toolchain targets and registration.
See below for an exhaustive description, but basically, the registration calls for toolchains need to change, but only for users who are consuming via Bzlmod.
Breaking changes: Toolchain registration
When registering toolchains in a Bzlmod installation of these rules, the target @graalvm//:all
must be changed to two toolchain registrations, based on the desired functionality:
Register the Java toolchain:
register_toolchains("@graalvm_toolchains//:toolchain")
Register the GVM toolchain:
register_toolchains("@graalvm_toolchains//:toolchain_gvm")
To keep the :all
target:
register_toolchains("@graalvm_toolchains//:all")
PRs and issues
Mainline work:
- feat: graalvm artifact mappings
- fix: install requested components plus deps
- fix: typo in gu post-install actions
- feat: bazel settings integration
- test: add more feature integration tests
- fix(toolchain): add alias indirection for gvm toolchain
- fix(native_image): fix C++ toolchain env setup
- feat(native_image): add static_zlib
- fix: bcr tarball endpoint
- fix(native_image): clean up args building
- fix(native_image): clean up construction of inputs
- fix(native_image): use
;
as classpath separator on windows - docs: fix api docs and publish flow
Related solved issues:
- Typo in the gu post-install actions
- Component direct dependencies not installed
- Ability to build a shared library
- Bazel Settings Propagation
- Populate environment for macOS builds
- Download GraalVM distributions lazily
What's Changed
- docs: fix api docs and publish flow by @sgammon in #63
- chore(deps): lock file maintenance by @renovate in #64
- Use
;
as classpath separator on Windows by @fmeum in #68 - chore(deps): bump github/codeql-action from 2.21.4 to 2.21.5 by @dependabot in #65
- fix(native_image): clean up args building by @fmeum in #71
- fix(native_image): clean up construction of inputs by @fmeum in #70
- chore(deps-dev): bump prettier from 3.0.2 to 3.0.3 by @dependabot in #69
- fix: bcr tarball endpoint by @sgammon in #76
- fix: install requested components plus deps by @sgammon in #101
- chore(deps): lock file maintenance by @renovate in #103
- chore(deps): lock file maintenance by @renovate in #104
- chore(deps-dev): bump prettier-plugin-java from 2.3.0 to 2.3.1 by @dependabot in #110
- chore(deps): bump actions/checkout from 3.6.0 to 4.0.0 by @dependabot in #111
- chore(deps): bump actions/upload-artifact from 3.1.2 to 3.1.3 by @dependabot in #112
- Release:
0.10.x
by @sgammon in #80 - chore: apply hardening to ci by @step-security-bot in #115
- chore: issue fix release →
0.10.1
by @sgammon in #122
Full Changelog: v0.9.2...v0.10.1