Search in sources :

Example 61 with FlagParser

use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.

the class AddTransparencyCommandTest method buildingCommandViaFlags_generateCodeTransparencyFileMode_unrecognizedFlag.

@Test
public void buildingCommandViaFlags_generateCodeTransparencyFileMode_unrecognizedFlag() {
    Throwable e = assertThrows(UnknownFlagsException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--mode=generate_code_transparency_file", "--bundle=" + bundlePath, "--output=" + outputUnsignedTransparencyFilePath, "--transparency-key-certificate=" + transparencyKeyCertificatePath, "--ks=" + keystorePath)));
    assertThat(e).hasMessageThat().contains("Unrecognized flags");
}
Also used : FlagParser(com.android.tools.build.bundletool.flags.FlagParser) Test(org.junit.Test)

Example 62 with FlagParser

use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.

the class AddTransparencyCommandTest method buildingCommandViaFlags_defaultMode_transparencyKeyCertificateFlagSet.

@Test
public void buildingCommandViaFlags_defaultMode_transparencyKeyCertificateFlagSet() {
    Throwable e = assertThrows(UnknownFlagsException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputBundlePath, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD, "--transparency-key-certificate=" + transparencyKeyCertificatePath)));
    assertThat(e).hasMessageThat().contains("Unrecognized flags");
}
Also used : FlagParser(com.android.tools.build.bundletool.flags.FlagParser) Test(org.junit.Test)

Example 63 with FlagParser

use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.

the class AddTransparencyCommandTest method buildingCommandViaFlags_defaultMode_keyAliasNotSet.

@Test
public void buildingCommandViaFlags_defaultMode_keyAliasNotSet() {
    Throwable e = assertThrows(RequiredFlagNotSetException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputBundlePath, "--ks=" + keystorePath, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD)));
    assertThat(e).hasMessageThat().contains("Missing the required --ks-key-alias flag");
}
Also used : FlagParser(com.android.tools.build.bundletool.flags.FlagParser) Test(org.junit.Test)

Example 64 with FlagParser

use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.

the class AddTransparencyCommandTest method buildingCommandViaFlags_defaultMode_bundlePathNotSet.

@Test
public void buildingCommandViaFlags_defaultMode_bundlePathNotSet() {
    Throwable e = assertThrows(RequiredFlagNotSetException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--output=" + outputBundlePath, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD)));
    assertThat(e).hasMessageThat().contains("Missing the required --bundle flag");
}
Also used : FlagParser(com.android.tools.build.bundletool.flags.FlagParser) Test(org.junit.Test)

Example 65 with FlagParser

use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.

the class AddTransparencyCommandTest method buildingCommandViaFlags_defaultMode_keystoreNotSet.

@Test
public void buildingCommandViaFlags_defaultMode_keystoreNotSet() {
    Throwable e = assertThrows(RequiredFlagNotSetException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputBundlePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD)));
    assertThat(e).hasMessageThat().contains("Missing the required --ks flag");
}
Also used : FlagParser(com.android.tools.build.bundletool.flags.FlagParser) Test(org.junit.Test)

Aggregations

FlagParser (com.android.tools.build.bundletool.flags.FlagParser)138 Test (org.junit.Test)137 Path (java.nio.file.Path)63 ZipPath (com.android.tools.build.bundletool.model.ZipPath)55 ByteArrayOutputStream (java.io.ByteArrayOutputStream)29 PrintStream (java.io.PrintStream)29 BuildApksResult (com.android.bundle.Commands.BuildApksResult)22 InvalidCommandException (com.android.tools.build.bundletool.model.exceptions.InvalidCommandException)20 DeviceSpec (com.android.bundle.Devices.DeviceSpec)13 ParsedFlags (com.android.tools.build.bundletool.flags.ParsedFlags)12 ApksigSigningConfiguration (com.android.tools.build.bundletool.model.ApksigSigningConfiguration)10 SigningConfiguration (com.android.tools.build.bundletool.model.SigningConfiguration)10 FlagParseException (com.android.tools.build.bundletool.flags.FlagParser.FlagParseException)8 CommandExecutionException (com.android.tools.build.bundletool.model.exceptions.CommandExecutionException)8 InvalidBundleException (com.android.tools.build.bundletool.model.exceptions.InvalidBundleException)8 TestUtils.expectMissingRequiredBuilderPropertyException (com.android.tools.build.bundletool.testing.TestUtils.expectMissingRequiredBuilderPropertyException)8 TestUtils.expectMissingRequiredFlagException (com.android.tools.build.bundletool.testing.TestUtils.expectMissingRequiredFlagException)8 IOException (java.io.IOException)8 JoseException (org.jose4j.lang.JoseException)7 FakeSystemEnvironmentProvider (com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider)6