use of com.android.tools.build.bundletool.model.utils.Versions.ANDROID_K_API_VERSION in project bundletool by google.
the class D8DexMergerTest method mergeCoreDesugaringLibrary_ok.
@Test
public void mergeCoreDesugaringLibrary_ok() throws Exception {
// Two application dex files together with code desugaring dex.
Path dexFile1 = writeTestDataToFile("testdata/dex/classes.dex");
Path dexFile2 = writeTestDataToFile("testdata/dex/classes-other.dex");
Path dexFile3 = writeTestDataToFile("testdata/dex/classes-emulated-coredesugar.dex");
ImmutableList<Path> mergedDexFiles = new D8DexMerger().merge(ImmutableList.of(dexFile1, dexFile2, dexFile3), outputDir, /* mainDexListFile= */
Optional.empty(), /* proguardMap= */
NO_FILE, /* isDebuggable= */
false, /* minSdkVersion= */
ANDROID_K_API_VERSION);
ImmutableList<String> mergedDexFilenames = mergedDexFiles.stream().map(dex -> dex.getFileName().toString()).collect(toImmutableList());
assertThat(mergedDexFiles.size()).isAtLeast(2);
assertThat(mergedDexFilenames).containsExactly("classes.dex", "classes2.dex");
assertThat(listClassesInDexFiles(mergedDexFiles.get(0))).isEqualTo(listClassesInDexFiles(dexFile1, dexFile2));
// Core desugaring dex must not be merged with application dex.
assertThat(Files.readAllBytes(mergedDexFiles.get(1))).isEqualTo(Files.readAllBytes(dexFile3));
}
Aggregations