-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- feat: add struct which defines maven coordinates for well-known graalvm maven dependencies - feat: user-facing API to easily access these coordinates and declare them with `rules_jvm_external` Signed-off-by: Sam Gammon <sam@elide.ventures>
- Loading branch information
Showing
5 changed files
with
215 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<!-- Generated with Stardoc: http://skydoc.bazel.build --> | ||
|
||
Defines Maven helpers and coordinates for GraalVM artifacts. | ||
|
||
<a id="graalvm.artifact"></a> | ||
|
||
## graalvm.artifact | ||
|
||
<pre> | ||
graalvm.artifact(<a href="#graalvm.artifact-maven">maven</a>, <a href="#graalvm.artifact-artifact">artifact</a>, <a href="#graalvm.artifact-version">version</a>) | ||
</pre> | ||
|
||
Helper which declares a Maven artifact using `rules_jvm_external` macros for the provided inputs. | ||
|
||
Any struct can be provided as `artifact` which has the `artifact` and `group` properties. For | ||
convenience, well-known GraalVM artifact coordinates are available at `graalvm.catalog`. | ||
|
||
Example of use from `WORKSPACE.bazel`: | ||
|
||
```starlark | ||
load("@rules_jvm_external//:specs.bzl", "maven") | ||
load("@rules_graalvm//artifacts:maven.bzl", "graalvm") | ||
|
||
# ... | ||
graalvm.artifact( | ||
maven, | ||
artifact = graalvm.catalog.SDK, | ||
version = "23.0.1", | ||
) | ||
``` | ||
|
||
Example of use from Bzlmod: | ||
|
||
```starlark | ||
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") | ||
graalvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm") | ||
|
||
# ... | ||
graalvm.artifact( | ||
maven, | ||
artifact = graalvm.catalog.SDK, | ||
version = "23.0.1", | ||
) | ||
``` | ||
|
||
|
||
**PARAMETERS** | ||
|
||
|
||
| Name | Description | Default Value | | ||
| :------------- | :------------- | :------------- | | ||
| <a id="graalvm.artifact-maven"></a>maven | Maven artifact spawn struct provided by `rules_jvm_external`. | none | | ||
| <a id="graalvm.artifact-artifact"></a>artifact | Artifact to use from `MavenArtifacts`, or a `struct` with `artifact` and `group`. | none | | ||
| <a id="graalvm.artifact-version"></a>version | Version of the artifact to declare. | none | | ||
|
||
**RETURNS** | ||
|
||
Maven artifact specification. | ||
|
||
|
||
<a id="graalvm_maven_artifact"></a> | ||
|
||
## graalvm_maven_artifact | ||
|
||
<pre> | ||
graalvm_maven_artifact(<a href="#graalvm_maven_artifact-maven">maven</a>, <a href="#graalvm_maven_artifact-artifact">artifact</a>, <a href="#graalvm_maven_artifact-version">version</a>) | ||
</pre> | ||
|
||
Helper which declares a Maven artifact using `rules_jvm_external` macros for the provided inputs. | ||
|
||
Any struct can be provided as `artifact` which has the `artifact` and `group` properties. For | ||
convenience, well-known GraalVM artifact coordinates are available at `graalvm.catalog`. | ||
|
||
Example of use from `WORKSPACE.bazel`: | ||
|
||
```starlark | ||
load("@rules_jvm_external//:specs.bzl", "maven") | ||
load("@rules_graalvm//artifacts:maven.bzl", "graalvm") | ||
|
||
# ... | ||
graalvm.artifact( | ||
maven, | ||
artifact = graalvm.catalog.SDK, | ||
version = "23.0.1", | ||
) | ||
``` | ||
|
||
Example of use from Bzlmod: | ||
|
||
```starlark | ||
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") | ||
graalvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm") | ||
|
||
# ... | ||
graalvm.artifact( | ||
maven, | ||
artifact = graalvm.catalog.SDK, | ||
version = "23.0.1", | ||
) | ||
``` | ||
|
||
|
||
**PARAMETERS** | ||
|
||
|
||
| Name | Description | Default Value | | ||
| :------------- | :------------- | :------------- | | ||
| <a id="graalvm_maven_artifact-maven"></a>maven | Maven artifact spawn struct provided by `rules_jvm_external`. | none | | ||
| <a id="graalvm_maven_artifact-artifact"></a>artifact | Artifact to use from `MavenArtifacts`, or a `struct` with `artifact` and `group`. | none | | ||
| <a id="graalvm_maven_artifact-version"></a>version | Version of the artifact to declare. | none | | ||
|
||
**RETURNS** | ||
|
||
Maven artifact specification. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# Nothing at this time. | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
exports_files([ | ||
"maven.bzl", | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
"Defines Maven helpers and coordinates for GraalVM artifacts." | ||
|
||
# buildifier: disable=name-conventions | ||
_MavenArtifacts = struct( | ||
SDK = struct( | ||
artifact = "graal-sdk", | ||
group = "org.graalvm.sdk", | ||
), | ||
TRUFFLE = struct( | ||
artifact = "truffle-api", | ||
group = "org.graalvm.truffle", | ||
|
||
NFI = struct( | ||
artifact = "truffle-api", | ||
group = "org.graalvm.truffle", | ||
), | ||
), | ||
) | ||
|
||
def _graalvm_maven_artifact(maven, artifact, version): | ||
"""Helper which declares a Maven artifact using `rules_jvm_external` macros for the provided inputs. | ||
Any struct can be provided as `artifact` which has the `artifact` and `group` properties. For | ||
convenience, well-known GraalVM artifact coordinates are available at `graalvm.catalog`. | ||
Example of use from `WORKSPACE.bazel`: | ||
```starlark | ||
load("@rules_jvm_external//:specs.bzl", "maven") | ||
load("@rules_graalvm//artifacts:maven.bzl", "graalvm") | ||
# ... | ||
graalvm.artifact( | ||
maven, | ||
artifact = graalvm.catalog.SDK, | ||
version = "23.0.1", | ||
) | ||
``` | ||
Example of use from Bzlmod: | ||
```starlark | ||
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") | ||
graalvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm") | ||
# ... | ||
graalvm.artifact( | ||
maven, | ||
artifact = graalvm.catalog.SDK, | ||
version = "23.0.1", | ||
) | ||
``` | ||
Args: | ||
maven: Maven artifact spawn struct provided by `rules_jvm_external`. | ||
artifact: Artifact to use from `MavenArtifacts`, or a `struct` with `artifact` and `group`. | ||
version: Version of the artifact to declare. | ||
Returns: | ||
Maven artifact specification. | ||
""" | ||
|
||
return maven.artifact( | ||
artifact = artifact.artifact, | ||
group = artifact.group, | ||
version = version, | ||
) | ||
|
||
|
||
# buildifier: disable=name-conventions | ||
_MavenTools = struct( | ||
catalog = _MavenArtifacts, | ||
artifact = _graalvm_maven_artifact, | ||
) | ||
|
||
# Exports. | ||
|
||
# buildifier: disable=name-conventions | ||
graalvm = _MavenTools | ||
|
||
# buildifier: disable=name-conventions | ||
MavenArtifacts = _MavenArtifacts | ||
|
||
graalvm_maven_artifact = _graalvm_maven_artifact |