Search in sources :

Example 6 with SystemEnvironmentProvider

use of com.android.tools.build.bundletool.model.utils.SystemEnvironmentProvider in project bundletool by google.

the class BuildApksCommandTest method noKeystoreProvidedPrintsWarning_debugKeystore.

@Test
public void noKeystoreProvidedPrintsWarning_debugKeystore() throws Exception {
    Path debugKeystorePath = tmpDir.resolve(".android").resolve("debug.keystore");
    FileUtils.createParentDirectories(debugKeystorePath);
    createDebugKeystore(debugKeystorePath, DEBUG_KEYSTORE_PASSWORD, DEBUG_KEY_ALIAS, DEBUG_KEY_PASSWORD);
    SystemEnvironmentProvider provider = new FakeSystemEnvironmentProvider(/* variables= */
    ImmutableMap.of(ANDROID_HOME, "/android/home", ANDROID_SERIAL, DEVICE_ID), /* properties= */
    ImmutableMap.of(USER_HOME.key(), tmpDir.toString()));
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH), new PrintStream(output), provider, fakeAdbServer);
    assertThat(new String(output.toByteArray(), UTF_8)).contains("INFO: The APKs will be signed with the debug keystore");
}
Also used : Path(java.nio.file.Path) ZipPath(com.android.tools.build.bundletool.model.ZipPath) PrintStream(java.io.PrintStream) FakeSystemEnvironmentProvider(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider) FakeSystemEnvironmentProvider(com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider) SystemEnvironmentProvider(com.android.tools.build.bundletool.model.utils.SystemEnvironmentProvider) ByteArrayOutputStream(java.io.ByteArrayOutputStream) FlagParser(com.android.tools.build.bundletool.flags.FlagParser) Test(org.junit.Test)

Aggregations

SystemEnvironmentProvider (com.android.tools.build.bundletool.model.utils.SystemEnvironmentProvider)6 FakeSystemEnvironmentProvider (com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider)6 Test (org.junit.Test)6 FlagParser (com.android.tools.build.bundletool.flags.FlagParser)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 PrintStream (java.io.PrintStream)5 Path (java.nio.file.Path)4 ZipPath (com.android.tools.build.bundletool.model.ZipPath)3 ApksigSigningConfiguration (com.android.tools.build.bundletool.model.ApksigSigningConfiguration)1 SigningConfiguration (com.android.tools.build.bundletool.model.SigningConfiguration)1 InvalidCommandException (com.android.tools.build.bundletool.model.exceptions.InvalidCommandException)1 DefaultSystemEnvironmentProvider (com.android.tools.build.bundletool.model.utils.DefaultSystemEnvironmentProvider)1