Search in sources :

Example 1 with SdkVersionInformation

use of com.android.bundle.Commands.SdkVersionInformation in project bundletool by google.

the class BuildSdkApksManagerTest method sdkVersionInformationIsSet.

@Test
public void sdkVersionInformationIsSet() throws Exception {
    SdkBundle sdkBundle = new SdkBundleBuilder().setModule(new BundleModuleBuilder("base").setManifest(androidManifest(PACKAGE_NAME, withSdkLibraryElement("100"), withMetadataValue(SDK_PATCH_VERSION_ATTRIBUTE_NAME, "132"))).build()).setVersionCode(99).build();
    execute(sdkBundle);
    ZipFile apkSetFile = new ZipFile(outputFilePath.toFile());
    BuildSdkApksResult result = extractTocFromSdkApkSetFile(apkSetFile, tmpDir);
    SdkVersionInformation version = result.getVersion();
    assertThat(version.getVersionCode()).isEqualTo(99);
    assertThat(version.getMajor()).isEqualTo(100);
    assertThat(version.getPatch()).isEqualTo(132);
}
Also used : BuildSdkApksResult(com.android.bundle.Commands.BuildSdkApksResult) SdkVersionInformation(com.android.bundle.Commands.SdkVersionInformation) ZipFile(java.util.zip.ZipFile) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) SdkBundle(com.android.tools.build.bundletool.model.SdkBundle) SdkBundleBuilder(com.android.tools.build.bundletool.testing.SdkBundleBuilder) Test(org.junit.Test)

Example 2 with SdkVersionInformation

use of com.android.bundle.Commands.SdkVersionInformation in project bundletool by google.

the class BuildSdkApksManagerTest method sdkPatchVersionIsSetToDefaultValue.

@Test
public void sdkPatchVersionIsSetToDefaultValue() throws Exception {
    SdkBundle sdkBundle = new SdkBundleBuilder().setModule(new BundleModuleBuilder("base").setManifest(androidManifest(PACKAGE_NAME, withSdkLibraryElement("1181894"))).build()).build();
    execute(sdkBundle);
    ZipFile apkSetFile = new ZipFile(outputFilePath.toFile());
    BuildSdkApksResult result = extractTocFromSdkApkSetFile(apkSetFile, tmpDir);
    SdkVersionInformation version = result.getVersion();
    assertThat(version.getPatch()).isEqualTo(Long.parseLong(DEFAULT_SDK_PATCH_VERSION));
}
Also used : BuildSdkApksResult(com.android.bundle.Commands.BuildSdkApksResult) SdkVersionInformation(com.android.bundle.Commands.SdkVersionInformation) ZipFile(java.util.zip.ZipFile) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) SdkBundle(com.android.tools.build.bundletool.model.SdkBundle) SdkBundleBuilder(com.android.tools.build.bundletool.testing.SdkBundleBuilder) Test(org.junit.Test)

Aggregations

BuildSdkApksResult (com.android.bundle.Commands.BuildSdkApksResult)2 SdkVersionInformation (com.android.bundle.Commands.SdkVersionInformation)2 SdkBundle (com.android.tools.build.bundletool.model.SdkBundle)2 BundleModuleBuilder (com.android.tools.build.bundletool.testing.BundleModuleBuilder)2 SdkBundleBuilder (com.android.tools.build.bundletool.testing.SdkBundleBuilder)2 ZipFile (java.util.zip.ZipFile)2 Test (org.junit.Test)2