Search in sources :

Example 76 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class BuildApksResourcePinningTest method resourceIds_pinnedToMasterSplits.

@Test
public void resourceIds_pinnedToMasterSplits() throws Exception {
    ResourceTable baseResourceTable = new ResourceTableBuilder().addPackage("com.test.app").addStringResource("test_label", "Module title").addFileResourceForMultipleConfigs("drawable", "image", ImmutableMap.of(Configuration.getDefaultInstance(), "res/drawable/image1.jpg", locale("fr"), "res/drawable-fr/image1.jpg")).addFileResourceForMultipleConfigs("drawable", "image2", ImmutableMap.of(Configuration.getDefaultInstance(), "res/drawable/image2.jpg", locale("fr"), "res/drawable-fr/image2.jpg")).build();
    ResourceTable featureResourceTable = new ResourceTableBuilder().addPackage("com.test.app.feature", 0x80).addFileResourceForMultipleConfigs("drawable", "image3", ImmutableMap.of(Configuration.getDefaultInstance(), "res/drawable/image3.jpg", locale("fr"), "res/drawable-fr/image3.jpg")).addFileResourceForMultipleConfigs("drawable", "image4", ImmutableMap.of(Configuration.getDefaultInstance(), "res/drawable/image4.jpg", locale("fr"), "res/drawable-fr/image4.jpg")).build();
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile("dex/classes.dex").addFile("res/drawable/image1.jpg").addFile("res/drawable-fr/image1.jpg").addFile("res/drawable/image2.jpg").addFile("res/drawable-fr/image2.jpg").setManifest(androidManifest("com.test.app", withMinSdkVersion(14))).setResourceTable(baseResourceTable)).addModule("feature", builder -> builder.addFile("res/drawable/image3.jpg").addFile("res/drawable-fr/image3.jpg").addFile("res/drawable/image4.jpg").addFile("res/drawable-fr/image4.jpg").setManifest(androidManifest("com.test.app", withMinSdkVersion(14), withOnDemandDelivery(), withFusingAttribute(true), withTitle("@string/test_label", 0x7f010000))).setResourceTable(featureResourceTable)).setBundleConfig(BundleConfigBuilder.create().addResourcePinnedToMasterSplit(// image1 from "base" module
    0x7f020000).addResourcePinnedToMasterSplit(// image4 from "feature" module
    0x80010001).build()).build();
    TestComponent.useTestModule(this, TestModule.builder().withAppBundle(appBundle).withOutputPath(outputFilePath).build());
    buildApksManager.execute();
    ZipFile apkSetFile = new ZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    // Verifying that standalone APKs contain all entries.
    assertThat(standaloneApkVariants(result)).hasSize(1);
    List<ApkSet> standaloneApkSets = standaloneApkVariants(result).get(0).getApkSetList();
    assertThat(standaloneApkSets).hasSize(1);
    List<ApkDescription> standaloneApkDescription = standaloneApkSets.get(0).getApkDescriptionList();
    assertThat(standaloneApkDescription).hasSize(1);
    File standaloneApkFile = extractFromApkSetFile(apkSetFile, standaloneApkDescription.get(0).getPath(), outputDir);
    try (ZipFile standaloneZip = new ZipFile(standaloneApkFile)) {
        assertThat(filesUnderPath(standaloneZip, ZipPath.create("res"))).containsExactly("res/drawable/image1.jpg", "res/drawable-fr/image1.jpg", "res/drawable/image2.jpg", "res/drawable-fr/image2.jpg", "res/drawable/image3.jpg", "res/drawable-fr/image3.jpg", "res/drawable/image4.jpg", "res/drawable-fr/image4.jpg", "res/xml/splits0.xml");
    }
    // Verifying split APKs.
    assertThat(splitApkVariants(result)).hasSize(1);
    List<ApkSet> splitApkSetList = splitApkVariants(result).get(0).getApkSetList();
    Map<String, ApkSet> modules = Maps.uniqueIndex(splitApkSetList, apkSet -> apkSet.getModuleMetadata().getName());
    assertThat(modules.keySet()).containsExactly("base", "feature");
    List<ApkDescription> baseModuleApks = modules.get("base").getApkDescriptionList();
    assertThat(baseModuleApks).hasSize(2);
    Map<Boolean, ApkDescription> apkBaseMaster = Maps.uniqueIndex(baseModuleApks, apkDescription -> apkDescription.getSplitApkMetadata().getIsMasterSplit());
    ApkDescription baseMaster = apkBaseMaster.get(/* isMasterSplit= */
    true);
    File baseMasterFile = extractFromApkSetFile(apkSetFile, baseMaster.getPath(), outputDir);
    try (ZipFile baseMasterZip = new ZipFile(baseMasterFile)) {
        assertThat(filesUnderPath(baseMasterZip, ZipPath.create("res"))).containsExactly("res/drawable/image1.jpg", "res/drawable-fr/image1.jpg", "res/drawable/image2.jpg", "res/xml/splits0.xml", "res/xml/locales_config.xml");
    }
    ApkDescription baseFr = apkBaseMaster.get(/* isMasterSplit= */
    false);
    File baseFrFile = extractFromApkSetFile(apkSetFile, baseFr.getPath(), outputDir);
    try (ZipFile baseFrZip = new ZipFile(baseFrFile)) {
        assertThat(filesUnderPath(baseFrZip, ZipPath.create("res"))).containsExactly("res/drawable-fr/image2.jpg");
    }
    List<ApkDescription> featureModuleApks = modules.get("feature").getApkDescriptionList();
    assertThat(featureModuleApks).hasSize(2);
    Map<Boolean, ApkDescription> apkFeatureMaster = Maps.uniqueIndex(featureModuleApks, apkDescription -> apkDescription.getSplitApkMetadata().getIsMasterSplit());
    ApkDescription featureMaster = apkFeatureMaster.get(/* isMasterSplit= */
    true);
    File featureMasterFile = extractFromApkSetFile(apkSetFile, featureMaster.getPath(), outputDir);
    try (ZipFile featureMasterZip = new ZipFile(featureMasterFile)) {
        assertThat(filesUnderPath(featureMasterZip, ZipPath.create("res"))).containsExactly("res/drawable/image3.jpg", "res/drawable/image4.jpg", "res/drawable-fr/image4.jpg");
    }
    ApkDescription featureFr = apkFeatureMaster.get(/* isMasterSplit= */
    false);
    File featureFrFile = extractFromApkSetFile(apkSetFile, featureFr.getPath(), outputDir);
    try (ZipFile featureFrZip = new ZipFile(featureFrFile)) {
        assertThat(filesUnderPath(featureFrZip, ZipPath.create("res"))).containsExactly("res/drawable-fr/image3.jpg");
    }
}
Also used : TestModule(com.android.tools.build.bundletool.testing.TestModule) ZipPath(com.android.tools.build.bundletool.model.ZipPath) ResultUtils.standaloneApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.standaloneApkVariants) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) ResourcesTableFactory.locale(com.android.tools.build.bundletool.testing.ResourcesTableFactory.locale) BundleConfigBuilder(com.android.tools.build.bundletool.testing.BundleConfigBuilder) RunWith(org.junit.runner.RunWith) BuildApksResult(com.android.bundle.Commands.BuildApksResult) Component(dagger.Component) Inject(javax.inject.Inject) ApkSetUtils.extractTocFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractTocFromApkSetFile) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) Map(java.util.Map) ApkDescription(com.android.bundle.Commands.ApkDescription) ResultUtils.splitApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.splitApkVariants) ManifestProtoUtils.withOnDemandDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withOnDemandDelivery) ZipFile(java.util.zip.ZipFile) TestUtils.filesUnderPath(com.android.tools.build.bundletool.testing.TestUtils.filesUnderPath) Path(java.nio.file.Path) ResourceTable(com.android.aapt.Resources.ResourceTable) Before(org.junit.Before) ManifestProtoUtils.withTitle(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTitle) ImmutableMap(com.google.common.collect.ImmutableMap) ManifestProtoUtils.withFusingAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withFusingAttribute) Test(org.junit.Test) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) Maps(com.google.common.collect.Maps) File(java.io.File) ApkSetUtils.extractFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractFromApkSetFile) ManifestProtoUtils.withMinSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMinSdkVersion) ApkSet(com.android.bundle.Commands.ApkSet) List(java.util.List) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Rule(org.junit.Rule) AppBundle(com.android.tools.build.bundletool.model.AppBundle) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) TemporaryFolder(org.junit.rules.TemporaryFolder) ApkSet(com.android.bundle.Commands.ApkSet) AppBundle(com.android.tools.build.bundletool.model.AppBundle) ApkDescription(com.android.bundle.Commands.ApkDescription) BuildApksResult(com.android.bundle.Commands.BuildApksResult) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) ZipFile(java.util.zip.ZipFile) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ApkSetUtils.extractTocFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractTocFromApkSetFile) ZipFile(java.util.zip.ZipFile) File(java.io.File) ApkSetUtils.extractFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractFromApkSetFile) ResourceTable(com.android.aapt.Resources.ResourceTable) Test(org.junit.Test)

Example 77 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class BuildApksValidationTest method splits_textureFallbackNotPresentInAssetPacks.

@Test
public void splits_textureFallbackNotPresentInAssetPacks() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.setManifest(androidManifest("com.test.app")).setResourceTable(resourceTableWithTestLabel("Test feature"))).addModule("feature_tcf_assets", builder -> builder.addFile("assets/textures#tcf_atc/atc_texture.dat").addFile("assets/textures#tcf_etc1/etc1_texture.dat").setAssetsConfig(assets(targetedAssetsDirectory("assets/textures#tcf_atc", assetsDirectoryTargeting(textureCompressionTargeting(ATC))), targetedAssetsDirectory("assets/textures#tcf_etc1", assetsDirectoryTargeting(textureCompressionTargeting(ETC1_RGB8))))).setManifest(androidManifestForFeature("com.test.app", withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).setBundleConfig(BundleConfigBuilder.create().addSplitDimension(Value.TEXTURE_COMPRESSION_FORMAT, /* negate= */
    false).build()).build();
    new AppBundleSerializer().writeToDisk(appBundle, bundlePath);
    BuildApksCommand command = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).build();
    // Splitting by texture compression format is activated, but the textures in
    // one module don't include a fallback folder, used for standalone and universal
    // APKs, so we'll consider the bundle invalid:
    InvalidBundleException exception = assertThrows(InvalidBundleException.class, command::execute);
    assertThat(exception).hasMessageThat().contains("the fallback texture folders (folders without #tcf suffixes) will be used, but module" + " 'feature_tcf_assets' has no such folders.");
}
Also used : ManifestProtoUtils.withMaxSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMaxSdkVersion) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) TEST_LABEL_RESOURCE_ID(com.android.tools.build.bundletool.testing.ResourcesTableFactory.TEST_LABEL_RESOURCE_ID) Value(com.android.bundle.Config.SplitDimension.Value) TargetingUtils.alternativeTextureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeTextureCompressionTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) TargetingUtils.textureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionTargeting) ATC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ATC) BundleConfigBuilder(com.android.tools.build.bundletool.testing.BundleConfigBuilder) RunWith(org.junit.runner.RunWith) ImmutableList(com.google.common.collect.ImmutableList) TargetingUtils.targetedAssetsDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedAssetsDirectory) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ResourcesTableFactory.resourceTableWithTestLabel(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTableWithTestLabel) Path(java.nio.file.Path) Before(org.junit.Before) ManifestProtoUtils.withInstant(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstant) ManifestProtoUtils.withTitle(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTitle) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) IOException(java.io.IOException) Test(org.junit.Test) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) ETC1_RGB8(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ETC1_RGB8) TargetingUtils.assets(com.android.tools.build.bundletool.testing.TargetingUtils.assets) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Rule(org.junit.Rule) SubValidator(com.android.tools.build.bundletool.validation.SubValidator) ManifestProtoUtils.androidManifestForFeature(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForFeature) TargetingUtils.assetsDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.assetsDirectoryTargeting) AppBundle(com.android.tools.build.bundletool.model.AppBundle) TemporaryFolder(org.junit.rules.TemporaryFolder) AppBundle(com.android.tools.build.bundletool.model.AppBundle) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) Test(org.junit.Test)

Example 78 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class BuildApksValidationTest method createAppBundle.

private static void createAppBundle(Path path) throws IOException {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", module -> module.setManifest(androidManifest("com.app")).build()).build();
    new AppBundleSerializer().writeToDisk(appBundle, path);
}
Also used : ManifestProtoUtils.withMaxSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMaxSdkVersion) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) TEST_LABEL_RESOURCE_ID(com.android.tools.build.bundletool.testing.ResourcesTableFactory.TEST_LABEL_RESOURCE_ID) Value(com.android.bundle.Config.SplitDimension.Value) TargetingUtils.alternativeTextureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeTextureCompressionTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) TargetingUtils.textureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionTargeting) ATC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ATC) BundleConfigBuilder(com.android.tools.build.bundletool.testing.BundleConfigBuilder) RunWith(org.junit.runner.RunWith) ImmutableList(com.google.common.collect.ImmutableList) TargetingUtils.targetedAssetsDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedAssetsDirectory) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ResourcesTableFactory.resourceTableWithTestLabel(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTableWithTestLabel) Path(java.nio.file.Path) Before(org.junit.Before) ManifestProtoUtils.withInstant(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstant) ManifestProtoUtils.withTitle(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTitle) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) IOException(java.io.IOException) Test(org.junit.Test) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) ETC1_RGB8(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ETC1_RGB8) TargetingUtils.assets(com.android.tools.build.bundletool.testing.TargetingUtils.assets) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Rule(org.junit.Rule) SubValidator(com.android.tools.build.bundletool.validation.SubValidator) ManifestProtoUtils.androidManifestForFeature(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForFeature) TargetingUtils.assetsDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.assetsDirectoryTargeting) AppBundle(com.android.tools.build.bundletool.model.AppBundle) TemporaryFolder(org.junit.rules.TemporaryFolder) AppBundle(com.android.tools.build.bundletool.model.AppBundle) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer)

Example 79 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class DumpManagerTest method dumpManifest_withXPath_noNamespaceDeclaration.

@Test
public void dumpManifest_withXPath_noNamespaceDeclaration() throws Exception {
    XmlNode manifestWithoutNamespaceDeclaration = androidManifest("com.app", withDebuggableAttribute(true), manifestElement -> manifestElement.getProto().clearNamespaceDeclaration());
    AppBundle appBundle = new AppBundleBuilder().addModule("base", module -> module.setManifest(manifestWithoutNamespaceDeclaration)).build();
    new AppBundleSerializer().writeToDisk(appBundle, bundlePath);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    DumpCommand.builder().setBundlePath(bundlePath).setDumpTarget(DumpTarget.MANIFEST).setXPathExpression("/manifest/application/@android:debuggable").setOutputStream(new PrintStream(outputStream)).build().execute();
    assertThat(new String(outputStream.toByteArray(), UTF_8).trim()).isEqualTo("true");
}
Also used : Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ManifestProtoUtils.withMetadataValue(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMetadataValue) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) RunWith(org.junit.runner.RunWith) XmlAttribute(com.android.aapt.Resources.XmlAttribute) DumpTarget(com.android.tools.build.bundletool.commands.DumpCommand.DumpTarget) Bundletool(com.android.bundle.Config.Bundletool) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) Path(java.nio.file.Path) ResourceTable(com.android.aapt.Resources.ResourceTable) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) Before(org.junit.Before) PrintStream(java.io.PrintStream) UTF_8(java.nio.charset.StandardCharsets.UTF_8) IOException(java.io.IOException) Test(org.junit.Test) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Rule(org.junit.Rule) XmlNode(com.android.aapt.Resources.XmlNode) BundleConfig(com.android.bundle.Config.BundleConfig) ManifestProtoUtils.withDebuggableAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDebuggableAttribute) XmlElement(com.android.aapt.Resources.XmlElement) Compression(com.android.bundle.Config.Compression) AppBundle(com.android.tools.build.bundletool.model.AppBundle) TemporaryFolder(org.junit.rules.TemporaryFolder) PrintStream(java.io.PrintStream) XmlNode(com.android.aapt.Resources.XmlNode) AppBundle(com.android.tools.build.bundletool.model.AppBundle) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 80 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class DumpManagerTest method dumpManifest_withXPath_nodeResult.

@Test
public void dumpManifest_withXPath_nodeResult() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", module -> module.setManifest(androidManifest("com.app", withMetadataValue("key1", "value1"), withMetadataValue("key2", "value2")))).build();
    new AppBundleSerializer().writeToDisk(appBundle, bundlePath);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    DumpCommand dumpCommand = DumpCommand.builder().setBundlePath(bundlePath).setDumpTarget(DumpTarget.MANIFEST).setXPathExpression("/manifest/application/meta-data").setOutputStream(new PrintStream(outputStream)).build();
    assertThrows(UnsupportedOperationException.class, () -> dumpCommand.execute());
}
Also used : Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ManifestProtoUtils.withMetadataValue(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMetadataValue) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) RunWith(org.junit.runner.RunWith) XmlAttribute(com.android.aapt.Resources.XmlAttribute) DumpTarget(com.android.tools.build.bundletool.commands.DumpCommand.DumpTarget) Bundletool(com.android.bundle.Config.Bundletool) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) Path(java.nio.file.Path) ResourceTable(com.android.aapt.Resources.ResourceTable) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) Before(org.junit.Before) PrintStream(java.io.PrintStream) UTF_8(java.nio.charset.StandardCharsets.UTF_8) IOException(java.io.IOException) Test(org.junit.Test) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Rule(org.junit.Rule) XmlNode(com.android.aapt.Resources.XmlNode) BundleConfig(com.android.bundle.Config.BundleConfig) ManifestProtoUtils.withDebuggableAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDebuggableAttribute) XmlElement(com.android.aapt.Resources.XmlElement) Compression(com.android.bundle.Config.Compression) AppBundle(com.android.tools.build.bundletool.model.AppBundle) TemporaryFolder(org.junit.rules.TemporaryFolder) PrintStream(java.io.PrintStream) AppBundle(com.android.tools.build.bundletool.model.AppBundle) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

AppBundleBuilder (com.android.tools.build.bundletool.testing.AppBundleBuilder)155 Test (org.junit.Test)153 AppBundle (com.android.tools.build.bundletool.model.AppBundle)134 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)123 Truth.assertThat (com.google.common.truth.Truth.assertThat)123 RunWith (org.junit.runner.RunWith)123 Path (java.nio.file.Path)113 ZipFile (java.util.zip.ZipFile)113 Before (org.junit.Before)113 Rule (org.junit.Rule)113 TemporaryFolder (org.junit.rules.TemporaryFolder)113 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)112 AppBundleSerializer (com.android.tools.build.bundletool.io.AppBundleSerializer)105 ImmutableList (com.google.common.collect.ImmutableList)102 BuildApksResult (com.android.bundle.Commands.BuildApksResult)101 Variant (com.android.bundle.Commands.Variant)94 InvalidBundleException (com.android.tools.build.bundletool.model.exceptions.InvalidBundleException)91 AndroidManifest (com.android.tools.build.bundletool.model.AndroidManifest)88 ApkDescription (com.android.bundle.Commands.ApkDescription)87 BundleConfig (com.android.bundle.Config.BundleConfig)87