Releases: sgammon/rules_graalvm
v0.9.0
Summary
Initial release of the new rules_graalvm
package; this version was picked because the package internals are already considered mature. Under this rewrite, Bazel 7 is the new support maximum, so mostly we're adjusting to changes in Bazel. GraalVM distributions have also changed, so adjustments have been made to the way GVM installations are resolved and downloaded.
Under the hood, graalvm_repository
now uses the same internals as remote_java_repository
. This allows the downloaded JVM to be used easily as a Java toolchain, and explains to Bazel how to bootstrap the build with it.
The latest
version of the oracle
GVM distribution can also be downloaded now, and a user can provide their own sha256
as well. See below for an exhaustive set of release notes and breaking changes from rules_graal
.
Usage
Via WORKSPACE.bazel
:
http_archive(
name = "rules_graalvm",
sha256 = "96323ac1b7a5b9db1ae1a388c5ed1fb830d4628d3ab4b7f09538558321e03111",
strip_prefix = "rules_graalvm-0.9.0",
urls = [
"https://github.com/sgammon/rules_graalvm/releases/download/v0.9.0/rules_graalvm-0.9.0.tar.gz",
],
)
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 = "oracle", # `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
)
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.9.0")
# Until we ship to BCR:
archive_override(
module_name = "rules_graalvm",
urls = ["https://github.com/sgammon/rules_graalvm/releases/download/v0.9.0/rules_graalvm-0.9.0.tar.gz"],
strip_prefix = "rules_graalvm-0.9.0",
integrity = "sha256-ljI6wbeludsa4aOIxe0fuDDUYo06tLfwlThVgyHgMRE=",
)
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 = "oracle", # `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",
)
Using GraalVM as your Java toolchain
From WORKSPACE.bazel
:
# graalvm_repository(...)
register_toolchains("@graalvm//:toolchain")
From .bazelrc
:
build --extra_toolchains=@graalvm//:toolchain
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
.
New features
- Use GraalVM as your Java toolchain in Bazel
- Conventional package structure
- Support for Bazel 6, Bazel 7, and Bzlmod
Breaking changes
@rules_graal
→@rules_graalvm
- Repository Rules
load("@rules_graal//graal:graal_bindist.bzl", "graal_bindist_repository")
- →
load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")
- →
graal_bindist_repository
→graalvm_repository
- Target Rules
load("@rules_graal//graal:graal.bzl", "graal_binary")
- →
load("@rules_graalvm//graalvm:defs.bzl", "native_image")
- →
graal_binary
→native_image
Changelog
- Update from upstream by @sgammon in #2
- Update from latest fork by @sgammon in #4
- Rewrite:
rules_graalvm
by @sgammon in #5
New Contributors
- No new contributors this round
Full Changelog: https://github.com/sgammon/rules_graalvm/commits/v0.9.0