Search in sources :

Example 1 with AppBundleSerializer

use of com.android.tools.build.bundletool.io.AppBundleSerializer in project bundletool by google.

the class AddTransparencyCommandTest method createBundle.

private static void createBundle(Path path, boolean hasSharedUserId, int minSdkVersion) throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule(BASE_MODULE, module -> addCodeFilesToBundleModule(module, hasSharedUserId, minSdkVersion)).addModule(FEATURE_MODULE1, module -> addCodeFilesToBundleModule(module, hasSharedUserId, minSdkVersion)).addModule(FEATURE_MODULE2, module -> addCodeFilesToBundleModule(module, hasSharedUserId, minSdkVersion)).build();
    new AppBundleSerializer().writeToDisk(appBundle, path);
}
Also used : KeyPair(java.security.KeyPair) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) Mode(com.android.tools.build.bundletool.commands.AddTransparencyCommand.Mode) ZipFile(java.util.zip.ZipFile) Splitter(com.google.common.base.Splitter) Path(java.nio.file.Path) Theory(org.junit.experimental.theories.Theory) KeyPairGenerator(java.security.KeyPairGenerator) JsonWebSignature(org.jose4j.jws.JsonWebSignature) MIN_RSA_KEY_LENGTH(com.android.tools.build.bundletool.commands.AddTransparencyCommand.MIN_RSA_KEY_LENGTH) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) RequiredFlagNotSetException(com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException) Signature(java.security.Signature) RSA_USING_SHA256(org.jose4j.jws.AlgorithmIdentifiers.RSA_USING_SHA256) KeyStore(java.security.KeyStore) FlagParser(com.android.tools.build.bundletool.flags.FlagParser) ManifestProtoUtils.withMinSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMinSdkVersion) List(java.util.List) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Certificate(java.security.cert.Certificate) JsonFormat(com.google.protobuf.util.JsonFormat) Password(com.android.tools.build.bundletool.model.Password) PrivateKey(java.security.PrivateKey) SignerConfig(com.android.tools.build.bundletool.model.SignerConfig) CodeTransparencyVersion(com.android.tools.build.bundletool.transparency.CodeTransparencyVersion) Optional(java.util.Optional) CodeTransparency(com.android.bundle.CodeTransparencyOuterClass.CodeTransparency) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) RunWith(org.junit.runner.RunWith) Hashing(com.google.common.hash.Hashing) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) UnknownFlagsException(com.android.tools.build.bundletool.flags.ParsedFlags.UnknownFlagsException) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) Theories(org.junit.experimental.theories.Theories) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) CharSource(com.google.common.io.CharSource) ByteSource(com.google.common.io.ByteSource) CodeTransparencyTestUtils.createJwsToken(com.android.tools.build.bundletool.testing.CodeTransparencyTestUtils.createJwsToken) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) CodeTransparencyFactory(com.android.tools.build.bundletool.transparency.CodeTransparencyFactory) Before(org.junit.Before) CertificateFactory(com.android.tools.build.bundletool.testing.CertificateFactory) BaseEncoding(com.google.common.io.BaseEncoding) Files(java.nio.file.Files) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) Test(org.junit.Test) BUNDLETOOL_NAMESPACE(com.android.tools.build.bundletool.model.BundleMetadata.BUNDLETOOL_NAMESPACE) BundleMetadata(com.android.tools.build.bundletool.model.BundleMetadata) Truth.assertThat(com.google.common.truth.Truth.assertThat) ManifestProtoUtils.withSharedUserId(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withSharedUserId) Rule(org.junit.Rule) XmlNode(com.android.aapt.Resources.XmlNode) InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) AddTransparencyCommand.createJwtWithoutSignature(com.android.tools.build.bundletool.commands.AddTransparencyCommand.createJwtWithoutSignature) AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModule(com.android.tools.build.bundletool.model.BundleModule) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) DexMergingChoice(com.android.tools.build.bundletool.commands.AddTransparencyCommand.DexMergingChoice) 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 2 with AppBundleSerializer

use of com.android.tools.build.bundletool.io.AppBundleSerializer in project bundletool by google.

the class BuildApksCommandTest method createAppBundle.

private void createAppBundle(Path path, Optional<CodeTransparency> codeTransparency) throws Exception {
    AppBundleBuilder appBundle = new AppBundleBuilder().addModule("base", module -> module.setManifest(androidManifest("com.app")).build());
    if (codeTransparency.isPresent()) {
        appBundle.addMetadataFile(BundleMetadata.BUNDLETOOL_NAMESPACE, BundleMetadata.TRANSPARENCY_SIGNED_FILE_NAME, CharSource.wrap(createJwsToken(JsonFormat.printer().print(codeTransparency.get()))).asByteSource(Charset.defaultCharset()));
    }
    new AppBundleSerializer().writeToDisk(appBundle.build(), path);
}
Also used : AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer)

Example 3 with AppBundleSerializer

use of com.android.tools.build.bundletool.io.AppBundleSerializer in project bundletool by google.

the class CheckTransparencyCommandTest method bundleMode_unsupportedSignatureAlgorithm.

@Test
public void bundleMode_unsupportedSignatureAlgorithm() throws Exception {
    String serializedJws = createJwsToken(CodeTransparency.getDefaultInstance(), transparencyKeyCertificate, transparencyPrivateKey, RSA_USING_SHA384);
    AppBundleBuilder appBundle = new AppBundleBuilder().addModule("base", module -> module.setManifest(androidManifest("com.test.app"))).addMetadataFile(BundleMetadata.BUNDLETOOL_NAMESPACE, BundleMetadata.TRANSPARENCY_SIGNED_FILE_NAME, CharSource.wrap(serializedJws).asByteSource(Charset.defaultCharset()));
    new AppBundleSerializer().writeToDisk(appBundle.build(), bundlePath);
    Throwable e = assertThrows(CommandExecutionException.class, () -> CheckTransparencyCommand.builder().setMode(Mode.BUNDLE).setBundlePath(bundlePath).build().checkTransparency(new PrintStream(new ByteArrayOutputStream())));
    assertThat(e).hasMessageThat().contains("Exception while verifying code transparency signature.");
}
Also used : X509Certificate(java.security.cert.X509Certificate) KeyPair(java.security.KeyPair) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) ZipBuilder(com.android.tools.build.bundletool.io.ZipBuilder) Mode(com.android.tools.build.bundletool.commands.CheckTransparencyCommand.Mode) Path(java.nio.file.Path) FakeSystemEnvironmentProvider(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider) KeyPairGenerator(java.security.KeyPairGenerator) JsonWebSignature(org.jose4j.jws.JsonWebSignature) ImmutableMap(com.google.common.collect.ImmutableMap) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) RequiredFlagNotSetException(com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException) ApkSerializer(com.android.tools.build.bundletool.io.ApkSerializer) FlagParser(com.android.tools.build.bundletool.flags.FlagParser) ByteString(com.google.protobuf.ByteString) SystemEnvironmentProvider(com.android.tools.build.bundletool.model.utils.SystemEnvironmentProvider) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) PrivateKey(java.security.PrivateKey) ModuleEntry(com.android.tools.build.bundletool.model.ModuleEntry) SignerConfig(com.android.tools.build.bundletool.model.SignerConfig) CodeTransparencyCryptoUtils(com.android.tools.build.bundletool.transparency.CodeTransparencyCryptoUtils) CodeTransparencyVersion(com.android.tools.build.bundletool.transparency.CodeTransparencyVersion) CodeTransparency(com.android.bundle.CodeTransparencyOuterClass.CodeTransparency) Mockito.mock(org.mockito.Mockito.mock) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) TestModule(com.android.tools.build.bundletool.testing.TestModule) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) ZipPath(com.android.tools.build.bundletool.model.ZipPath) RunWith(org.junit.runner.RunWith) Hashing(com.google.common.hash.Hashing) Component(dagger.Component) RSA_USING_SHA384(org.jose4j.jws.AlgorithmIdentifiers.RSA_USING_SHA384) SigningConfiguration(com.android.tools.build.bundletool.model.SigningConfiguration) Inject(javax.inject.Inject) UnknownFlagsException(com.android.tools.build.bundletool.flags.ParsedFlags.UnknownFlagsException) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ANDROID_SERIAL(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider.ANDROID_SERIAL) CharSource(com.google.common.io.CharSource) ByteSource(com.google.common.io.ByteSource) CodeTransparencyTestUtils.createJwsToken(com.android.tools.build.bundletool.testing.CodeTransparencyTestUtils.createJwsToken) ANDROID_HOME(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider.ANDROID_HOME) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) AdbServer(com.android.tools.build.bundletool.device.AdbServer) Before(org.junit.Before) PrintStream(java.io.PrintStream) CertificateFactory(com.android.tools.build.bundletool.testing.CertificateFactory) Files(java.nio.file.Files) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Test(org.junit.Test) BundleMetadata(com.android.tools.build.bundletool.model.BundleMetadata) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) Rule(org.junit.Rule) Paths(java.nio.file.Paths) InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) TemporaryFolder(org.junit.rules.TemporaryFolder) PrintStream(java.io.PrintStream) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ByteString(com.google.protobuf.ByteString) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 4 with AppBundleSerializer

use of com.android.tools.build.bundletool.io.AppBundleSerializer in project bundletool by google.

the class CheckTransparencyCommandTest method bundleMode_transparencyVerified_codeTransparencyVersionNotSet.

@Test
public void bundleMode_transparencyVerified_codeTransparencyVersionNotSet() throws Exception {
    String serializedJws = createJwsToken(CodeTransparency.getDefaultInstance(), transparencyKeyCertificate, transparencyPrivateKey);
    AppBundleBuilder appBundle = new AppBundleBuilder().addModule("base", module -> module.setManifest(androidManifest("com.test.app"))).addMetadataFile(BundleMetadata.BUNDLETOOL_NAMESPACE, BundleMetadata.TRANSPARENCY_SIGNED_FILE_NAME, CharSource.wrap(serializedJws).asByteSource(Charset.defaultCharset()));
    new AppBundleSerializer().writeToDisk(appBundle.build(), bundlePath);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    CheckTransparencyCommand.builder().setMode(Mode.BUNDLE).setBundlePath(bundlePath).setTransparencyKeyCertificate(transparencyKeyCertificate).build().checkTransparency(new PrintStream(outputStream));
    String output = new String(outputStream.toByteArray(), UTF_8);
    assertThat(output).contains("No APK present. APK signature was not checked.");
    assertThat(output).contains("Code transparency signature verified for the provided code transparency key" + " certificate.");
    assertThat(output).contains("Code transparency verified: code related file contents match the code transparency" + " file.");
}
Also used : X509Certificate(java.security.cert.X509Certificate) KeyPair(java.security.KeyPair) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) ZipBuilder(com.android.tools.build.bundletool.io.ZipBuilder) Mode(com.android.tools.build.bundletool.commands.CheckTransparencyCommand.Mode) Path(java.nio.file.Path) FakeSystemEnvironmentProvider(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider) KeyPairGenerator(java.security.KeyPairGenerator) JsonWebSignature(org.jose4j.jws.JsonWebSignature) ImmutableMap(com.google.common.collect.ImmutableMap) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) RequiredFlagNotSetException(com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException) ApkSerializer(com.android.tools.build.bundletool.io.ApkSerializer) FlagParser(com.android.tools.build.bundletool.flags.FlagParser) ByteString(com.google.protobuf.ByteString) SystemEnvironmentProvider(com.android.tools.build.bundletool.model.utils.SystemEnvironmentProvider) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) PrivateKey(java.security.PrivateKey) ModuleEntry(com.android.tools.build.bundletool.model.ModuleEntry) SignerConfig(com.android.tools.build.bundletool.model.SignerConfig) CodeTransparencyCryptoUtils(com.android.tools.build.bundletool.transparency.CodeTransparencyCryptoUtils) CodeTransparencyVersion(com.android.tools.build.bundletool.transparency.CodeTransparencyVersion) CodeTransparency(com.android.bundle.CodeTransparencyOuterClass.CodeTransparency) Mockito.mock(org.mockito.Mockito.mock) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) TestModule(com.android.tools.build.bundletool.testing.TestModule) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) ZipPath(com.android.tools.build.bundletool.model.ZipPath) RunWith(org.junit.runner.RunWith) Hashing(com.google.common.hash.Hashing) Component(dagger.Component) RSA_USING_SHA384(org.jose4j.jws.AlgorithmIdentifiers.RSA_USING_SHA384) SigningConfiguration(com.android.tools.build.bundletool.model.SigningConfiguration) Inject(javax.inject.Inject) UnknownFlagsException(com.android.tools.build.bundletool.flags.ParsedFlags.UnknownFlagsException) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ANDROID_SERIAL(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider.ANDROID_SERIAL) CharSource(com.google.common.io.CharSource) ByteSource(com.google.common.io.ByteSource) CodeTransparencyTestUtils.createJwsToken(com.android.tools.build.bundletool.testing.CodeTransparencyTestUtils.createJwsToken) ANDROID_HOME(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider.ANDROID_HOME) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) AdbServer(com.android.tools.build.bundletool.device.AdbServer) Before(org.junit.Before) PrintStream(java.io.PrintStream) CertificateFactory(com.android.tools.build.bundletool.testing.CertificateFactory) Files(java.nio.file.Files) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Test(org.junit.Test) BundleMetadata(com.android.tools.build.bundletool.model.BundleMetadata) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) Rule(org.junit.Rule) Paths(java.nio.file.Paths) InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) TemporaryFolder(org.junit.rules.TemporaryFolder) PrintStream(java.io.PrintStream) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ByteString(com.google.protobuf.ByteString) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 5 with AppBundleSerializer

use of com.android.tools.build.bundletool.io.AppBundleSerializer in project bundletool by google.

the class CheckTransparencyCommandTest method bundleMode_unsupportedCodeTransparencyVersion.

@Test
public void bundleMode_unsupportedCodeTransparencyVersion() throws Exception {
    String serializedJws = createJwsToken(CodeTransparency.newBuilder().setVersion(CodeTransparencyVersion.getCurrentVersion() + 1).build(), transparencyKeyCertificate, transparencyPrivateKey);
    AppBundleBuilder appBundle = new AppBundleBuilder().addModule("base", module -> module.setManifest(androidManifest("com.test.app"))).addMetadataFile(BundleMetadata.BUNDLETOOL_NAMESPACE, BundleMetadata.TRANSPARENCY_SIGNED_FILE_NAME, CharSource.wrap(serializedJws).asByteSource(Charset.defaultCharset()));
    new AppBundleSerializer().writeToDisk(appBundle.build(), bundlePath);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    Throwable e = assertThrows(IllegalStateException.class, () -> CheckTransparencyCommand.builder().setMode(Mode.BUNDLE).setBundlePath(bundlePath).setTransparencyKeyCertificate(transparencyKeyCertificate).build().checkTransparency(new PrintStream(outputStream)));
    assertThat(e).hasMessageThat().contains("Code transparency file has unsupported version.");
}
Also used : X509Certificate(java.security.cert.X509Certificate) KeyPair(java.security.KeyPair) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) ZipBuilder(com.android.tools.build.bundletool.io.ZipBuilder) Mode(com.android.tools.build.bundletool.commands.CheckTransparencyCommand.Mode) Path(java.nio.file.Path) FakeSystemEnvironmentProvider(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider) KeyPairGenerator(java.security.KeyPairGenerator) JsonWebSignature(org.jose4j.jws.JsonWebSignature) ImmutableMap(com.google.common.collect.ImmutableMap) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) RequiredFlagNotSetException(com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException) ApkSerializer(com.android.tools.build.bundletool.io.ApkSerializer) FlagParser(com.android.tools.build.bundletool.flags.FlagParser) ByteString(com.google.protobuf.ByteString) SystemEnvironmentProvider(com.android.tools.build.bundletool.model.utils.SystemEnvironmentProvider) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) PrivateKey(java.security.PrivateKey) ModuleEntry(com.android.tools.build.bundletool.model.ModuleEntry) SignerConfig(com.android.tools.build.bundletool.model.SignerConfig) CodeTransparencyCryptoUtils(com.android.tools.build.bundletool.transparency.CodeTransparencyCryptoUtils) CodeTransparencyVersion(com.android.tools.build.bundletool.transparency.CodeTransparencyVersion) CodeTransparency(com.android.bundle.CodeTransparencyOuterClass.CodeTransparency) Mockito.mock(org.mockito.Mockito.mock) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) TestModule(com.android.tools.build.bundletool.testing.TestModule) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) ZipPath(com.android.tools.build.bundletool.model.ZipPath) RunWith(org.junit.runner.RunWith) Hashing(com.google.common.hash.Hashing) Component(dagger.Component) RSA_USING_SHA384(org.jose4j.jws.AlgorithmIdentifiers.RSA_USING_SHA384) SigningConfiguration(com.android.tools.build.bundletool.model.SigningConfiguration) Inject(javax.inject.Inject) UnknownFlagsException(com.android.tools.build.bundletool.flags.ParsedFlags.UnknownFlagsException) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ANDROID_SERIAL(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider.ANDROID_SERIAL) CharSource(com.google.common.io.CharSource) ByteSource(com.google.common.io.ByteSource) CodeTransparencyTestUtils.createJwsToken(com.android.tools.build.bundletool.testing.CodeTransparencyTestUtils.createJwsToken) ANDROID_HOME(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider.ANDROID_HOME) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) AdbServer(com.android.tools.build.bundletool.device.AdbServer) Before(org.junit.Before) PrintStream(java.io.PrintStream) CertificateFactory(com.android.tools.build.bundletool.testing.CertificateFactory) Files(java.nio.file.Files) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Test(org.junit.Test) BundleMetadata(com.android.tools.build.bundletool.model.BundleMetadata) JUnit4(org.junit.runners.JUnit4) Truth.assertThat(com.google.common.truth.Truth.assertThat) Rule(org.junit.Rule) Paths(java.nio.file.Paths) InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) TemporaryFolder(org.junit.rules.TemporaryFolder) PrintStream(java.io.PrintStream) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ByteString(com.google.protobuf.ByteString) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

AppBundleSerializer (com.android.tools.build.bundletool.io.AppBundleSerializer)32 AppBundleBuilder (com.android.tools.build.bundletool.testing.AppBundleBuilder)27 Test (org.junit.Test)27 AppBundle (com.android.tools.build.bundletool.model.AppBundle)25 Path (java.nio.file.Path)25 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)24 Truth.assertThat (com.google.common.truth.Truth.assertThat)24 Before (org.junit.Before)24 Rule (org.junit.Rule)24 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)24 TemporaryFolder (org.junit.rules.TemporaryFolder)24 RunWith (org.junit.runner.RunWith)24 JUnit4 (org.junit.runners.JUnit4)23 IOException (java.io.IOException)18 ByteArrayOutputStream (java.io.ByteArrayOutputStream)17 PrintStream (java.io.PrintStream)17 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)17 ImmutableList (com.google.common.collect.ImmutableList)15 XmlNode (com.android.aapt.Resources.XmlNode)7 CodeRelatedFile (com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile)7