bazelbuild / bazelbuild/rules_android

Supporting neverlink for aar_import

Open
#315 3 comments 1 reaction 0 assignees View on GitHub
P2
Dominant language
Java
Stars
203
Forks
95
PR merge metrics
No merged PRs in 30d

Description

### Description of the feature request:

It'd be great if aar_import would support the neverlink option, the same as in android_library.

[For context, neverlink is analogous to the (somewhat better named?) C++ option, cc_import.system_provided, and means that a library is used during compilation, but not bundled in a binary. You still do the equivalent of linking against it, but you need it to model the idea of libraries provided at runtime.]

### Feature requests: what underlying problem are you trying to solve with this feature?

This would fix an issue in rules_jvm_external, where AARs from Maven break when marked as neverlink. See https://github.com/bazelbuild/rules_jvm_external/issues/535

This would also be useful for supporting building distributable libraries with Bazel, where you want to avoid bundling other libraries that should be instead pulled from Maven as dependencies.

More generally, it would support the compile-only dependency pattern, used reasonably heavily in Java-land. Presumably that's why the option was added to android_library, but I'd argue it's at least as useful to folks in aar_import.

### Any other information, logs, or outputs that you want to share?

You could work around the issue by wrapping the aar_import with an android_library that has neverlink on and exports the aar_import....but neverlink itself is broken in meaningful ways. See https://github.com/bazelbuild/rules_android/issues/316. That issue would need to be fixed first to be useful in many cases, but needn't necessary block this first.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.