diff options
author | Googler <noreply@google.com> | 2017-12-01 17:26:49 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-12-01 17:35:35 -0800 |
commit | b3da717469e23f5293297175a80709956416fd2c (patch) | |
tree | 862ede4d6c8c8c1251456fa89cff57236b764c66 /src/main/java/com/google/devtools/build/lib/runtime/mobileinstall | |
parent | 72f3a10e258764f0e6ed1fa645bf3c72bb6986e3 (diff) |
Forward test relevant flags to mobile-install launcher.
Add new flag to specify the adb device serial number (--device).
Change ..._mi/launcher.sh to ..._mi/launcher (see unknown commit).
RELNOTES: None
PiperOrigin-RevId: 177662635
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/mobileinstall')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java | 43 |
1 files changed, 29 insertions, 14 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 5047d37837..518465e634 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 @@ -19,6 +19,7 @@ import static com.google.devtools.build.lib.analysis.OutputGroupProvider.INTERNA import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.analysis.ConfiguredTarget; +import com.google.devtools.build.lib.analysis.test.TestConfiguration.TestOptions; import com.google.devtools.build.lib.buildtool.BuildRequest; import com.google.devtools.build.lib.buildtool.BuildResult; import com.google.devtools.build.lib.buildtool.BuildTool; @@ -234,27 +235,41 @@ public class MobileInstallCommand implements BlazeCommand { targetToRun.getConfiguration().getBinFragment().getPathString() + "/" + targetToRun.getLabel().toPathFragment().getPathString() - + "_mi/launcher.sh"); + + "_mi/launcher"); cmdLine.addAll(runTargetArgs); - // Make mobile-install v2 understand relevant v1 flags for ASwB compatibility. + cmdLine.add("--build_id=" + env.getCommandId()); + + // Collect relevant common command options CommonCommandOptions commonCommandOptions = options.getOptions(CommonCommandOptions.class); - if (commonCommandOptions != null && !"".equals(commonCommandOptions.toolTag)) { - cmdLine.add("--tool_tag"); - cmdLine.add(commonCommandOptions.toolTag); + if (!commonCommandOptions.toolTag.isEmpty()) { + cmdLine.add("--tool_tag=" + commonCommandOptions.toolTag); } - cmdLine.add("--start_type"); - cmdLine.add(adbOptions.start.toString()); - if (!"".equals(adbOptions.adb)) { - cmdLine.add("--adb_path"); - cmdLine.add(adbOptions.adb); + + // Collect relevant adb options + cmdLine.add("--start_type=" + adbOptions.start); + if (!adbOptions.adb.isEmpty()) { + cmdLine.add("--adb=" + adbOptions.adb); } for (String adbArg : adbOptions.adbArgs) { - cmdLine.add("--adb_arg"); - cmdLine.add(adbArg); + if (!adbArg.isEmpty()) { + cmdLine.add("--adb_arg=" + adbArg); + } + } + if (!adbOptions.device.isEmpty()) { + cmdLine.add("--device=" + adbOptions.device); + } + + // Collect relevant test options + TestOptions testOptions = options.getOptions(TestOptions.class); + if (!testOptions.testFilter.isEmpty()){ + cmdLine.add("--test_filter=" + testOptions.testFilter); + } + for (String arg : testOptions.testArguments) { + if (!arg.isEmpty()) { + cmdLine.add("--test_arg=" + arg); + } } - cmdLine.add("--build_id"); - cmdLine.add(env.getCommandId().toString()); Path workingDir = env.getBlazeWorkspace().getOutputPath().getParentDirectory(); com.google.devtools.build.lib.shell.Command command = |