Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(toolchain): add alias indirection for gvm toolchain #82

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 40 additions & 24 deletions .github/workflows/module.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,46 @@ jobs:
labs: false
skip: false

# Test: Bazel 4
- label: Bazel 4
target: sample
action: build
directory: "./example/integration_tests/bazel4"
labs: false
skip: ${{ contains(inputs.runner, 'windows') }}

# Test: Bazel 5
- label: Bazel 5
target: sample
action: build
directory: "./example/integration_tests/bazel5"
labs: false
skip: ${{ contains(inputs.runner, 'windows') }}

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

# Test: Inert
- label: Inert
target: sample
action: build
directory: "./example/integration_tests/inert"
labs: false
skip: false

# Test: Inert Workspace
- label: Inert Workspace
target: sample
action: build
directory: "./example/integration_tests/inert-workspace"
labs: false
skip: false

# Test: Legacy Rules
- label: Legacy Rules
target: sample
Expand Down Expand Up @@ -243,30 +283,6 @@ jobs:
labs: false
skip: false

# Test: Bazel 4
- label: Bazel 4
target: sample
action: build
directory: "./example/integration_tests/bazel4"
labs: false
skip: ${{ contains(inputs.runner, 'windows') }}

# Test: Bazel 5
- label: Bazel 5
target: sample
action: build
directory: "./example/integration_tests/bazel5"
labs: false
skip: ${{ contains(inputs.runner, 'windows') }}

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

steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/on.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ name: "PR"
"on":
## Run on PR filings
pull_request:
branches:
- main
paths:
- docs/**/*.*
- example/**/*.*
Expand Down
6 changes: 5 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ use_repo(
)

register_toolchains(
"@graalvm//:all",
"@graalvm//:jvm",
dev_dependency = True,
)
register_toolchains(
"@graalvm//:sdk",
dev_dependency = True,
)

Expand Down
25 changes: 13 additions & 12 deletions MODULE.bazel.lock

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

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ gvm.graalvm(
],
)
use_repo(gvm, "graalvm")
register_toolchains("@graalvm//:all")
register_toolchains("@graalvm//:jvm")
register_toolchains("@graalvm//:sdk")
```

## Usage: Java Toolchains
Expand All @@ -121,7 +122,8 @@ register_graalvm_toolchains()
**Via Bzlmod:**

```starlark
register_toolchains("@graalvm//:all")
register_toolchains("@graalvm//:jvm")
register_toolchains("@graalvm//:sdk")
```

**To _use_ the toolchain, add this to your `.bazelrc`:**
Expand Down
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ gvm.graalvm(
],
)
use_repo(gvm, "graalvm")
register_toolchains("@graalvm//:all")
register_toolchains("@graalvm//:jvm")
register_toolchains("@graalvm//:sdk")
```

## Usage
Expand Down
3 changes: 2 additions & 1 deletion docs/modern-bazel.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")

# graalvm_repository(name = "graalvm" ...)

register_toolchains("@graalvm//:all")
register_toolchains("@graalvm//:jvm")
register_toolchains("@graalvm//:sdk")
```

### Installation in `WORKSPACE.bazel`
Expand Down
3 changes: 2 additions & 1 deletion example/integration_tests/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ use_repo(
"graalvm",
)

register_toolchains("@graalvm//:all")
register_toolchains("@graalvm//:jvm")
register_toolchains("@graalvm//:sdk")
3 changes: 2 additions & 1 deletion example/integration_tests/bzlmod/MODULE.bazel.lock

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

1 change: 1 addition & 0 deletions example/integration_tests/inert-workspace/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Nothing at thie time.
1 change: 1 addition & 0 deletions example/integration_tests/inert-workspace/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0-pre.20230816.3
1 change: 1 addition & 0 deletions example/integration_tests/inert-workspace/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel-*
19 changes: 19 additions & 0 deletions example/integration_tests/inert-workspace/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
workspace(name = "rules_graalvm_sample")

local_repository(
name = "rules_graalvm",
path = "../../..",
)

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

rules_graalvm_repositories()

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

graalvm_repository(
name = "graalvm",
distribution = "ce",
java_version = "20",
version = "20.0.2",
)
17 changes: 17 additions & 0 deletions example/integration_tests/inert-workspace/sample/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
java_library(
name = "java",
srcs = ["Main.java"],
)

java_binary(
name = "main",
main_class = "Main",
runtime_deps = [
":java",
],
)

alias(
name = "sample",
actual = "main",
)
5 changes: 5 additions & 0 deletions example/integration_tests/inert-workspace/sample/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Main {
public static void main(String args[]) {
System.out.println("Hello, GraalVM!");
}
}
1 change: 1 addition & 0 deletions example/integration_tests/inert/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --enable_bzlmod
1 change: 1 addition & 0 deletions example/integration_tests/inert/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0-pre.20230816.3
27 changes: 27 additions & 0 deletions example/integration_tests/inert/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"Sample bzlmod-style project which uses the GraalVM Rules for Bazel."

module(
name = "rules_graalvm_bzlmod_sample",
version = "0.0.1",
)

bazel_dep(
name = "rules_java",
version = "6.5.0",
)
bazel_dep(
name = "rules_graalvm",
version = "0.0.0",
)
local_path_override(
module_name = "rules_graalvm",
path = "../../..",
)

gvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm")
gvm.graalvm(
name = "graalvm",
distribution = "ce",
java_version = "20",
version = "20.0.2",
)
Loading
Loading