use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class BuildApksDeviceSpecTest method deviceSpecFlags_inJavaViaProtos_equivalent.
@Test
public void deviceSpecFlags_inJavaViaProtos_equivalent() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
DeviceSpec deviceSpec = deviceWithSdk(28);
Path deviceSpecPath = createDeviceSpecFile(deviceSpec, tmpDir.resolve("device.json"));
BuildApksCommand commandViaFlags = BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--device-spec=" + deviceSpecPath), new PrintStream(output), systemEnvironmentProvider, fakeAdbServer);
BuildApksCommand.Builder commandViaBuilder = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setDeviceSpec(deviceSpec).setExecutorServiceInternal(commandViaFlags.getExecutorService()).setExecutorServiceCreatedByBundleTool(true).setOutputPrintStream(commandViaFlags.getOutputPrintStream().get());
DebugKeystoreUtils.getDebugSigningConfiguration(systemEnvironmentProvider).ifPresent(commandViaBuilder::setSigningConfiguration);
assertThat(commandViaBuilder.build()).isEqualTo(commandViaFlags);
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class BuildApksDeviceSpecTest method deviceSpecFlags_inJavaViaFiles_equivalent.
@Test
public void deviceSpecFlags_inJavaViaFiles_equivalent() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
DeviceSpec deviceSpec = deviceWithSdk(28);
Path deviceSpecPath = createDeviceSpecFile(deviceSpec, tmpDir.resolve("device.json"));
BuildApksCommand commandViaFlags = BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--device-spec=" + deviceSpecPath), new PrintStream(output), systemEnvironmentProvider, fakeAdbServer);
BuildApksCommand.Builder commandViaBuilder = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setDeviceSpec(deviceSpecPath).setExecutorServiceInternal(commandViaFlags.getExecutorService()).setExecutorServiceCreatedByBundleTool(true).setOutputPrintStream(commandViaFlags.getOutputPrintStream().get());
DebugKeystoreUtils.getDebugSigningConfiguration(systemEnvironmentProvider).ifPresent(commandViaBuilder::setSigningConfiguration);
assertThat(commandViaBuilder.build()).isEqualTo(commandViaFlags);
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class AddTransparencyCommandTest method buildingCommandViaFlags_injectSignatureMode_missingRequiredFlag.
@Test
public void buildingCommandViaFlags_injectSignatureMode_missingRequiredFlag() {
Throwable e = assertThrows(RequiredFlagNotSetException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--mode=inject_signature", "--bundle=" + bundlePath, "--output=" + outputBundlePath, "--transparency-key-certificate=" + transparencyKeyCertificatePath)));
assertThat(e).hasMessageThat().contains("Missing the required --transparency-signature flag");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class AddTransparencyCommandTest method buildingCommandViaFlags_defaultMode_outputPathNotSet.
@Test
public void buildingCommandViaFlags_defaultMode_outputPathNotSet() {
Throwable e = assertThrows(RequiredFlagNotSetException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD)));
assertThat(e).hasMessageThat().contains("Missing the required --output flag");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class AddTransparencyCommandTest method buildingCommandViaFlags_generateCodeTransparencyFileMode_missingRequiredFlag.
@Test
public void buildingCommandViaFlags_generateCodeTransparencyFileMode_missingRequiredFlag() {
Throwable e = assertThrows(RequiredFlagNotSetException.class, () -> AddTransparencyCommand.fromFlags(new FlagParser().parse("--mode=generate_code_transparency_file", "--bundle=" + bundlePath, "--output=" + outputUnsignedTransparencyFilePath)));
assertThat(e).hasMessageThat().contains("Missing the required --transparency-key-certificate flag");
}
Aggregations