Search in sources :

Example 56 with Variant

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

the class ResultUtilsTest method isArchivedApkVariantTrue.

@Test
public void isArchivedApkVariantTrue() throws Exception {
    Variant variant = createArchivedVariant();
    assertThat(ResultUtils.isArchivedApkVariant(variant)).isTrue();
    assertThat(ResultUtils.isSplitApkVariant(variant)).isFalse();
    assertThat(ResultUtils.isStandaloneApkVariant(variant)).isFalse();
    assertThat(ResultUtils.isInstantApkVariant(variant)).isFalse();
    assertThat(ResultUtils.isSystemApkVariant(variant)).isFalse();
}
Also used : ApksArchiveHelpers.createVariant(com.android.tools.build.bundletool.testing.ApksArchiveHelpers.createVariant) Variant(com.android.bundle.Commands.Variant) Test(org.junit.Test)

Example 57 with Variant

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

the class ResultUtilsTest method isSystemApkVariantTrue.

@Test
public void isSystemApkVariantTrue() throws Exception {
    Variant variant = createSystemVariant();
    assertThat(ResultUtils.isSplitApkVariant(variant)).isFalse();
    assertThat(ResultUtils.isStandaloneApkVariant(variant)).isFalse();
    assertThat(ResultUtils.isInstantApkVariant(variant)).isFalse();
    assertThat(ResultUtils.isSystemApkVariant(variant)).isTrue();
    assertThat(ResultUtils.isArchivedApkVariant(variant)).isFalse();
}
Also used : ApksArchiveHelpers.createVariant(com.android.tools.build.bundletool.testing.ApksArchiveHelpers.createVariant) Variant(com.android.bundle.Commands.Variant) Test(org.junit.Test)

Example 58 with Variant

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

the class ResultUtilsTest method filterArchivedApkVariant.

@Test
public void filterArchivedApkVariant() throws Exception {
    Variant archivedVariant = createArchivedVariant();
    BuildApksResult apksResult = BuildApksResult.newBuilder().addVariant(archivedVariant).build();
    assertThat(ResultUtils.archivedApkVariants(apksResult)).containsExactly(archivedVariant);
}
Also used : ApksArchiveHelpers.createVariant(com.android.tools.build.bundletool.testing.ApksArchiveHelpers.createVariant) Variant(com.android.bundle.Commands.Variant) BuildApksResult(com.android.bundle.Commands.BuildApksResult) Test(org.junit.Test)

Example 59 with Variant

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

the class ResultUtilsTest method filterSplitApkVariant.

@Test
public void filterSplitApkVariant() throws Exception {
    Variant standaloneVariant = createStandaloneVariant();
    Variant splitVariant = createSplitVariant();
    Variant instantVariant = createInstantVariant();
    BuildApksResult apksResult = BuildApksResult.newBuilder().addVariant(standaloneVariant).addVariant(splitVariant).addVariant(instantVariant).build();
    assertThat(ResultUtils.splitApkVariants(apksResult)).containsExactly(splitVariant);
}
Also used : ApksArchiveHelpers.createVariant(com.android.tools.build.bundletool.testing.ApksArchiveHelpers.createVariant) Variant(com.android.bundle.Commands.Variant) BuildApksResult(com.android.bundle.Commands.BuildApksResult) Test(org.junit.Test)

Example 60 with Variant

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

the class ApkSizeUtilsTest method oneLVariant.

@Test
public void oneLVariant() throws Exception {
    ZipPath apkOne = ZipPath.create("apk_one.apk");
    ImmutableList<Variant> variants = ImmutableList.of(createVariantForSingleSplitApk(variantSdkTargeting(sdkVersionFrom(21)), ApkTargeting.getDefaultInstance(), apkOne));
    Path apksArchiveFile = createApksArchiveFile(BuildApksResult.newBuilder().addAllVariant(variants).build(), tmpDir.resolve("bundle.apks"));
    ImmutableMap<String, Long> sizeByApkPaths = getVariantCompressedSizeByApkPaths(variants, apksArchiveFile);
    assertThat(sizeByApkPaths.keySet()).containsExactly("apk_one.apk");
    assertThat(sizeByApkPaths.get("apk_one.apk")).isAtLeast(1L);
}
Also used : ApksArchiveHelpers.createVariant(com.android.tools.build.bundletool.testing.ApksArchiveHelpers.createVariant) Variant(com.android.bundle.Commands.Variant) ZipPath(com.android.tools.build.bundletool.model.ZipPath) Path(java.nio.file.Path) ZipPath(com.android.tools.build.bundletool.model.ZipPath) Test(org.junit.Test)

Aggregations

Variant (com.android.bundle.Commands.Variant)134 Test (org.junit.Test)130 BuildApksResult (com.android.bundle.Commands.BuildApksResult)100 ZipPath (com.android.tools.build.bundletool.model.ZipPath)82 Path (java.nio.file.Path)80 ZipFile (java.util.zip.ZipFile)79 AppBundle (com.android.tools.build.bundletool.model.AppBundle)66 AppBundleBuilder (com.android.tools.build.bundletool.testing.AppBundleBuilder)66 ApkSet (com.android.bundle.Commands.ApkSet)63 ApkDescription (com.android.bundle.Commands.ApkDescription)60 ApkSetUtils.extractFromApkSetFile (com.android.tools.build.bundletool.testing.ApkSetUtils.extractFromApkSetFile)59 File (java.io.File)59 AndroidManifest (com.android.tools.build.bundletool.model.AndroidManifest)56 AssetSliceSet (com.android.bundle.Commands.AssetSliceSet)55 ApkSetUtils.extractTocFromApkSetFile (com.android.tools.build.bundletool.testing.ApkSetUtils.extractTocFromApkSetFile)55 CodeRelatedFile (com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile)54 ApkSetUtils.parseTocFromFile (com.android.tools.build.bundletool.testing.ApkSetUtils.parseTocFromFile)54 ResourceTableBuilder (com.android.tools.build.bundletool.testing.ResourceTableBuilder)54 ImmutableSet (com.google.common.collect.ImmutableSet)54 ApkVerifier (com.android.apksig.ApkVerifier)53