ApkSet apkSet = variant.getApkSetList().get(0); assertThat(apkSet.getModuleMetadata().getIsInstant()).isTrue(); assertThat(apkSetFile).hasFile(apkSet.getApkDescription(0).getPath()); apkSet = variant.getApkSetList().get(0); assertThat(apkSet.getModuleMetadata().getIsInstant()).isTrue(); assertThat(apkSetFile).hasFile(apkSet.getApkDescription(0).getPath());
ApkSet apkSet = variant.getApkSet(0); assertThat(apkSet.getApkDescriptionList()).hasSize(1); assertThat(apkSetFile).hasFile(apkSet.getApkDescription(0).getPath());
assertThat(shards.getApkDescriptionList()).hasSize(1); ApkDescription shard = shards.getApkDescription(0); assertThat(apkSetFile).hasFile(shard.getPath()); assertThat(ZipPath.create(shard.getPath()).getFileName())
assertThat(baseSplits.getModuleMetadata().getOnDemand()).isFalse(); assertThat(baseSplits.getApkDescriptionList()).hasSize(1); assertThat(apkSetFile).hasFile(baseSplits.getApkDescription(0).getPath()); assertThat(onDemandSplits.getModuleMetadata().getOnDemand()).isTrue(); assertThat(onDemandSplits.getApkDescriptionList()).hasSize(1); assertThat(apkSetFile).hasFile(onDemandSplits.getApkDescription(0).getPath());
@Test public void buildApksCommand_standalone_oneModuleOneVariant() throws Exception { bundlePath = FileUtils.getRandomFilePath(tmp, "bundle-", ".aab"); AppBundle appBundle = new AppBundleBuilder() .addModule( "base", builder -> builder.addFile("dex/classes.dex").setManifest(androidManifest("com.test.app"))) .build(); bundleSerializer.writeToDisk(appBundle, bundlePath); BuildApksCommand command = BuildApksCommand.builder() .setBundlePath(bundlePath) .setOutputFile(outputFilePath) .setAapt2Command(aapt2Command) .build(); Path apkSetFilePath = execute(command); ZipFile apkSetFile = new ZipFile(apkSetFilePath.toFile()); BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir); assertThat(standaloneApkVariants(result)).hasSize(1); Variant standaloneApkVariant = standaloneApkVariants(result).get(0); assertThat(standaloneApkVariant.getApkSetList()).hasSize(1); ApkSet shards = standaloneApkVariant.getApkSet(0); assertThat(shards.getModuleMetadata().getName()).isEqualTo("base"); assertThat(shards.getApkDescriptionList()).hasSize(1); assertThat(ZipPath.create(shards.getApkDescription(0).getPath()).getFileName()) .isEqualTo(ZipPath.create("standalone.apk")); assertThat(apkSetFile).hasFile(shards.getApkDescription(0).getPath()); }