rules_jvm_external
rules_jvm_external copied to clipboard
neverlink errors for AARs
First and foremost, thanks for such a useful set of rules!
I was using this for an Android project and noticed an edge case that I thought I should give a heads up about: Neverlink doesn't seem to work Maven AARs.
As a minimal example, I've got:
maven_install(
artifacts = [
maven.artifact("com.facebook.fbjni", "fbjni", "0.2.0", neverlink = True),
],
repositories = [
"https://jcenter.bintray.com/",
],
)
And the error is @maven//:com_facebook_fbjni_fbjni: no such attribute 'neverlink' in 'aar_import' rule
. Indeed checking the generated BUILD file, you see neverlink added to the aar_import rule.
A good workaround might be to wrap the aar_import rule in an android_library, which supports neverlink. Alternatively, and probably better, neverlink support could be added to aar_import?
Tagging @jin, because it looks like he was the original author.
I checked with @ahumesky and there isn't nothing particularly blocking to implement neverlink in aar_import. Feel free to open an issue in the core bazel repository!
In the mean time, I'm open to accepting a PR (with tests) that goes with the first approach, since that wouldn't require a Bazel release.
Sounds good. Will do on the issue.
[May come back on the PR, but it turns out that neverlink itself is broken in ways that make it unusable. See https://github.com/bazelbuild/bazel/issues/13216]