diff options
author | 2016-11-21 17:54:46 +0000 | |
---|---|---|
committer | 2016-11-21 20:04:46 +0000 | |
commit | 2aada22ebb0671a3ee772888bf52fe814a519197 (patch) | |
tree | b844a850254ad09a7f388d602a2e169e401539a0 /src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java | |
parent | 3b57ccfba7e67f85a0d3c31f9b813719e367fe9c (diff) |
Adds internal data binding support to Bazel, although this
is not yet exposed at the user level.
(https://developer.android.com/topic/libraries/data-binding/index.html).
See comments in DataBinding.java for the high-level overview of
how this works.
This does not yet work with
--experimental_use_parallel_android_resource_processing.
Exposing this at the user level additionally requires:
1) making the data binding support libraries available at an
expected place in the depot
2) Opting in android_binary / android_library rules through a new
"enable_data_binding" attribute.
--
MOS_MIGRATED_REVID=139797558
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java index 45ee4685f5..bbbc9b052a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java @@ -83,6 +83,7 @@ public class AndroidResourcesProcessorBuilder { private String applicationId; private String versionName; private Artifact symbolsTxt; + private Artifact dataBindingInfoZip; private Artifact manifestOut; private Artifact mergedResourcesOut; @@ -107,6 +108,16 @@ public class AndroidResourcesProcessorBuilder { return this; } + /** + * The output zip for resource-processed data binding expressions (i.e. a zip of .xml files). + * If null, data binding processing is skipped (and data binding expressions aren't allowed in + * layout resources). + */ + public AndroidResourcesProcessorBuilder setDataBindingInfoZip(Artifact zip) { + this.dataBindingInfoZip = zip; + return this; + } + public AndroidResourcesProcessorBuilder withDependencies(ResourceDependencies resourceDeps) { this.dependencies = resourceDeps; return this; @@ -287,6 +298,11 @@ public class AndroidResourcesProcessorBuilder { builder.add("--applicationId").add(applicationId); } + if (dataBindingInfoZip != null) { + builder.addExecPath("--dataBindingInfoOut", dataBindingInfoZip); + outs.add(dataBindingInfoZip); + } + if (!Strings.isNullOrEmpty(customJavaPackage)) { // Sets an alternative java package for the generated R.java // this allows android rules to generate resources outside of the java{,tests} tree. |