aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
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
parentc06e7468d9f14a3e950e1e81d1c774b1f476081e (diff)
Making mobile-install v2 compatible with ASwB plugin
PiperOrigin-RevId: 161563102
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/mobileinstall/MobileInstallCommand.java21
2 files changed, 23 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
index 5623e55630..b9b9d78659 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
@@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
+
package com.google.devtools.build.lib.rules.android;
import static com.google.common.base.Preconditions.checkArgument;
@@ -818,7 +819,8 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory {
.addOutputGroup("mobile_install_split" + INTERNAL_SUFFIX, splitInstallOutputGroup)
.addOutputGroup("apk_manifest", apkManifest)
.addOutputGroup("apk_manifest_text", apkManifestText)
- .addOutputGroup("android_deploy_info", deployInfo);
+ .addOutputGroup("android_deploy_info", deployInfo)
+ .addOutputGroup("android_incremental_deploy_info", incrementalDeployInfo);
}
private static void createSplitInstallAction(RuleContext ruleContext,
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));
}