Skip to content

Commit

Permalink
fix: unstable download urls for latest gvm
Browse files Browse the repository at this point in the history
- feat: ability to specify `latest` for gvm version
- fix: always use archive urls for oracle graalvm
- chore: issue mappings for latest oracle graalvm
- chore: issue mappings for latest graalvm ce

Thanks to @develar for his help via #504
Fixes and closes #521

Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Dec 18, 2024
1 parent 9a06f3c commit b20deef
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 39 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/module.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ jobs:
labs: false
skip: false

# Test: Bazel 7
- label: Bazel 7
target: sample
action: build
directory: "./example/integration_tests/bazel7"
labs: false
skip: false

# Test: Inert
- label: Inert
target: sample
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# GraalVM Rules for Bazel

![Bazel 7](https://img.shields.io/badge/Bazel%207-black?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0My41NyA0My4zNyI%2BCiAgPGRlZnM%2BCiAgICA8c3R5bGU%2BCiAgICAgIC5jbHMtMSB7CiAgICAgICAgZmlsbDogIzAwNDMwMDsKICAgICAgfQoKICAgICAgLmNscy0yIHsKICAgICAgICBmaWxsOiAjMDA3MDFhOwogICAgICB9CgogICAgICAuY2xzLTMgewogICAgICAgIGZpbGw6ICM0M2EwNDc7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogIzc2ZDI3NTsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM%2BCiAgPGcgaWQ9Ik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0xMC45TDMyLjY4LDBsMTAuODksMTAuODktMTAuODksMTAuOVoiLz4KICA8L2c%2BCjwvc3ZnPg%3D%3D&logoColor=gray)
![Bazel 8](https://img.shields.io/badge/Bazel%207-black?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0My41NyA0My4zNyI%2BCiAgPGRlZnM%2BCiAgICA8c3R5bGU%2BCiAgICAgIC5jbHMtMSB7CiAgICAgICAgZmlsbDogIzAwNDMwMDsKICAgICAgfQoKICAgICAgLmNscy0yIHsKICAgICAgICBmaWxsOiAjMDA3MDFhOwogICAgICB9CgogICAgICAuY2xzLTMgewogICAgICAgIGZpbGw6ICM0M2EwNDc7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogIzc2ZDI3NTsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM%2BCiAgPGcgaWQ9IkxheWVyXzEtMiIgZGF0YS1uYW1lPSJMYXllciAxIj4KICAgIDxwYXRoIGNsYXNzPSJjbHMtMiIgZD0ibTIxLjc4LDMyLjY4djEwLjY5bC0xMC44OS0xMC44OXYtMTAuNjlsMTAuODksMTAuODlaIi8%2BCiAgICA8cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Im0yMS43OCwzMi42OGwxMC45LTEwLjg5djEwLjY5bC0xMC45LDEwLjg5di0xMC42OVoiLz4KICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0ibTEwLjg5LDIxLjc5djEwLjY5TDAsMjEuNTh2LTEwLjY5bDEwLjg5LDEwLjlaIi8%2BCiAgICA8cGF0aCBjbGFzcz0iY2xzLTMiIGQ9Im00My41NywxMC44OXYxMC42OWwtMTAuODksMTAuOXYtMTAuNjlsMTAuODktMTAuOVoiLz4KICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0ibTIxLjc4LDMyLjY4bC0xMC44OS0xMC44OSwxMC44OS0xMC45LDEwLjksMTAuOS0xMC45LDEwLjg5WiIvPgogICAgPHBhdGggY2xhc3M9ImNscy00IiBkPSJtMTAuODksMjEuNzlMMCwxMC44OSwxMC44OSwwbDEwLjg5LDEwLjg5LTEwLjg5LDEwLjlaIi8%2BCiAgICA8cGF0aCBjbGFzcz0iY2xzLTQiIGQ9Im0zMi42OCwyMS43OWwtMTAuOS0xMC45TDMyLjY4LDBsMTAuODksMTAuODktMTAuODksMTAuOVoiLz4KICA8L2c%2BCjwvc3ZnPg%3D%3D&logoColor=gray)
[![CI](https://github.com/sgammon/rules_graalvm/actions/workflows/on.push.yml/badge.svg)](https://github.com/sgammon/rules_graalvm/actions/workflows/on.push.yml)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4-ff69b4.svg)](CODE_OF_CONDUCT.md)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8287/badge)](https://www.bestpractices.dev/projects/8287)
Expand All @@ -24,8 +23,8 @@ Use [GraalVM](https://graalvm.org) with [Bazel](https://bazel.build) to:
- [Example projects for all use cases](./docs/examples.md)
- [Hermetic compilation on all platforms](./docs/hermeticity.md)
- [Run tools from GraalVM directly](./docs/binary-targets.md)
- [Support for Bazel 6, Bazel 7, and Bzlmod](./docs/modern-bazel.md)
- [Support for Bazel 4 and Bazel 5, drop-in replacement for `rules_graal`](./legacy-bazel.md)
- [Support for Bazel 6-8 (Bzlmod)](./docs/modern-bazel.md)
- [Support for Bazel 4+, drop-in replacement for `rules_graal`](./legacy-bazel.md)
- Support for macOS, Linux, Windows (including Native Image!) ([support matrix](./docs/modern-bazel.md))
- Support for the latest modern GraalVM releases (Community Edition and Oracle GraalVM)

Expand Down
1 change: 0 additions & 1 deletion example/integration_tests/bzlmod/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ build --java_runtime_version=21
build --extra_toolchains=@graalvm//:toolchain
build --extra_toolchains=@graalvm//:toolchain_gvm
build --extra_toolchains=@graalvm//:bootstrap_runtime_toolchain
build --toolchain_resolution_debug='@@bazel_tools//tools/jdk:toolchain_type'
4 changes: 2 additions & 2 deletions example/integration_tests/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ gvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm")
gvm.graalvm(
name = "graalvm",
distribution = "ce",
java_version = "21",
version = "23.0.0",
java_version = "23",
version = "23.0.1",
)
use_repo(
gvm,
Expand Down
10 changes: 5 additions & 5 deletions example/integration_tests/bzlmod/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions internal/graalvm_bindist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ load(
"VmReleaseVersions",
"VmReleaseVersionsOracle",
"resolve_distribution_artifact",
"resolve_version_pair",
Component = "DistributionComponent",
Distribution = "DistributionType",
)
Expand Down Expand Up @@ -267,9 +268,12 @@ def _graal_bindist_repository_impl(ctx):

else:
platform, os, archive = _get_platform(ctx, True)
version = ctx.attr.version
version_spec = ctx.attr.version
distribution = ctx.attr.distribution or Distribution.COMMUNITY
java_version = ctx.attr.java_version
java_version_spec = ctx.attr.java_version

# resolves potentially symbolic version strings
(java_version, version) = resolve_version_pair(java_version_spec, version_spec)

# new gvm distribution check
_check_version(version, java_version, True)
Expand All @@ -286,9 +290,7 @@ def _graal_bindist_repository_impl(ctx):
fail("Cannot find distribution name for GraalVM: " + ctx.attr.distribution)

# resolve & download vm
dist_tag = "{dist}-{version}".format(dist = dist_name, version = ctx.attr.version)
version = ctx.attr.version
java_version = ctx.attr.java_version
dist_tag = "{dist}-{version}".format(dist = dist_name, version = version)
format_args = {
"version": version,
"platform": platform,
Expand All @@ -302,7 +304,7 @@ def _graal_bindist_repository_impl(ctx):
platform,
version,
java_version,
strict = False,
strict = True,
)
if config == None:
fail("Unable to locate GraalVM distribution '%s' at version '%s' for platform '%s'" % (
Expand Down
Loading

0 comments on commit b20deef

Please sign in to comment.