Search in sources :

Example 1 with DEX_DIRECTORY

use of com.android.tools.build.bundletool.model.BundleModule.DEX_DIRECTORY in project bundletool by google.

the class BundleModuleMerger method getAllEntriesExceptDexAndSpecial.

private static ImmutableSet<ModuleEntry> getAllEntriesExceptDexAndSpecial(Set<BundleModule> bundleModulesToFuse) {
    Map<ZipPath, ModuleEntry> mergedEntriesByPath = new HashMap<>();
    bundleModulesToFuse.stream().flatMap(module -> module.getEntries().stream()).filter(moduleEntry -> !moduleEntry.getPath().startsWith(DEX_DIRECTORY) && !moduleEntry.isSpecialEntry()).forEach(moduleEntry -> {
        ModuleEntry existingModuleEntry = mergedEntriesByPath.putIfAbsent(moduleEntry.getPath(), moduleEntry);
        if (existingModuleEntry != null && !existingModuleEntry.equals(moduleEntry)) {
            throw InvalidBundleException.builder().withUserMessage("Existing module entry '%s' with different contents.", moduleEntry.getPath()).build();
        }
    });
    return ImmutableSet.copyOf(mergedEntriesByPath.values());
}
Also used : ImmutableListMultimap.flatteningToImmutableListMultimap(com.google.common.collect.ImmutableListMultimap.flatteningToImmutableListMultimap) FUSE_APPLICATION_ELEMENTS_FROM_FEATURE_MANIFESTS(com.android.tools.build.bundletool.model.version.VersionGuardedFeature.FUSE_APPLICATION_ELEMENTS_FROM_FEATURE_MANIFESTS) BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) ZipPath(com.android.tools.build.bundletool.model.ZipPath) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) HashMap(java.util.HashMap) AndroidManifestMerger.fusingMergerOnlyReplaceActivities(com.android.tools.build.bundletool.mergers.AndroidManifestMerger.fusingMergerOnlyReplaceActivities) AndroidManifestMerger.fusingMergerApplicationElements(com.android.tools.build.bundletool.mergers.AndroidManifestMerger.fusingMergerApplicationElements) HashMultimap(com.google.common.collect.HashMultimap) Multimaps.toMultimap(com.google.common.collect.Multimaps.toMultimap) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) ModuleType(com.android.tools.build.bundletool.model.BundleModule.ModuleType) Version(com.android.tools.build.bundletool.model.version.Version) ResourceTable(com.android.aapt.Resources.ResourceTable) DEX_DIRECTORY(com.android.tools.build.bundletool.model.BundleModule.DEX_DIRECTORY) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) ImmutableSet(com.google.common.collect.ImmutableSet) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Set(java.util.Set) IOException(java.io.IOException) NativeLibraries(com.android.bundle.Files.NativeLibraries) ApexImages(com.android.bundle.Files.ApexImages) MERGE_INSTALL_TIME_MODULES_INTO_BASE(com.android.tools.build.bundletool.model.version.VersionGuardedFeature.MERGE_INSTALL_TIME_MODULES_INTO_BASE) Stream(java.util.stream.Stream) BundleConfig(com.android.bundle.Config.BundleConfig) ModuleEntry(com.android.tools.build.bundletool.model.ModuleEntry) ImmutableListMultimap(com.google.common.collect.ImmutableListMultimap) Optional(java.util.Optional) Assets(com.android.bundle.Files.Assets) AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModule(com.android.tools.build.bundletool.model.BundleModule) HashMap(java.util.HashMap) ModuleEntry(com.android.tools.build.bundletool.model.ModuleEntry) ZipPath(com.android.tools.build.bundletool.model.ZipPath)

Aggregations

ResourceTable (com.android.aapt.Resources.ResourceTable)1 BundleConfig (com.android.bundle.Config.BundleConfig)1 ApexImages (com.android.bundle.Files.ApexImages)1 Assets (com.android.bundle.Files.Assets)1 NativeLibraries (com.android.bundle.Files.NativeLibraries)1 AndroidManifestMerger.fusingMergerApplicationElements (com.android.tools.build.bundletool.mergers.AndroidManifestMerger.fusingMergerApplicationElements)1 AndroidManifestMerger.fusingMergerOnlyReplaceActivities (com.android.tools.build.bundletool.mergers.AndroidManifestMerger.fusingMergerOnlyReplaceActivities)1 AndroidManifest (com.android.tools.build.bundletool.model.AndroidManifest)1 AppBundle (com.android.tools.build.bundletool.model.AppBundle)1 BundleModule (com.android.tools.build.bundletool.model.BundleModule)1 DEX_DIRECTORY (com.android.tools.build.bundletool.model.BundleModule.DEX_DIRECTORY)1 ModuleType (com.android.tools.build.bundletool.model.BundleModule.ModuleType)1 BundleModuleName (com.android.tools.build.bundletool.model.BundleModuleName)1 ModuleEntry (com.android.tools.build.bundletool.model.ModuleEntry)1 ZipPath (com.android.tools.build.bundletool.model.ZipPath)1 InvalidBundleException (com.android.tools.build.bundletool.model.exceptions.InvalidBundleException)1 BundleToolVersion (com.android.tools.build.bundletool.model.version.BundleToolVersion)1 Version (com.android.tools.build.bundletool.model.version.Version)1 FUSE_APPLICATION_ELEMENTS_FROM_FEATURE_MANIFESTS (com.android.tools.build.bundletool.model.version.VersionGuardedFeature.FUSE_APPLICATION_ELEMENTS_FROM_FEATURE_MANIFESTS)1 MERGE_INSTALL_TIME_MODULES_INTO_BASE (com.android.tools.build.bundletool.model.version.VersionGuardedFeature.MERGE_INSTALL_TIME_MODULES_INTO_BASE)1