aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-05-12 21:48:26 +0200
committerGravatar Dmitry Lomov <dslomov@google.com>2017-05-15 19:50:57 +0200
commit22228d1dc35d1cc1831203e551b5487053137ae7 (patch)
tree993923bcf811534bce1ed11a212f35be0eea53d5 /src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java
parentb42c67873a5ba84565cf271b78ab3dc07ccc9d24 (diff)
Add v2 flag to enable MIv2.
Add a flag that determines the aspects use for MIv2. RELNOTES:None. PiperOrigin-RevId: 155899777
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java50
1 files changed, 40 insertions, 10 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 453907424d..82791a126d 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
@@ -33,6 +33,7 @@ import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionPriority;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
+import com.google.devtools.common.options.OptionsParser.OptionUsageRestrictions;
import com.google.devtools.common.options.OptionsParsingException;
import com.google.devtools.common.options.OptionsProvider;
import java.util.List;
@@ -69,6 +70,26 @@ public class MobileInstallCommand implements BlazeCommand {
+ "that information to avoid unnecessary work. If false (the default), always do a "
+ "full install.")
public boolean incremental;
+
+ @Option(
+ name = "v2",
+ category = "mobile-install",
+ defaultValue = "false",
+ help = "Whether to use the v2 mobile-install. If true, rather than using the current "
+ + "version of mobile-install, use version 2.",
+ optionUsageRestrictions = OptionUsageRestrictions.UNDOCUMENTED
+ )
+ public boolean v2;
+
+ @Option(
+ name = "mobile_install_aspects",
+ category = "mobile-install",
+ defaultValue =
+ "@android_test_support//tools/android/mobile_install:mobile-install.bzl%MIASPECT",
+ help = "The aspect to use for mobile-install.",
+ optionUsageRestrictions = OptionUsageRestrictions.UNDOCUMENTED
+ )
+ public String mobileInstallAspects;
}
@Override
@@ -93,16 +114,25 @@ public class MobileInstallCommand implements BlazeCommand {
public void editOptions(CommandEnvironment env, OptionsParser optionsParser)
throws AbruptExitException {
try {
- String outputGroup =
- optionsParser.getOptions(Options.class).splitApks
- ? "mobile_install_split" + INTERNAL_SUFFIX
- : optionsParser.getOptions(Options.class).incremental
- ? "mobile_install_incremental" + INTERNAL_SUFFIX
- : "mobile_install_full" + INTERNAL_SUFFIX;
-
- optionsParser.parse(OptionPriority.COMMAND_LINE,
- "Options required by the mobile-install command",
- ImmutableList.of("--output_groups=" + outputGroup));
+ if (optionsParser.getOptions(Options.class).v2) {
+ optionsParser.parse(
+ OptionPriority.COMMAND_LINE,
+ "Options required by the mobile-install v2 command",
+ ImmutableList.of(
+ "--aspects=" + optionsParser.getOptions(Options.class).mobileInstallAspects,
+ "--output_groups=mobile_install_v2" + INTERNAL_SUFFIX));
+ } else {
+ String outputGroup =
+ optionsParser.getOptions(Options.class).splitApks
+ ? "mobile_install_split" + INTERNAL_SUFFIX
+ : optionsParser.getOptions(Options.class).incremental
+ ? "mobile_install_incremental" + INTERNAL_SUFFIX
+ : "mobile_install_full" + INTERNAL_SUFFIX;
+ optionsParser.parse(
+ OptionPriority.COMMAND_LINE,
+ "Options required by the mobile-install command",
+ ImmutableList.of("--output_groups=" + outputGroup));
+ }
} catch (OptionsParsingException e) {
throw new IllegalStateException(e);
}