Skip to content

Commit

Permalink
mobile-install: let the build step decide whether the IDE should deploy
Browse files Browse the repository at this point in the history
(cherry picked from commit 3471b97)
  • Loading branch information
Googler authored and cpsauer committed Aug 13, 2022
1 parent e1027f9 commit 3b2163c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public BlazeAndroidDeviceSelector getDeviceSelector() {
@Override
public void augmentLaunchOptions(LaunchOptions.Builder options) {
options
.setDeploy(StudioDeployerExperiment.isEnabled())
.setDeploy(buildStep.needsIdeDeploy())
.setOpenLogcatAutomatically(configState.showLogcatAutomatically());
// This is needed for compatibility with #api211
options.addExtraOptions(
Expand All @@ -110,15 +110,15 @@ public ApkBuildStep getBuildStep() {
return buildStep;
}

// @Override #api211
@Override
public ProfilerState getProfileState() {
return configState.getProfilerState();
}

@Override
public ImmutableList<LaunchTask> getDeployTasks(IDevice device, LaunchOptions launchOptions)
throws ExecutionException {
if (!StudioDeployerExperiment.isEnabled()) {
if (!buildStep.needsIdeDeploy()) {
return ImmutableList.of();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ public void build(BlazeContext context, BlazeAndroidDeviceSelector.DeviceSession
}
}

@Override
public boolean needsIdeDeploy() {
return StudioDeployerExperiment.isEnabled();
}

@Override
public BlazeAndroidDeployInfo getDeployInfo() throws ApkProvisionException {
if (deployInfo != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ public interface ApkBuildStep {
*/
void build(BlazeContext context, BlazeAndroidDeviceSelector.DeviceSession deviceSession);

/**
* Returns whether the IDE should deploy the artifacts of the build. This is true in most cases
* except for mobile-install where the build itself does the deploy.
*/
default boolean needsIdeDeploy() {
return true;
}

BlazeAndroidDeployInfo getDeployInfo() throws ApkProvisionException;
}

0 comments on commit 3b2163c

Please sign in to comment.