diff options
author | Alex Humesky <ahumesky@google.com> | 2016-06-10 22:43:39 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2016-06-13 08:11:26 +0000 |
commit | 5b815a54f3d3d2290fc5a9eaf96f938425fa047a (patch) | |
tree | 7edaaae463ab4bffd9fb7df8e035ab9a9b90a3c6 /src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java | |
parent | 82e992e7ada86b937cd76367a959b041962370e5 (diff) |
Adds a step before creating the resource apk (ap_) to swap out the application
tag's name attribute to the Instant Run application class.
--
MOS_MIGRATED_REVID=124606107
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java index 4eace34227..296f4aff14 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java @@ -102,23 +102,24 @@ public final class ApplicationManifest { } } - public ApplicationManifest addStubApplication(RuleContext ruleContext) + public ApplicationManifest addMobileInstallStubApplication(RuleContext ruleContext) throws InterruptedException { - Artifact stubManifest = - ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.STUB_APPLICATON_MANIFEST); + Artifact stubManifest = ruleContext.getImplicitOutputArtifact( + AndroidRuleClasses.MOBILE_INSTALL_STUB_APPLICATON_MANIFEST); SpawnAction.Builder builder = new SpawnAction.Builder() .setExecutable(ruleContext.getExecutablePrerequisite("$stubify_manifest", Mode.HOST)) - .setProgressMessage("Injecting stub application") - .setMnemonic("InjectStubApplication") + .setProgressMessage("Injecting mobile install stub application") + .setMnemonic("InjectMobileInstallStubApplication") + .addArgument("--mode=mobile_install") .addArgument("--input_manifest") .addInputArgument(manifest) .addArgument("--output_manifest") .addOutputArgument(stubManifest) .addArgument("--output_datafile") - .addOutputArgument( - ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.STUB_APPLICATION_DATA)); + .addOutputArgument(ruleContext.getImplicitOutputArtifact( + AndroidRuleClasses.MOBILE_INSTALL_STUB_APPLICATION_DATA)); String overridePackage = getOverridePackage(ruleContext); if (overridePackage != null) { @@ -131,6 +132,27 @@ public final class ApplicationManifest { return new ApplicationManifest(stubManifest); } + public ApplicationManifest addInstantRunStubApplication(RuleContext ruleContext) + throws InterruptedException { + + Artifact stubManifest = ruleContext.getImplicitOutputArtifact( + AndroidRuleClasses.INSTANT_RUN_STUB_APPLICATON_MANIFEST); + + SpawnAction.Builder builder = new SpawnAction.Builder() + .setExecutable(ruleContext.getExecutablePrerequisite("$stubify_manifest", Mode.HOST)) + .setProgressMessage("Injecting instant run stub application") + .setMnemonic("InjectInstantRunStubApplication") + .addArgument("--mode=instant_run") + .addArgument("--input_manifest") + .addInputArgument(manifest) + .addArgument("--output_manifest") + .addOutputArgument(stubManifest); + + ruleContext.registerAction(builder.build(ruleContext)); + + return new ApplicationManifest(stubManifest); + } + public static ApplicationManifest fromRule(RuleContext ruleContext) { return new ApplicationManifest(ruleContext.getPrerequisiteArtifact("manifest", Mode.TARGET)); } @@ -216,7 +238,8 @@ public final class ApplicationManifest { Mode.TARGET, FileProvider.class)).build(); - return createApk(resourceApk, + return createApk( + resourceApk, ruleContext, false, /* isLibrary */ resourceDeps, @@ -273,7 +296,8 @@ public final class ApplicationManifest { if (ruleContext.hasErrors()) { return null; } - return createApk(resourceApk, + return createApk( + resourceApk, ruleContext, isLibrary, resourceDeps, |