Skip to content

Commit 2b104c8

Browse files
tjgqcopybara-github
authored andcommitted
Make AndroidInstall actions hermetic with respect to dex shards.
They were missing from the inputs, but since the action had the LOCAL execution requirement it ran locally without sandboxing, so this bug could only be triggered by building without the bytes. Also change the execution requirement to NO_REMOTE, which permits sandboxing and would have caught this issue even when building with the bytes. Related to #14523. PiperOrigin-RevId: 533549342 Change-Id: I731f15071e5e08822a298abc5146b91a56ba1071
1 parent 98d5d5f commit 2b104c8

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryMobileInstall.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.devtools.build.lib.actions.ActionOwner;
2626
import com.google.devtools.build.lib.actions.Artifact;
2727
import com.google.devtools.build.lib.actions.CommandLines;
28+
import com.google.devtools.build.lib.actions.ExecutionRequirements;
2829
import com.google.devtools.build.lib.actions.ParamFileInfo;
2930
import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType;
3031
import com.google.devtools.build.lib.actions.ResourceSetOrBuilder;
@@ -168,21 +169,23 @@ static void addMobileInstall(
168169

169170
createInstallAction(
170171
ruleContext,
171-
/* incremental = */ false,
172+
/* incremental= */ false,
172173
fullDeployMarker,
173174
argsArtifact,
174175
incrementalDexManifest,
176+
shardDexZips,
175177
mobileInstallResourceApks.incrementalResourceApk.getArtifact(),
176178
incrementalApk,
177179
nativeLibs,
178180
stubData);
179181

180182
createInstallAction(
181183
ruleContext,
182-
/* incremental = */ true,
184+
/* incremental= */ true,
183185
incrementalDeployMarker,
184186
argsArtifact,
185187
incrementalDexManifest,
188+
shardDexZips,
186189
mobileInstallResourceApks.incrementalResourceApk.getArtifact(),
187190
incrementalApk,
188191
nativeLibs,
@@ -381,7 +384,8 @@ private static void createInstallAction(
381384
boolean incremental,
382385
Artifact marker,
383386
Artifact argsArtifact,
384-
Artifact dexmanifest,
387+
Artifact dexManifest,
388+
ImmutableList<Artifact> shardDexZips,
385389
Artifact resourceApk,
386390
Artifact apk,
387391
NativeLibs nativeLibs,
@@ -395,18 +399,19 @@ private static void createInstallAction(
395399
.setMnemonic("AndroidInstall")
396400
.setProgressMessage(
397401
"Installing %s%s", ruleContext.getLabel(), (incremental ? " incrementally" : ""))
398-
.setExecutionInfo(ImmutableMap.of("local", ""))
402+
.setExecutionInfo(ImmutableMap.of(ExecutionRequirements.NO_REMOTE, ""))
399403
.addTool(adb)
400404
.addOutput(marker)
401-
.addInput(dexmanifest)
405+
.addInput(dexManifest)
406+
.addInputs(shardDexZips)
402407
.addInput(resourceApk)
403408
.addInput(stubDataFile)
404409
.addInput(argsArtifact);
405410

406411
CustomCommandLine.Builder commandLine =
407412
CustomCommandLine.builder()
408413
.addExecPath("--output_marker", marker)
409-
.addExecPath("--dexmanifest", dexmanifest)
414+
.addExecPath("--dexmanifest", dexManifest)
410415
.addExecPath("--resource_apk", resourceApk)
411416
.addExecPath("--stub_datafile", stubDataFile)
412417
.addExecPath("--adb", adb.getExecutable())
@@ -443,7 +448,7 @@ private static void createSplitInstallAction(
443448
.addTool(adb)
444449
.setMnemonic("AndroidInstall")
445450
.setProgressMessage("Installing %s using split apks", ruleContext.getLabel())
446-
.setExecutionInfo(ImmutableMap.of("local", ""))
451+
.setExecutionInfo(ImmutableMap.of(ExecutionRequirements.NO_REMOTE, ""))
447452
.addTool(adb)
448453
.addOutput(marker)
449454
.addInput(stubDataFile)

0 commit comments

Comments
 (0)