Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 5.41 KB

examples.md

File metadata and controls

76 lines (59 loc) · 5.41 KB

GraalVM + Bazel Examples

This codebase embeds some examples which are used for integration testing. You can find these at:

example/integration_tests

The following table explains each example. These can be used as starters for various Bazel versions with the latest copy of GraalVM CE.

Available examples

All examples are continuously tested in CI.

Path Bazel version(s) Rule type OS support Notes
bzlmod Bazel 5+ with Bzlmod Modern Linux, macOS, Windows Example Native Image build via Bzlmod
workspace Bazel 4+ with WORKSPACE Modern Linux, macOS, Windows Example Native Image build via Workspace
bazel4 Bazel 4 Legacy Linux, macOS Bazel 4 example project
bazel5 Bazel 5 Legacy Linux, macOS Bazel 5 example project
bazel6 Bazel 6 Modern Linux, macOS, Windows Bazel 6 example project
graalvm-ce-17 Bazel 7 Modern Linux, macOS, Windows Bazel 7 with GraalVM CE 17
graalvm-ce-20 Bazel 7 Modern Linux, macOS, Windows Bazel 7 with GraalVM CE 20
graalvm-oracle-17 Bazel 7 Modern Linux, macOS, Windows Bazel 7 with Oracle GraalVM 17
graalvm-oracle-20 Bazel 7 Modern Linux, macOS, Windows Bazel 7 with Oracle GraalVM 20
components-ce Bazel 7 N/A Linux, macOS, Windows Installing and using GraalVM CE components like js
components-oracle Bazel 7 N/A Linux, macOS, Windows Installing and using Oracle GraalVM components like js
maven-artifacts Bazel 7 N/A Linux, macOS, Windows Using GraalVM Maven artifacts with rules_jvm_external
legacy-gvm Bazel 7 with WORKSPACE Legacy Linux, macOS Example modern rules with older GraalVM version (22.1.0, Java 11)
legacy-rules Bazel 4+ with WORKSPACE Legacy Linux, macOS Example legacy rules with older GraalVM version (22.1.0, Java 11)

Specific version notes

See below for use notes with specific versions of bazel.

Bazel 4

Bazel 4 only supports a maximum of rules_java at version 4.0.0. See the bazel4 example for a working starter. You'll need to add this to your WORKSPACE.bazel:

http_archive(
    name = "rules_java",
    sha256 = "34b41ec683e67253043ab1a3d1e8b7c61e4e8edefbcad485381328c934d072fe",
    url = "https://github.com/bazelbuild/rules_java/releases/download/4.0.0/rules_java-4.0.0.tar.gz",
)

This either needs to come before the rules_graalvm_repositories call (so that the repo is already defined and therefore overrides), or you need to pass omit_rules_java like so:

load("@rules_graalvm//graalvm:workspace.bzl", "rules_graalvm_repositories")

rules_graalvm_repositories(omit_rules_java = True)

Bazel 5

Bazel 5 seems to have issues with the stricter build environment configurations offered by these rules. If you see issues with DEVELOPER_DIR on macOS, or issues resolving Visual Studio on Windows, you should try the legacy rules.