Reputation: 2054
As part of our efforts to create a bazel-maven transition interop tool (that creates maven sized jars from more granular sized bazel jars),
we want the aspect
that runs on bazel build
to access the target's java_common.provider
in order to fetch the jars and ijars from it.
Is that possible?
Upvotes: 1
Views: 458
Reputation: 131
The short answer is yes, that's possible.
You can use the java_common
module in an aspect implementation the same way you would use it in a rule implementation.
From the documentation on java_common.provider:
java_common.provider.compile_jars
and java_common.provider.transitive_compile_time_jars
refer to the ijars used at compilation timejava_common.provider.transitive_runtime_jars
refer to the full jars used at runtime. The full jars at compilation time are not yet available, but someone is working on exposing this feature. (Issue #3528 on GitHub.)
Make sure you also read the blog post on this topic: https://blog.bazel.build/2017/03/07/java-sandwich.html
Upvotes: 3