Skip to content

Commit

Permalink
Prepare D8 dexing tests for Java 11
Browse files Browse the repository at this point in the history
Test was compiling `.class` files separately without any classes on classpath. As there where classes in nests that failed when compiled with Java 11.

Fixed by passing all input as classpath.

RELNOTES: None
PiperOrigin-RevId: 359464672
  • Loading branch information
sgjesse authored and copybara-github committed Feb 25, 2021
1 parent a3c52a7 commit c903cf9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private void run(String[] args) throws IOException, InterruptedException, Execut

List<Future<DexConsumer>> futures = new ArrayList<>(toDex.size());
for (ZipEntry classEntry : toDex) {
futures.add(executor.submit(() -> dexEntry(zipFile, classEntry, executor)));
futures.add(executor.submit(() -> dexEntry(input, zipFile, classEntry, executor)));
}
for (int i = 0; i < futures.size(); i++) {
ZipEntry entry = toDex.get(i);
Expand All @@ -176,11 +176,13 @@ private void run(String[] args) throws IOException, InterruptedException, Execut
}
}

private DexConsumer dexEntry(ZipFile zipFile, ZipEntry classEntry, ExecutorService executor)
private DexConsumer dexEntry(
String classpath, ZipFile zipFile, ZipEntry classEntry, ExecutorService executor)
throws IOException, CompilationFailedException {
DexConsumer consumer = new DexConsumer();
D8Command.Builder builder = D8Command.builder();
builder
.addClasspathFiles(Paths.get(classpath))
.setProgramConsumer(consumer)
.setMode(noLocals ? CompilationMode.RELEASE : CompilationMode.DEBUG)
.setMinApiLevel(13) // H_MR2.
Expand Down

0 comments on commit c903cf9

Please sign in to comment.