Skip to content

Releases: sgammon/rules_graalvm

v0.11.2

18 Apr 23:13
v0.11.2
7c53c1a
Compare
Choose a tag to compare

General Notes

Prepares release 0.11.2 of the GraalVM Rules for Bazel. This release updates GraalVM to the latest release version, 22.0.1 (SDK version 24.0.1).

Thanks to @loganasherjones for their first contribution! 🥇

Released PRs

What's Changed

  • Add resource configuration file flag by @loganasherjones in #308
  • Adds the proxy configuration file flag by @loganasherjones in #309
  • fix(bazelci): run bazelci against bazel 7.0.0 by @sgammon in #325
  • fix(ci): dependency review needs the graph by @sgammon in #326
  • chore(deps): bump actions/upload-pages-artifact from 3.0.0 to 3.0.1 by @dependabot in #310
  • chore(deps): bump actions/upload-artifact from 4.3.0 to 4.3.1 by @dependabot in #313
  • chore(deps): bump actions/jekyll-build-pages from 1.0.9 to 1.0.12 by @dependabot in #314
  • chore(deps-dev): bump prettier-plugin-java from 2.5.0 to 2.6.0 by @dependabot in #317
  • chore(deps): bump advanced-security/maven-dependency-submission-action from 4.0.0 to 4.0.2 by @dependabot in #323
  • chore(deps-dev): bump @commitlint/config-conventional from 18.5.0 to 19.0.3 by @dependabot in #321
  • chore(deps-dev): bump @commitlint/cli from 18.4.4 to 19.0.3 by @dependabot in #322
  • chore(deps): lock file maintenance by @renovate in #318
  • chore(deps-dev): bump @commitlint/config-conventional from 19.0.3 to 19.1.0 by @dependabot in #327
  • chore(deps): bump codecov/codecov-action from 3.1.4 to 4.1.0 by @dependabot in #330
  • chore(deps): bump actions/checkout from 4.1.1 to 4.1.2 by @dependabot in #331
  • chore(deps): bump actions/deploy-pages from 4.0.3 to 4.0.5 by @dependabot in #336
  • chore(deps): bump github/codeql-action from 3.23.1 to 3.24.8 by @dependabot in #337
  • chore(deps): bump actions/cache from 4.0.0 to 4.0.2 by @dependabot in #344
  • chore(deps-dev): bump @commitlint/cli from 19.0.3 to 19.2.1 by @dependabot in #338
  • chore(deps): bump github/codeql-action from 3.24.8 to 3.24.9 by @dependabot in #348
  • chore(deps): bump actions/dependency-review-action from 4.1.3 to 4.2.5 by @dependabot in #350
  • chore(deps): bump codecov/codecov-action from 4.1.0 to 4.1.1 by @dependabot in #351
  • Update apple_support to 1.15.1 by @fmeum in #353
  • chore(deps): bump actions/configure-pages from 4.0.0 to 5.0.0 by @dependabot in #352
  • General Maintenance / JDK 22 by @sgammon in #354
  • chore(deps): bump github/codeql-action from 3.24.9 to 3.25.1 by @dependabot in #362
  • chore(deps-dev): bump @commitlint/config-conventional from 19.1.0 to 19.2.2 by @dependabot in #361
  • chore(deps): bump bazel-contrib/setup-bazel from 0.8.1 to 0.8.3 by @dependabot in #359
  • chore(deps): bump codecov/codecov-action from 4.1.1 to 4.3.0 by @dependabot in #357
  • GraalVM 24.0.1 by @sgammon in #368

New Contributors

Full Changelog: v0.11.1...v0.11.2

v0.11.1

24 Jan 17:54
v0.11.1
55e93ca
Compare
Choose a tag to compare

Summary

This release applies inert fixes and updates to build tooling, as well as upgrades to GraalVM. The newest version is now supported (21.0.2), released last week (mid-January 2024).

0.11.1 includes @meteorcloudy's first contribution to the project. Thank you!

Installation

Via WORKSPACE.bazel:

http_archive(
    name = "rules_graalvm",
    sha256 = "e4fa275b062dcd03b1ecb02bb25f01ead512023006a874a5e0c2cb78ba6d8e73",
    strip_prefix = "rules_graalvm-0.11.1",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.11.0/rules_graalvm-0.11.1.zip",
    ],
)
load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")
graalvm_repository(
    name = "graalvm",
    distribution = "ce",  # `oracle`, `ce`, or `community`
    java_version = "21",  # `17`, `20`, or `21`, as supported by the version provided
    version = "21.0.1",  # earlier version format like `22.x` also supported
)
Artifact SHA256
rules_graalvm-0.11.1.zip e4fa275b062dcd03b1ecb02bb25f01ead512023006a874a5e0c2cb78ba6d8e73
rules_graalvm-0.11.1.tgz 0128b4a8664974689fadae56b517de627c5f42141925111baf05dc91c37af1c0

Or, via MODULE.bazel:

bazel_dep(name = "rules_graalvm", version = "0.11.0")
gvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm")

gvm.graalvm(
    name = "graalvm",
    version = "21.0.1",  # earlier version format like `22.x` also supported
    distribution = "ce",  # `oracle`, `ce`, or `community`
    java_version = "21",  # `17`, `20`, or `21`, as supported by the version provided
)
use_repo(gvm, "graalvm")
use_repo(gvm, "graalvm_toolchains")
register_toolchains("@graalvm_toolchains//:all")
Artifact Integrity value
rules_graalvm-0.11.1.zip sha256-5PonWwYtzQOx7LArsl8B6tUSAjAGqHSl4MLLeLptjnM=
rules_graalvm-0.11.1.tgz sha256-ASi0qGZJdGifra5WtRfeYnxfQhQZJREbrwXckcN68cA=

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_toolchains//:all")

To use the toolchain, add this to your .bazelrc:

build --extra_toolchains=@graalvm_toolchains//:toolchain
build --java_runtime_version=graalvm_21

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

This is a point release which only applies fixes, updates, and the latest versions of GraalVM.

What's Changed

New Contributors

Full Changelog: v0.11.0...v0.11.1

Release v0.11.0

08 Jan 20:36
v0.11.0
24cd52f
Compare
Choose a tag to compare

Summary

This release focuses on fixes/stability, and updates to support GraalVM for Java 21. The latest versions of Oracle GraalVM and GraalVM CE are both included and tested on all operating systems.

0.11.0 includes @vorburger's first contribution to the project. Thank you!

Installation

Via WORKSPACE.bazel:

http_archive(
    name = "rules_graalvm",
    sha256 = "f907041330f7eff8a0af1c19fdf936f0c8f8bc127cb52d5a1dde444784d9df54",
    strip_prefix = "rules_graalvm-0.11.0",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.11.0/rules_graalvm-0.11.0.zip",
    ],
)
load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")
graalvm_repository(
    name = "graalvm",
    distribution = "ce",  # `oracle`, `ce`, or `community`
    java_version = "21",  # `17`, `20`, or `21`, as supported by the version provided
    version = "21.0.1",  # earlier version format like `22.x` also supported
)
Artifact SHA256
rules_graalvm-0.11.0.zip f907041330f7eff8a0af1c19fdf936f0c8f8bc127cb52d5a1dde444784d9df54
rules_graalvm-0.11.0.tgz 07ee6451dd4fd78625b0f0d94b9df9bf673716bf9572a0ab24675bc052928f7a

Or, via MODULE.bazel:

bazel_dep(name = "rules_graalvm", version = "0.11.0")
gvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm")

gvm.graalvm(
    name = "graalvm",
    version = "21.0.1",  # earlier version format like `22.x` also supported
    distribution = "ce",  # `oracle`, `ce`, or `community`
    java_version = "21",  # `17`, `20`, or `21`, as supported by the version provided
)
use_repo(gvm, "graalvm")
use_repo(gvm, "graalvm_toolchains")
register_toolchains("@graalvm_toolchains//:all")
Artifact Integrity value
rules_graalvm-0.11.0.zip sha256-+QcEEzD37/igrxwZ/fk28Mj4vBJ8tS1aHd5ER4TZ31Q=
rules_graalvm-0.11.0.tgz sha256-B+5kUd1P14YlsPDZS535v2c3Fr+VcqCrJGdbwFKSj3o=

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_toolchains//:all")

To use the toolchain, add this to your .bazelrc:

build --extra_toolchains=@graalvm_toolchains//:toolchain
build --java_runtime_version=graalvm_21

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: 0.10.x series

  • The default_executable_name attribute and parameter has been renamed to executable_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 of native-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 than opt. Note that Bazel's default value of fastbuild also applies here, so passing no value at all will result in a behavior change (optfastbuild).

  • The order of options passed to native-image has changed.
    Attributes like extra_args now pass later on the command line (last, actually, for extra_args); because native-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 parameter use_default_shell_env is no longer passed to the underlying native-image compile action; instead, the toolchain environment is assembled for strict use. Native compiler environment variables like INCLUDE, LIB, DEVELOPER_DIR, and SDKROOT 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")

What's Changed

  • fix: replace remaining usage of versions.get() by @fmeum in #133
  • Clean up toolchain registration by @fmeum in #124
  • chore(deps): bump github/codeql-action from 2.21.5 to 2.21.7 by @dependabot in #135
  • chore(deps): bump actions/dependency-review-action from 3.0.8 to 3.1.0 by @dependabot in #117
  • chore(deps): bump actions/cache from 3.3.1 to 3.3.2 by @dependabot in #116
  • chore(deps): bump github/codeql-action from 2.21.7 to 2.21.8 by @dependabot in #136
  • chore(deps): bump org.graalvm.sdk:graal-sdk from 23.0.1 to 23.1.0 by @dependabot in #137
  • chore(deps): bump org.graalvm.nativeimage:svm from 23.0.1 to 23.1.0 by @dependabot in #138
  • chore(deps): bump org.graalvm.compiler:compiler from 23.0.1 to 23.1.0 by @dependabot in #139
  • chore(deps): bump org.graalvm.nativeimage:native-image-base from 23.0.1 to 23.1.0 by @dependabot in #140
  • fix: update skylib to fix Bazel version check for dev builds instead by @fmeum in #204
  • feat: add support for PGO by @fmeum in #205
  • chore(deps-dev): bump prettier from 3.0.3 to 3.1.1 by @dependabot in #203
  • chore(deps): bump github/codeql-action from 2.21.8 to 2.22.9 by @dependabot in #202
  • chore(deps): bump step-security/harden-runner from 2.5.1 to 2.6.1 by @dependabot in #195
  • chore(deps): bump ossf/scorecard-action from 2.2.0 to 2.3.1 by @dependabot in #177
  • chore(deps): bump advanced-security/maven-dependency-submission-action from 3.0.2 to 3.0.3 by @dependabot in #165
  • chore(deps-dev): bump @commitlint/config-conventional from 17.7.0 to 18.4.3 by @dependabot in #197
  • chore(deps-dev): bump lint-staged from 14.0.1 to 15.2.0 by @dependabot in #201
  • chore(deps): bump actions/checkout from 4.0.0 to 4.1.0 by @dependabot in #148
  • docs: Remove outdated reference to archive_override by @vorburger in #214
  • Chore: Dependency Updates by @sgammon in #218
  • fix: bin suffix for shared library targets by @sgammon in #217
  • Chore: Upgrade Bazel → 7.0.0 by @sgammon in #219
  • feat: support for latest gvm release → 23.1.0 / JVM 21 by @sgammon in #143
  • Chore: Release → 0.11.0 by @sgammon in #227

New Contributors

Full Changelog: v0.10.3...v0.11.0

Release v0.10.3

13 Sep 22:26
v0.10.3
f83e23d
Compare
Choose a tag to compare

Summary

This release adds a few features and fixes. See below for details. Please see the release notes from 0.10.1 for an exhaustive list of changes and features.

This release includes @ruwi-next's first contribution. Thank you! 🥳

Installation

Via WORKSPACE.bazel:

http_archive(
    name = "rules_graalvm",
    sha256 = "1f4b9979e75033042df4e9405a0a949aa5dd9427e72c8aafd8891d8f674e75e4",
    strip_prefix = "rules_graalvm-0.10.3",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.10.3/rules_graalvm-0.10.3.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.3.zip 1f4b9979e75033042df4e9405a0a949aa5dd9427e72c8aafd8891d8f674e75e4
rules_graalvm-0.10.3.tgz b846e46415d7b97881725a1d67c825120568ecfdf5f83cec4df0f7df5eae59ac

Or, via MODULE.bazel:

bazel_dep(name = "rules_graalvm", version = "0.10.3")
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")
use_repo(gvm, "graalvm_toolchains")
register_toolchains("@graalvm_toolchains//:all")
Artifact Integrity value
rules_graalvm-0.10.3.zip sha256-H0uZeedQMwQt9OlAWgqUmqXdlCfnLIqv2Ikdj2dOdeQ=
rules_graalvm-0.10.3.tgz sha256-uEbkZBXXuXiBclodZ8glEgVo7P31+DzsTfD3316uWaw=

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_toolchains//:all")

To use the toolchain, add this to your .bazelrc:

build --extra_toolchains=@graalvm_toolchains//: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, 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: 0.10.x series

  • The default_executable_name attribute and parameter has been renamed to executable_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 of native-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 than opt. Note that Bazel's default value of fastbuild also applies here, so passing no value at all will result in a behavior change (optfastbuild).

  • The order of options passed to native-image has changed.
    Attributes like extra_args now pass later on the command line (last, actually, for extra_args); because native-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 parameter use_default_shell_env is no longer passed to the underlying native-image compile action; instead, the toolchain environment is assembled for strict use. Native compiler environment variables like INCLUDE, LIB, DEVELOPER_DIR, and SDKROOT 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")

What's Changed

  • fix: Bazel version checks for dev versions by @fmeum in #128
  • fix(windows): added use_param_file for args by @sgammon in #132

Full Changelog: v0.10.2...v0.10.3

Release v0.10.2

11 Sep 09:51
v0.10.2
dae2e86
Compare
Choose a tag to compare

Summary

This is a fix release focused on the 0.10.x release series features, including lazy download of GraalVM toolchains. Please see the release notes from 0.10.1 for an exhaustive list of changes and features.

Installation

Via WORKSPACE.bazel:

http_archive(
    name = "rules_graalvm",
    sha256 = "b2dad731ac44ea122f295ba283f9949744c5f10180aedb36f9c7708b734f1250",
    strip_prefix = "rules_graalvm-0.10.2",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.10.2/rules_graalvm-0.10.2.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.2.zip b2dad731ac44ea122f295ba283f9949744c5f10180aedb36f9c7708b734f1250
rules_graalvm-0.10.2.tgz ddff3dcca8fd1506f8f06032c0c9f7860e691c98bb35691195e1cb46d59e85e4

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.2")
# Until we ship to BCR:
archive_override(
    module_name = "rules_graalvm",
    urls = ["https://github.com/sgammon/rules_graalvm/releases/download/v0.10.2/rules_graalvm-0.10.2.zip"],
    strip_prefix = "rules_graalvm-0.10.2",
    integrity = "sha256-strXMaxE6hIvKVuig/mUl0TF8QGArts2+cdwi3NPElA=",
)
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.2.zip sha256-strXMaxE6hIvKVuig/mUl0TF8QGArts2+cdwi3NPElA=
rules_graalvm-0.10.2.tgz sha256-3f89zKj9FQb48GAywMn3hg5pHJi7NWkRleHLRtWeheQ=

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: 0.10.x series

  • The default_executable_name attribute and parameter has been renamed to executable_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 of native-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 than opt. Note that Bazel's default value of fastbuild also applies here, so passing no value at all will result in a behavior change (optfastbuild).

  • The order of options passed to native-image has changed.
    Attributes like extra_args now pass later on the command line (last, actually, for extra_args); because native-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 parameter use_default_shell_env is no longer passed to the underlying native-image compile action; instead, the toolchain environment is assembled for strict use. Native compiler environment variables like INCLUDE, LIB, DEVELOPER_DIR, and SDKROOT 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")

What's Changed

  • fix!: restrict graalvm tag to the root module by @fmeum in #126
  • fix: remove module_ctx.extension_metadata by @fmeum in #125

Full Changelog: v0.10.1...v0.10.2

Release v0.10.1

08 Sep 07:49
v0.10.1
Compare
Choose a tag to compare

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:

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 to executable_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 of native-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 than opt. Note that Bazel's default value of fastbuild also applies here, so passing no value at all will result in a behavior change (optfastbuild).

  • The order of options passed to native-image has changed.
    Attributes like extra_args now pass later on the command line (last, actually, for extra_args); because native-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 parameter use_default_shell_env is no longer passed to the underlying native-image compile action; instead, the toolchain environment is assembled for strict use. Native compiler environment variables like INCLUDE, LIB, DEVELOPER_DIR, and SDKROOT 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:

Related solved issues:

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 @de...
Read more

Release v0.10.0

08 Sep 06:08
v0.10.0
c4c02a1
Compare
Choose a tag to compare

Warning

This release will be yanked as a result of some fingerprint issues that arose while publishing to BCR. The 0.10.1 release is otherwise identical.

Pre-Release: 0.10.0-rc1

08 Sep 04:48
v0.10.0-rc1
0b12c7c
Compare
Choose a tag to compare
Pre-release

Summary

This pre-release tests the release flow ahead of the 0.10.0 release. This release is pretty big and includes the following updates.

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 = None,  # varies
    strip_prefix = "rules_graalvm-0.10.0-rc1",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.10.0-rc1/rules_graalvm-0.10.0-rc1.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
)

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.0-rc1")
# Until we ship to BCR:
archive_override(
    module_name = "rules_graalvm",
    urls = ["https://github.com/sgammon/rules_graalvm/releases/download/v0.10.0-rc1/rules_graalvm-0.10.0-rc1.zip"],
    strip_prefix = "rules_graalvm-0.10.0-rc1",
    integrity = None,  # varies
)
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")

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.


PRs and issues

Mainline work:

Dependency updates:

Related solved issues:

Breaking changes

  • The default_executable_name attribute and parameter has been renamed to executable_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 of native-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 than opt. Note that Bazel's default value of fastbuild also applies here, so passing no value at all will result in a behavior change (optfastbuild).

  • The order of options passed to native-image has changed.
    Attributes like extra_args now pass later on the command line (last, actually, for extra_args); because native-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 parameter use_default_shell_env is no longer passed to the underlying native-image compile action; instead, the toolchain environment is assembled for strict use. Native compiler environment variables like INCLUDE, LIB, DEVELOPER_DIR, and SDKROOT 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")

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

Full Changelog: v0.9.2...v0.10.0-rc1

v0.9.2

26 Aug 09:07
v0.9.2
a71eb4a
Compare
Choose a tag to compare

Summary

This release focused on compatibility fixes for issues reported in:

Compatibility with rules_graal is now much smoother, with fewer changes required and previous versions of GraalVM under continuous test. Tests have been added for CE 17/20 and Oracle 17/20, as well as older versions of GraalVM and the previous use style of the rules.

Warning

Previous releases of this package defaulted the distribution attribute to oracle. This was unintended. In this new release, the distribution defaults to Community Edition. This is a breaking change.

Usage

Via WORKSPACE.bazel:

http_archive(
    name = "rules_graalvm",
    sha256 = "baf82fa979fe4c1c90fe676dfe80aea5a70bb6a8287c3d6d1d4418c0f3a3b2b2",
    strip_prefix = "rules_graalvm-0.9.2",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.9.2/rules_graalvm-0.9.2.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
)

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.2")
# Until we ship to BCR:
archive_override(
    module_name = "rules_graalvm",
    urls = ["https://github.com/sgammon/rules_graalvm/releases/download/v0.9.2/rules_graalvm-0.9.2.zip"],
    strip_prefix = "rules_graalvm-0.9.2",
    integrity = "sha256-uvgvqXn+TByQ/mdt/oCupacLtqgofD1tHUQYwPOjsrI=",
)
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//:all")

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//:all")

To use the toolchain, add this to your .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.

--

What's Changed

  • chore(deps): lock file maintenance by @renovate in #49
  • fix issues native image migration by @johnynek in #58
  • chore(deps): update dependency aspect_rules_js to v1.32.0 by @renovate in #42
  • fix: download urls, legacy rule compatibility by @sgammon in #61

New Contributors

Full Changelog: v0.9.1...v0.9.2

v0.9.1

23 Aug 02:14
v0.9.1
82344ab
Compare
Choose a tag to compare

Summary

This release focuses on:

  • Hermeticity improvements for Native Image compilation
  • Bazel-native downloads of GraalVM components
  • Toolchain-based native image actions
  • Script for producing artifact mappings

There is a new way to invoke the rules: now, the original rules for Native Image are made available at the familiar location, same as rules_graal. This should ease transition for previous users, who should not even need to change imports or targets now 🥳

Usage

Via WORKSPACE.bazel:

http_archive(
    name = "rules_graalvm",
    sha256 = "f41cc6ccdcacb5aeab7eb9f62223f1f570213b3fd0deeab386ef6188e35486ce",
    strip_prefix = "rules_graalvm-0.9.1",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.9.1/rules_graalvm-0.9.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
)

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.1")
# Until we ship to BCR:
archive_override(
    module_name = "rules_graalvm",
    urls = ["https://github.com/sgammon/rules_graalvm/releases/download/v0.9.1/rules_graalvm-0.9.1.zip"],
    strip_prefix = "rules_graalvm-0.9.1",
    integrity = "sha256-9BzGzNysta6rfrn2IiPx9XAhOz/Q3uqzhu9hiONUhs4=",
)
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")
register_toolchains("@graalvm//:all")

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//:all")

To use the toolchain, add this to your .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.

What's Changed

  • Tooling Improvements by @sgammon in #6
  • Tooling, Part 2 by @sgammon in #17
  • [StepSecurity] Apply security best practices by @step-security-bot in #22
  • chore(deps): bump ossf/scorecard-action from 2.0.6 to 2.2.0 by @dependabot in #14
  • chore(deps): bump advanced-security/maven-dependency-submission-action from 3.0.1 to 3.0.2 by @dependabot in #23
  • chore(deps): bump microsoft/setup-msbuild from 1.1.3 to 1.3.1 by @dependabot in #19
  • chore(deps): bump step-security/harden-runner from 2.5.0 to 2.5.1 by @dependabot in #16
  • chore(deps): update googleapis digest to c61daf8 by @renovate in #10
  • chore(deps): lock file maintenance by @renovate in #13
  • chore(deps-dev): bump prettier from 3.0.0 to 3.0.1 by @dependabot in #20
  • chore(deps): bump actions/dependency-review-action from 3.0.7 to 3.0.8 by @dependabot in #25
  • chore(deps): bump github/codeql-action from 2.21.3 to 2.21.4 by @dependabot in #26
  • fix(docs): move doc targets to docs root by @sgammon in #31
  • chore(deps-dev): bump prettier from 3.0.1 to 3.0.2 by @dependabot in #32
  • docs: add doc for binary targets by @sgammon in #33
  • Feature: Support for Bazel 6 by @sgammon in #34
  • Feature: Hermetic GraalVM by @sgammon in #35
  • chore(deps): update googleapis digest to 83585eb by @renovate in #39

New Contributors

Full Changelog: v0.9.0...v0.9.1