Skip to content

Commit

Permalink
fix: cleanup after rule internal refactor
Browse files Browse the repository at this point in the history
- fix: use legacy rules from legacy gvm
- chore: drop `MODULE-resolved.bzl`
- chore: update bzlmod lock
- chore: update lib/docs deps and rebuild docs
- chore: remove redundant calls in sample projects

Applied on top of #72

Signed-off-by: Sam Gammon <sam@elide.ventures>
  • Loading branch information
sgammon committed Sep 4, 2023
1 parent fa2979b commit a66caa0
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 632 deletions.
592 changes: 0 additions & 592 deletions MODULE-resolved.bzl

This file was deleted.

85 changes: 72 additions & 13 deletions MODULE.bazel.lock

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

6 changes: 2 additions & 4 deletions docs/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ stardoc(
out = "defs.md",
input = "//graalvm:defs.bzl",
deps = [
"//lib:tooling",
"//lib/nativeimage:internals",
"//lib/nativeimage:rules",
"@bazel_skylib//lib:new_sets",
"@bazel_skylib//lib:paths",
Expand Down Expand Up @@ -72,8 +70,8 @@ stardoc(
out = "legacy.md",
input = "//graal:graal.bzl",
deps = [
"//lib/nativeimage:internals",
"//lib/nativeimage:rules",
"//lib:tooling",
"//lib/nativeimage:classic",
"@bazel_skylib//lib:dicts",
"@bazel_skylib//lib:paths",
],
Expand Down
6 changes: 4 additions & 2 deletions docs/api/legacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Rules for building native binaries using the GraalVM `native-image` tool on Baze
<pre>
graal_binary(<a href="#graal_binary-name">name</a>, <a href="#graal_binary-deps">deps</a>, <a href="#graal_binary-main_class">main_class</a>, <a href="#graal_binary-include_resources">include_resources</a>, <a href="#graal_binary-reflection_configuration">reflection_configuration</a>, <a href="#graal_binary-jni_configuration">jni_configuration</a>,
<a href="#graal_binary-initialize_at_build_time">initialize_at_build_time</a>, <a href="#graal_binary-initialize_at_run_time">initialize_at_run_time</a>, <a href="#graal_binary-native_features">native_features</a>, <a href="#graal_binary-data">data</a>, <a href="#graal_binary-extra_args">extra_args</a>,
<a href="#graal_binary-check_toolchains">check_toolchains</a>, <a href="#graal_binary-c_compiler_option">c_compiler_option</a>, <a href="#graal_binary-default_executable_name">default_executable_name</a>, <a href="#graal_binary-kwargs">kwargs</a>)
<a href="#graal_binary-check_toolchains">check_toolchains</a>, <a href="#graal_binary-c_compiler_option">c_compiler_option</a>, <a href="#graal_binary-default_executable_name">default_executable_name</a>, <a href="#graal_binary-native_image_tool">native_image_tool</a>, <a href="#graal_binary-kwargs">kwargs</a>)
</pre>

Alias for the renamed `native_image` rule. Identical.
Expand All @@ -33,6 +33,7 @@ Alias for the renamed `native_image` rule. Identical.
| <a id="graal_binary-check_toolchains"></a>check_toolchains | Whether to perform toolchain checks in `native-image`; defaults to `True` on Windows, `False` otherwise. | `select({"@bazel_tools//src/conditions:windows": True, "//conditions:default": False})` |
| <a id="graal_binary-c_compiler_option"></a>c_compiler_option | Extra C compiler options to pass through `native-image`. No default; optional. | `[]` |
| <a id="graal_binary-default_executable_name"></a>default_executable_name | Set the name of the output binary; defaults to `%target%-bin`, or `%target%-bin.exe` on Windows. The special string `%target%`, if present, is replaced with `name`. | `select({"@bazel_tools//src/conditions:windows": "%target%-bin.exe", "//conditions:default": "%target%-bin"})` |
| <a id="graal_binary-native_image_tool"></a>native_image_tool | Specific `native-image` executable target to use. | `Label("@graalvm//:native-image")` |
| <a id="graal_binary-kwargs"></a>kwargs | Extra keyword arguments are passed to the underlying `native_image` rule. | none |


Expand All @@ -43,7 +44,7 @@ Alias for the renamed `native_image` rule. Identical.
<pre>
native_image(<a href="#native_image-name">name</a>, <a href="#native_image-deps">deps</a>, <a href="#native_image-main_class">main_class</a>, <a href="#native_image-include_resources">include_resources</a>, <a href="#native_image-reflection_configuration">reflection_configuration</a>, <a href="#native_image-jni_configuration">jni_configuration</a>,
<a href="#native_image-initialize_at_build_time">initialize_at_build_time</a>, <a href="#native_image-initialize_at_run_time">initialize_at_run_time</a>, <a href="#native_image-native_features">native_features</a>, <a href="#native_image-data">data</a>, <a href="#native_image-extra_args">extra_args</a>,
<a href="#native_image-check_toolchains">check_toolchains</a>, <a href="#native_image-c_compiler_option">c_compiler_option</a>, <a href="#native_image-default_executable_name">default_executable_name</a>, <a href="#native_image-kwargs">kwargs</a>)
<a href="#native_image-check_toolchains">check_toolchains</a>, <a href="#native_image-c_compiler_option">c_compiler_option</a>, <a href="#native_image-default_executable_name">default_executable_name</a>, <a href="#native_image-native_image_tool">native_image_tool</a>, <a href="#native_image-kwargs">kwargs</a>)
</pre>

Generates and compiles a GraalVM native image from a Java library target.
Expand All @@ -67,6 +68,7 @@ Generates and compiles a GraalVM native image from a Java library target.
| <a id="native_image-check_toolchains"></a>check_toolchains | Whether to perform toolchain checks in `native-image`; defaults to `True` on Windows, `False` otherwise. | `select({"@bazel_tools//src/conditions:windows": True, "//conditions:default": False})` |
| <a id="native_image-c_compiler_option"></a>c_compiler_option | Extra C compiler options to pass through `native-image`. No default; optional. | `[]` |
| <a id="native_image-default_executable_name"></a>default_executable_name | Set the name of the output binary; defaults to `%target%-bin`, or `%target%-bin.exe` on Windows. The special string `%target%`, if present, is replaced with `name`. | `select({"@bazel_tools//src/conditions:windows": "%target%-bin.exe", "//conditions:default": "%target%-bin"})` |
| <a id="native_image-native_image_tool"></a>native_image_tool | Specific `native-image` executable target to use. | `Label("@graalvm//:native-image")` |
| <a id="native_image-kwargs"></a>kwargs | Extra keyword arguments are passed to the underlying `native_image` rule. | none |


7 changes: 4 additions & 3 deletions docs/api/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ target tool in your `native_image` binary targets.
## rules_graalvm_repositories

<pre>
rules_graalvm_repositories(<a href="#rules_graalvm_repositories-omit_rules_java">omit_rules_java</a>, <a href="#rules_graalvm_repositories-omit_bazel_skylib">omit_bazel_skylib</a>)
rules_graalvm_repositories(<a href="#rules_graalvm_repositories-omit_rules_java">omit_rules_java</a>, <a href="#rules_graalvm_repositories-omit_bazel_skylib">omit_bazel_skylib</a>, <a href="#rules_graalvm_repositories-omit_apple_support">omit_apple_support</a>)
</pre>

Register dependency repositories for the GraalVM Rules for Bazel.

This function only needs to be called if consuming the GraalVM Rules from a non-Bzlmod environment.
The only dependencies the rules have are: (1) `rules_java`, and (2) `bazel_skylib`. Either or both
can be omitted with the provided arguments.
The only dependencies the rules have are: (1) `rules_java`, (2) `bazel_skylib`, and
(3) `apple_support`. Any of those can be omitted with the provided arguments.


**PARAMETERS**
Expand All @@ -52,5 +52,6 @@ can be omitted with the provided arguments.
| :------------- | :------------- | :------------- |
| <a id="rules_graalvm_repositories-omit_rules_java"></a>omit_rules_java | Omit the `rules_java` dependency. | `False` |
| <a id="rules_graalvm_repositories-omit_bazel_skylib"></a>omit_bazel_skylib | Omit the `bazel_skylib` dependency. | `False` |
| <a id="rules_graalvm_repositories-omit_apple_support"></a>omit_apple_support | Omit the `apple_support` dependency. | `False` |


2 changes: 1 addition & 1 deletion docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ All examples are continuously tested in CI.
| [`graalvm-ce-20`][9] | Bazel 7 | [Modern][1] | Linux, macOS, Windows | Bazel 7 with GraalVM CE 20 |
| [`graalvm-oracle-17`][10] | Bazel 7 | [Modern][1] | Linux, macOS, Windows | Bazel 7 with Oracle GraalVM 17 |
| [`graalvm-oracle-20`][11] | Bazel 7 | [Modern][1] | Linux, macOS, Windows | Bazel 7 with Oracle GraalVM 20 |
| [`legacy-gvm`][12] | Bazel 7 with WORKSPACE | [Modern][1] | Linux, macOS, Windows | Example **modern rules** with older GraalVM version (`22.1.0`, Java 11) |
| [`legacy-gvm`][12] | Bazel 7 with WORKSPACE | [Legacy][2] | Linux, macOS | Example **modern rules** with older GraalVM version (`22.1.0`, Java 11) |
| [`legacy-rules`][13] | Bazel 4+ with WORKSPACE | [Legacy][2] | Linux, macOS | Example **legacy rules** with older GraalVM version (`22.1.0`, Java 11) |

### Specific version notes
Expand Down
2 changes: 0 additions & 2 deletions example/integration_tests/bazel4/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ register_graalvm_toolchains()

load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")

rules_graalvm_repositories()

graalvm_repository(
name = "graalvm",
distribution = "oracle",
Expand Down
2 changes: 0 additions & 2 deletions example/integration_tests/bazel5/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ register_graalvm_toolchains()

load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")

rules_graalvm_repositories()

graalvm_repository(
name = "graalvm",
distribution = "oracle",
Expand Down
2 changes: 0 additions & 2 deletions example/integration_tests/bazel6/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ register_graalvm_toolchains()

load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")

rules_graalvm_repositories()

graalvm_repository(
name = "graalvm",
distribution = "oracle",
Expand Down
Loading

0 comments on commit a66caa0

Please sign in to comment.