Search in sources :

Example 1 with BundleConfigBuilder

use of com.android.tools.build.bundletool.testing.BundleConfigBuilder in project bundletool by google.

the class BuildBundleCommandTest method bundleConfig_saved.

@Test
public void bundleConfig_saved() throws Exception {
    Path module = createSimpleBaseModule();
    // Any version supplied by the user is ignored and overwritten.
    BundleConfig bundleConfigFromUser = BundleConfigBuilder.create().setVersion("0.0.0").build();
    BundleConfig bundleConfigInBundle = new BundleConfigBuilder(bundleConfigFromUser).setVersion(BundleToolVersion.getCurrentVersion().toString()).build();
    assertThat(bundleConfigFromUser.getBundletool().getVersion()).isNotEqualTo(bundleConfigInBundle.getBundletool().getVersion());
    BuildBundleCommand.builder().setModulesPaths(ImmutableList.of(module)).setOutputPath(bundlePath).setBundleConfig(bundleConfigFromUser).build().execute();
    try (ZipFile appBundleZip = new ZipFile(bundlePath.toFile())) {
        AppBundle appBundle = AppBundle.buildFromZip(appBundleZip);
        assertThat(appBundle.getBundleConfig()).isEqualTo(bundleConfigInBundle);
    }
}
Also used : Path(java.nio.file.Path) ZipPath(com.android.tools.build.bundletool.model.ZipPath) BundleConfig(com.android.bundle.Config.BundleConfig) AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleConfigBuilder(com.android.tools.build.bundletool.testing.BundleConfigBuilder) ZipFile(java.util.zip.ZipFile) Test(org.junit.Test)

Aggregations

BundleConfig (com.android.bundle.Config.BundleConfig)1 AppBundle (com.android.tools.build.bundletool.model.AppBundle)1 ZipPath (com.android.tools.build.bundletool.model.ZipPath)1 BundleConfigBuilder (com.android.tools.build.bundletool.testing.BundleConfigBuilder)1 Path (java.nio.file.Path)1 ZipFile (java.util.zip.ZipFile)1 Test (org.junit.Test)1