bazel-contrib / rules_jvm_external

Bazel rules to resolve, fetch and export Maven artifacts
Apache License 2.0
337 stars 256 forks source link

Add support for resources in javadoc jars and make variable substitution in javadoc arguments #1238

Closed vinnybod closed 2 months ago

vinnybod commented 2 months ago

Note: This is a dupe of https://github.com/bazelbuild/rules_jvm_external/pull/1182 . I had to reopen the PR from a different GH org.


There's two use cases I'm trying to account for here.

  1. I need to add resources to the javadoc jar such as a LICENSE file.
  2. I need to send a --define variable to the javadoc generator so that the maven_version variable I have set will appear in the <title> of the generated html. rules_jvm_external already supports the same type of substitution on the coordinates attribute.
java_export(
    name = "lib",
    maven_coordinates="com.example:lib:$(maven_version)",
    ...
    javadocopts=["-windowtitle", "$(maven_version)"],
    doc_resources = ["//:LICENSE"]
)
vinnybod commented 2 months ago

@shs96c Made the suggested changes, this is ready for another review. Thanks!