aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar dbabkin <dbabkin@google.com>2018-04-13 05:44:19 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-13 05:45:32 -0700
commit8738794b0497e240c9b41faefe46a7e790fc0ab7 (patch)
tree439a8b4d999466712ba5c7869229663cd9ef6546 /src/main/java
parentb2711713bc8d41301b114f2ce3ae346812a6b8fa (diff)
Automated rollback of commit 7edc5d49c8e764ab2bdf19e3a9fb58ea30fa708f.
*** Reason for rollback *** b/77997997 *** Original change description *** Remove the Blaze strict java deps exemption for Android databinding. Use the JavaBuilder processor exemption list instead of disabling strict deps for the affected rules outright. This narrows the degree to which the exemption is applied, and prevents other strict deps violations from accruing on targets that enable databinding. PiperOrigin-RevId: 192755946
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
index 8299b129da..3afc7687d7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
@@ -573,7 +573,19 @@ public class AndroidCommon {
javaCommon.getJavacOpts(),
attributes,
useDataBinding ? DataBinding.processDeps(ruleContext) : ImmutableList.<Artifact>of(),
- /*disableStrictDeps=*/ false);
+ /* We have to disable strict deps checking with data binding because data binding
+ * propagates layout XML up the dependency chain. Say a library's XML references a Java
+ * class, e.g.: "<variable type="some.package.SomeClass" />". Data binding's annotation
+ * processor triggers a compile against SomeClass. Because data binding reprocesses
+ * bindings each step up the dependency chain (via merged resources), that means this
+ * compile also happens at the top-level binary. Since SomeClass.java is declared in the
+ * library, this creates a strict deps violation.
+ *
+ * This weakening of strict deps is unfortunate and deserves to be fixed. Once data
+ * binding integrates with aapt2 this problem should naturally go away (since
+ * reprocessing will no longer happen).
+ */
+ /*disableStrictDeps=*/ useDataBinding);
helper.addLibrariesToAttributes(javaCommon.targetsTreatedAsDeps(ClasspathType.COMPILE_ONLY));
attributes.setTargetLabel(ruleContext.getLabel());