Skip to content

Release v0.11.0

Compare
Choose a tag to compare
@sgammon sgammon released this 08 Jan 20:36
· 101 commits to main since this release
v0.11.0
24cd52f

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