bazel-distribution
bazel-distribution copied to clipboard
Android library publishing support
What is the goal of this PR?
Add publishing support for android_library
targets (#233)
What are the changes implemented in this PR?
First, the rules, assemblers, and scripts need to take into account other packaging types. Determining the packaging type and passing that info along via the providers was the necessary first step.
Second, the JarAssembler.kt
file only supported packaging a JAR
. Rather than duplicate the script for AAR
support, I added support directly in that file to reuse a lot of the same logic used to assemble JAR
s. There is one TODO left surrounding duplicate entries, but I believe that might be something related to my specific project.
Third, handling the Android SDK and neverlink dependencies. In order to be able to perform the aggregate_dependency_info
aspect, the Android SDK target needed to be handled. It is a specific rule type baked into the Bazel codebase. I wasn't really sure how to determine the rule type within the aspect, so I just hardcoded the label as something to ignore (gross, I know). Additionally, a third party ruleset I use for databinding support had an additional java_library
that captured the Android SDK. Luckily, this was marked as neverlink
, so I was able to key off of that attribute to avoid capturing the Android SDK from that target in the transitive closure. That should be a decent strategy to follow since the artifacts we're assembling probably shouldn't include neverlink
dependencies that were just used to compile.
Apologies for the delay. I'll be able to revisit this PR in a little while. Just want to reassure that it is my goal to get this merged to help provide broader publishing support to the community 😄