bazelbuild / bazelbuild/rules_android
Android + data-binding: binding adapters aren't reusable across android_library boundaries
- Dominant language
- Java
- Stars
- 203
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
### Description of the problem:
When building an Android project with data-binding enabled, metadata about binding adapters don't seem to be shared across ``android_library`` boundaries in some circumstances.
### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- Setup an Android project with data-binding
- Create an ``android_library`` that contains a bindable adapter, but doesn't use it
- Create an ``android_library`` with resources that use the other binding adapter, and that depends on the other library target
- Observe that building this project results in errors when processing the layout files
Or, just build the following project:
[demo-project-java-dagger-databinding.zip](https://github.com/bazelbuild/bazel/files/4904510/demo-project-java-dagger-databinding.zip)
### What operating system are you running Bazel on?
Ubuntu
### What's the output of `bazel info release`?
``development version``
### If `bazel info release` returns "development version" or "(@non-git)", tell us how you built Bazel.
``bazel build //src:bazel //tools/android/runtime_deps:android_tools.tar.gz`` for locally checked out Bazel (git hash: ``82e6b6a3b9589b93f4abcf3eb0f14cd1d50008ff``). This is needed since recently submitted data-binding functionality hasn't yet been included in a public release of Bazel.
### What's the output of `git remote get-url origin ; git rev-parse master ; git rev-parse HEAD` ?
```
https://github.com/bazelbuild/bazel.git
82e6b6a3b9589b93f4abcf3eb0f14cd1d50008ff
82e6b6a3b9589b93f4abcf3eb0f14cd1d50008ff
```
### Have you found anything relevant by searching the web?
No--this was filed in conjunction with an ongoing discussion with @ahumesky.
### Any other information, logs, or outputs that you want to share?
The error log when building the demo project includes:
```
ERROR: Cannot find a setter for that accepts parameter type 'java.lang.String'
If a binding adapter provides the setter, check that the adapter is annotated correctly and that the parameter type matches.
```
Note that merging the binding adapter library with the corresponding databinding library that uses it results in a project that cleanly builds.
Contributor guide
Assessment
This issue has not been assessed yet.