rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

Allow volatile and stable status info in `maven_coordinates`

Open AustinSchuh opened this issue 6 months ago • 4 comments

I'd like to be able to do something equivalent to:

maven_export(
    name = "wpiutil-java_publish",
    lib_name = "wpiutil-java",
    maven_coordinates = "edu.wpi.first.wpiutil:wpiutil-java:2025.424242.3.1-$(BUILD_TIMESTAMP)-$(BUILD_EMBED_LABEL)",
)

AustinSchuh avatar Jul 13 '25 05:07 AustinSchuh

Digging in to how other rule sets do this, rules_oci does this by using https://github.com/bazel-contrib/bazel-lib/blob/main/docs/expand_template.md to provide a file with the tags.

AustinSchuh avatar Jul 13 '25 05:07 AustinSchuh

Typically I've done this with a repo rule which stores this information is a constant, which can then be accessed from anywhere.

shs96c avatar Jul 13 '25 20:07 shs96c

That would work too. Do you have an example or a link to what starlark calls to use to do that? I tried to get access to those two files from starlark in a repo rule and failed. I kept learning that they are only available in actual rules, and even there, only as files.

AustinSchuh avatar Jul 13 '25 20:07 AustinSchuh

You may need to something funky like execute the workspace status script from the repo rule, capture the output, and do some processing of that.

shs96c avatar Jul 14 '25 16:07 shs96c