use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class BuildApksCommandTest method keystoreProvidedDoesNotPrintWarning.
@Test
public void keystoreProvidedDoesNotPrintWarning() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD), new PrintStream(output), systemEnvironmentProvider, fakeAdbServer);
assertThat(new String(output.toByteArray(), UTF_8)).doesNotContain("WARNING: The APKs won't be signed");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class BuildApksCommandTest method populateLineage_invalidFile.
@Test
public void populateLineage_invalidFile() {
CommandExecutionException e = assertThrows(CommandExecutionException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD, "--lineage=" + tmp.newFile(), "--oldest-signer=" + oldestSignerPropertiesPath), fakeAdbServer));
assertThat(e).hasMessageThat().isEqualTo("The input file is not a valid lineage file.");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class BuildApksCommandTest method badTransparencyFile_throws.
@Test
public void badTransparencyFile_throws() throws Exception {
createAppBundle(bundlePath, Optional.of(CodeTransparency.newBuilder().addCodeRelatedFile(CodeRelatedFile.newBuilder().setType(DEX).setApkPath("non/existent/path/dex.file").setSha256("sha-256")).build()));
ParsedFlags flags = new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath);
BuildApksCommand command = BuildApksCommand.fromFlags(flags, fakeAdbServer);
Throwable e = assertThrows(InvalidBundleException.class, command::execute);
assertThat(e).hasMessageThat().contains("Verification failed because code was modified after transparency metadata" + " generation.");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class BuildApksCommandTest method keystoreFlags_keyAliasNotSet.
@Test
public void keystoreFlags_keyAliasNotSet() {
InvalidCommandException e = assertThrows(InvalidCommandException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--ks=" + keystorePath), fakeAdbServer));
assertThat(e).hasMessageThat().isEqualTo("Flag --ks-key-alias is required when --ks is set.");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class BuildApksCommandTest method bundleNotSet_throws.
@Test
public void bundleNotSet_throws() throws Exception {
expectMissingRequiredBuilderPropertyException("bundlePath", () -> BuildApksCommand.builder().setOutputFile(outputFilePath).setAapt2Command(aapt2Command).build());
expectMissingRequiredFlagException("bundle", () -> BuildApksCommand.fromFlags(new FlagParser().parse("--output=" + outputFilePath), fakeAdbServer));
}
Aggregations