use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class GetDeviceSpecCommandTest method fromFlagsEquivalentToBuilder_withEnvironmentalVariables.
@Test
public void fromFlagsEquivalentToBuilder_withEnvironmentalVariables() {
Path outputPath = tmpDir.resolve("device.json");
GetDeviceSpecCommand commandViaFlags = GetDeviceSpecCommand.fromFlags(new FlagParser().parse("--adb=" + adbPath, "--output=" + outputPath), systemEnvironmentProvider, fakeServerOneDevice(lDeviceWithLocales("en-US")));
GetDeviceSpecCommand commandViaBuilder = GetDeviceSpecCommand.builder().setAdbPath(adbPath).setDeviceId(DEVICE_ID).setOutputPath(outputPath).setAdbServer(commandViaFlags.getAdbServer()).build();
assertThat(commandViaFlags).isEqualTo(commandViaBuilder);
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class ExtractApksCommandTest method builderAndFlagsConstruction_optionalInstantFalse_equivalent.
@Test
public void builderAndFlagsConstruction_optionalInstantFalse_equivalent() throws Exception {
DeviceSpec deviceSpec = deviceWithSdk(21);
Path deviceSpecFile = createDeviceSpecFile(deviceSpec, tmpDir.resolve("device.json"));
BuildApksResult tableOfContentsProto = minimalApkSet();
Path apksArchiveFile = createApksArchiveFile(tableOfContentsProto, tmpDir.resolve("bundle.apks"));
ExtractApksCommand fromFlags = ExtractApksCommand.fromFlags(new FlagParser().parse("--device-spec=" + deviceSpecFile, "--apks=" + apksArchiveFile));
ExtractApksCommand fromBuilderApi = ExtractApksCommand.builder().setApksArchivePath(apksArchiveFile).setDeviceSpec(deviceSpec).setInstant(false).build();
assertThat(fromFlags).isEqualTo(fromBuilderApi);
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class CheckTransparencyCommandTest method buildingCommandViaFlags_bundleMode_adbPathSet.
@Test
public void buildingCommandViaFlags_bundleMode_adbPathSet() {
Throwable e = assertThrows(UnknownFlagsException.class, () -> CheckTransparencyCommand.fromFlags(new FlagParser().parse("--mode=BUNDLE", "--bundle=" + bundlePath, "--adb=path/to/adb"), systemEnvironmentProvider, fakeAdbServer));
assertThat(e).hasMessageThat().contains("Unrecognized flags");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class CheckTransparencyCommandTest method buildingCommandViaFlags_modeNotSet.
@Test
public void buildingCommandViaFlags_modeNotSet() {
Throwable e = assertThrows(RequiredFlagNotSetException.class, () -> CheckTransparencyCommand.fromFlags(new FlagParser().parse(), systemEnvironmentProvider, fakeAdbServer));
assertThat(e).hasMessageThat().contains("Missing the required --mode flag");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class DumpCommandTest method dumpInvalidTarget.
@Test
public void dumpInvalidTarget() {
InvalidCommandException exception = assertThrows(InvalidCommandException.class, () -> DumpCommand.fromFlags(new FlagParser().parse("dump", "blah", "--bundle=" + bundlePath)));
assertThat(exception).hasMessageThat().matches("Unrecognized dump target: 'blah'. Accepted values are: .*");
}
Aggregations