aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
diff options
context:
space:
mode:
authorGravatar Greg Estren <gregce@google.com>2017-02-16 22:46:41 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2017-02-17 14:53:19 +0000
commitedeb6d0ba47a52ddd9fc421f1ab577f4eafdc2b5 (patch)
tree0ec950dcde90cd663eae31ae9e01294a92fbceed /src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
parent0d4980bc7251ebb62cbb85c7777da6fd4361dd21 (diff)
Make Android data binding work with --experimental_use_parallel_android_resource_processing.
Without that flag, data binding already works via hooks in ApplicationManifest and AndroidResourceProcessingAction. The flag replaces AndroidResourceProcessingAction with three smaller processors: AndroidResourceParsingAction, AndroidResourceMergingAction, and AndroidResourceValidatorAction. So this change hooks the same logic into AndroidResourceMergingAction (at the equivalent place where data binding applies in the other pipeline). We could alternatively hook this into AndroidResourceValidatorAction (i.e. anywhere after resource merging completes and before aapt starts). But doing that would block Java compilation on aapt finishing, which the whole point of the flag is to unblock. -- PiperOrigin-RevId: 147770236 MOS_MIGRATED_REVID=147770236
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
index f11ebbdf18..0e2501e773 100644
--- a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
+++ b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceMergingAction.java
@@ -146,6 +146,13 @@ public class AndroidResourceMergingAction {
help = "Path to write the merged symbols binary."
)
public Path symbolsBinOut;
+
+ @Option(name = "dataBindingInfoOut",
+ defaultValue = "null",
+ converter = PathConverter.class,
+ category = "output",
+ help = "Path to where data binding's layout info output should be written.")
+ public Path dataBindingInfoOut;
}
public static void main(String[] args) throws Exception {
@@ -218,10 +225,18 @@ public class AndroidResourceMergingAction {
String.format("Create classJar finished at %sms", timer.elapsed(TimeUnit.MILLISECONDS)));
if (options.resourcesOutput != null) {
+ Path resourcesDir =
+ AndroidResourceProcessor.processDataBindings(
+ mergedData.getResourceDir(),
+ options.dataBindingInfoOut,
+ packageType,
+ options.packageForR,
+ options.primaryManifest);
+
// For now, try compressing the library resources that we pass to the validator. This takes
// extra CPU resources to pack and unpack (~2x), but can reduce the zip size (~4x).
resourceProcessor.createResourcesZip(
- mergedData.getResourceDir(),
+ resourcesDir,
mergedData.getAssetDir(),
options.resourcesOutput,
true /* compress */);