Skip to content

Commit

Permalink
Add main dex list to postprocessClassesDexZip
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 525683003
Change-Id: I173ff7f85c3af8a938b1a859ddec5b850a00e712
  • Loading branch information
Googler authored and copybara-github committed Apr 20, 2023
1 parent 6f0b653 commit 0d672f3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public AndroidBinary.DexPostprocessingOutput postprocessClassesDexZip(
NestedSetBuilder<Artifact> filesBuilder,
Artifact classesDexZip,
ProguardOutput proguardOutput,
Artifact proguardMapOutput)
Artifact proguardMapOutput,
Artifact mainDexList)
throws InterruptedException {
return AndroidBinary.DexPostprocessingOutput.create(classesDexZip, proguardOutput.getMapping());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,8 @@ public static RuleConfiguredTargetBuilder createAndroidBinary(
filesBuilder,
dexingOutput.classesDexZip,
proguardOutput,
postProcessingOutputMap);
postProcessingOutputMap,
dexingOutput.mainDexList);

// Compute the final DEX files by appending Java 8 legacy .dex if used.
Artifact finalClassesDex;
Expand Down Expand Up @@ -1241,12 +1242,19 @@ static final class DexingOutput {
private final Artifact classesDexZip;
final Artifact javaResourceJar;
final ImmutableList<Artifact> shardDexZips;
// This is not technically and output of dexing, but the processed main dex list that was used
// in dexing.
final Artifact mainDexList;

private DexingOutput(
Artifact classesDexZip, Artifact javaResourceJar, ImmutableList<Artifact> shardDexZips) {
Artifact classesDexZip,
Artifact javaResourceJar,
ImmutableList<Artifact> shardDexZips,
Artifact mainDexList) {
this.classesDexZip = classesDexZip;
this.javaResourceJar = javaResourceJar;
this.shardDexZips = Preconditions.checkNotNull(shardDexZips);
this.mainDexList = mainDexList;
}
}

Expand Down Expand Up @@ -1398,7 +1406,7 @@ private static DexingOutput dex(
// for other multidex modes.
javaResourceJar = javaResourceSourceJar;
}
return new DexingOutput(classesDex, javaResourceJar, shardDexes);
return new DexingOutput(classesDex, javaResourceJar, shardDexes, mainDexList);
} else {
if (usesDexArchives) {
createIncrementalDexingActions(
Expand Down Expand Up @@ -1430,7 +1438,8 @@ private static DexingOutput dex(
mainDexList);
createCleanDexZipAction(ruleContext, classesDexIntermediate, classesDex);
}
return new DexingOutput(classesDex, javaResourceSourceJar, ImmutableList.of(classesDex));
return new DexingOutput(
classesDex, javaResourceSourceJar, ImmutableList.of(classesDex), mainDexList);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ AndroidBinary.DexPostprocessingOutput postprocessClassesDexZip(
NestedSetBuilder<Artifact> filesBuilder,
Artifact classesDexZip,
ProguardOutput proguardOutput,
Artifact proguardMapOutput)
Artifact proguardMapOutput,
Artifact mainDexList)
throws InterruptedException;

default AndroidDataContext makeContextForNative(RuleContext ruleContext) {
Expand Down

0 comments on commit 0d672f3

Please sign in to comment.