aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-07-11 21:10:31 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-07-12 08:49:54 +0200
commitbefb8d62100dddffb513b6378f69a3fec10c7dd3 (patch)
tree8b21bb084b99337715f04241ebb6fc0f23855210 /src/main/java/com/google/devtools/build/lib/runtime
parentc06e7468d9f14a3e950e1e81d1c774b1f476081e (diff)
Making mobile-install v2 compatible with ASwB plugin
PiperOrigin-RevId: 161563102
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java
index 70feace90e..cb613c6fb7 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java
@@ -28,6 +28,7 @@ import com.google.devtools.build.lib.rules.android.WriteAdbArgsAction.StartType;
import com.google.devtools.build.lib.runtime.BlazeCommand;
import com.google.devtools.build.lib.runtime.Command;
import com.google.devtools.build.lib.runtime.CommandEnvironment;
+import com.google.devtools.build.lib.runtime.CommonCommandOptions;
import com.google.devtools.build.lib.runtime.commands.BuildCommand;
import com.google.devtools.build.lib.runtime.commands.ProjectFileSupport;
import com.google.devtools.build.lib.shell.AbnormalTerminationException;
@@ -163,9 +164,9 @@ public class MobileInstallCommand implements BlazeCommand {
@Override
public ExitCode exec(CommandEnvironment env, OptionsProvider options) {
Options mobileInstallOptions = options.getOptions(Options.class);
+ WriteAdbArgsAction.Options adbOptions = options.getOptions(WriteAdbArgsAction.Options.class);
if (mobileInstallOptions.mode == Mode.CLASSIC) {
- WriteAdbArgsAction.Options adbOptions = options.getOptions(WriteAdbArgsAction.Options.class);
if (adbOptions.start == StartType.WARM && !mobileInstallOptions.incremental) {
env.getReporter().handle(Event.warn(
"Warm start is enabled, but will have no effect on a non-incremental build"));
@@ -233,6 +234,23 @@ public class MobileInstallCommand implements BlazeCommand {
+ "_launcher");
cmdLine.addAll(runTargetArgs);
+ // Make mobile-install v2 understand relevant v1 flags for ASwB compatibility.
+ CommonCommandOptions commonCommandOptions = options.getOptions(CommonCommandOptions.class);
+ if (commonCommandOptions != null && !"".equals(commonCommandOptions.toolTag)) {
+ cmdLine.add("--tool_tag");
+ cmdLine.add(commonCommandOptions.toolTag);
+ }
+ cmdLine.add("--start_type");
+ cmdLine.add(adbOptions.start.toString());
+ if (!"".equals(adbOptions.adb)) {
+ cmdLine.add("--adb_path");
+ cmdLine.add(adbOptions.adb);
+ }
+ for (String adbArg : adbOptions.adbArgs) {
+ cmdLine.add("--adb_arg");
+ cmdLine.add(adbArg);
+ }
+
Path workingDir = env.getBlazeWorkspace().getOutputPath().getParentDirectory();
com.google.devtools.build.lib.shell.Command command =
new CommandBuilder()
@@ -297,6 +315,7 @@ public class MobileInstallCommand implements BlazeCommand {
"Options required by the skylark implementation of mobile-install command",
ImmutableList.of(
"--aspects=" + options.mobileInstallAspect + "%" + options.mode.getAspectName(),
+ "--output_groups=android_incremental_deploy_info",
"--output_groups=mobile_install" + INTERNAL_SUFFIX,
"--output_groups=mobile_install_launcher" + INTERNAL_SUFFIX));
}