From c903cf9a51187e4432b257bb00f24890644e6e4f Mon Sep 17 00:00:00 2001 From: sgjesse Date: Thu, 25 Feb 2021 00:50:06 -0800 Subject: [PATCH] Prepare D8 dexing tests for Java 11 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 --- .../google/devtools/build/android/r8/CompatDexBuilder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/android/java/com/google/devtools/build/android/r8/CompatDexBuilder.java b/src/tools/android/java/com/google/devtools/build/android/r8/CompatDexBuilder.java index 10be42b0f1f585..dfa08a802d511b 100644 --- a/src/tools/android/java/com/google/devtools/build/android/r8/CompatDexBuilder.java +++ b/src/tools/android/java/com/google/devtools/build/android/r8/CompatDexBuilder.java @@ -163,7 +163,7 @@ private void run(String[] args) throws IOException, InterruptedException, Execut List> 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); @@ -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.