use of com.android.tools.build.bundletool.commands.BuildApksCommand in project bundletool by google.
the class BuildExtractApksTest method forLDeviceUniversalApk.
@Test
public void forLDeviceUniversalApk() throws Exception {
AppBundle appBundle = createAppBundle();
bundleSerializer.writeToDisk(appBundle, bundlePath);
BuildApksCommand command = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setAapt2Command(aapt2Command).setApkBuildMode(UNIVERSAL).build();
Path apkSetFilePath = command.execute();
ExtractApksCommand extractApksCommand = ExtractApksCommand.builder().setOutputDirectory(outputDir).setApksArchivePath(apkSetFilePath).setDeviceSpec(L_X86_64_ES_DEVICE).build();
ImmutableList<Path> extractedApks = extractApksCommand.execute();
assertThat(extractedApks.stream().map(Path::getFileName).map(Path::toString).collect(toImmutableList())).containsExactly("universal.apk");
}
use of com.android.tools.build.bundletool.commands.BuildApksCommand in project bundletool by google.
the class BuildExtractApksTest method forPreLDeviceUniversalApk.
@Test
public void forPreLDeviceUniversalApk() throws Exception {
AppBundle appBundle = createAppBundle();
bundleSerializer.writeToDisk(appBundle, bundlePath);
BuildApksCommand command = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setAapt2Command(aapt2Command).setApkBuildMode(UNIVERSAL).build();
Path apkSetFilePath = command.execute();
ExtractApksCommand extractApksCommand = ExtractApksCommand.builder().setOutputDirectory(outputDir).setApksArchivePath(apkSetFilePath).setDeviceSpec(PRE_L_X86_ES_DEVICE).build();
ImmutableList<Path> extractedApks = extractApksCommand.execute();
assertThat(extractedApks.stream().map(Path::getFileName).map(Path::toString).collect(toImmutableList())).containsExactly("universal.apk");
}
use of com.android.tools.build.bundletool.commands.BuildApksCommand in project bundletool by google.
the class BuildExtractApksTest method forLDevice.
@Test
public void forLDevice() throws Exception {
AppBundle appBundle = createAppBundle();
bundleSerializer.writeToDisk(appBundle, bundlePath);
BuildApksCommand command = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setAapt2Command(aapt2Command).build();
Path apkSetFilePath = command.execute();
ExtractApksCommand extractApksCommand = ExtractApksCommand.builder().setOutputDirectory(outputDir).setApksArchivePath(apkSetFilePath).setDeviceSpec(L_X86_64_ES_DEVICE).build();
ImmutableList<String> extractedApks = extractApksCommand.execute().stream().map(Path::getFileName).map(Path::toString).collect(toImmutableList());
assertThat(extractedApks).hasSize(4);
assertThat(extractedApks).containsAtLeast("base-xhdpi.apk", "base-es.apk");
assertThat(extractedApks).containsAnyOf("base-master.apk", "base-master_2.apk");
assertThat(extractedApks).containsAnyOf("base-x86_64.apk", "base-x86_64_2.apk");
}
use of com.android.tools.build.bundletool.commands.BuildApksCommand in project bundletool by google.
the class BuildExtractApksTest method forPreLDevice.
@Test
public void forPreLDevice() throws Exception {
AppBundle appBundle = createAppBundle();
bundleSerializer.writeToDisk(appBundle, bundlePath);
BuildApksCommand command = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setAapt2Command(aapt2Command).build();
Path apkSetFilePath = command.execute();
ExtractApksCommand extractApksCommand = ExtractApksCommand.builder().setOutputDirectory(outputDir).setApksArchivePath(apkSetFilePath).setDeviceSpec(PRE_L_X86_ES_DEVICE).build();
ImmutableList<Path> extractedApks = extractApksCommand.execute();
assertThat(extractedApks.stream().map(Path::getFileName).map(Path::toString).collect(toImmutableList())).containsExactly("standalone-x86_hdpi.apk");
}
Aggregations