List of usage examples for com.google.common.collect ImmutableSet containsAll
boolean containsAll(Collection<?> c);
From source file:com.facebook.buck.android.NativeLibraryMergeEnhancer.java
@SuppressWarnings("PMD.PrematureDeclaration") static NativeLibraryMergeEnhancementResult enhance(CxxBuckConfig cxxBuckConfig, BuildRuleResolver ruleResolver, SourcePathResolver pathResolver, SourcePathRuleFinder ruleFinder, BuildRuleParams buildRuleParams, ImmutableMap<NdkCxxPlatforms.TargetCpuType, NdkCxxPlatform> nativePlatforms, Map<String, List<Pattern>> mergeMap, Optional<BuildTarget> nativeLibraryMergeGlue, ImmutableMultimap<APKModule, NativeLinkable> linkables, ImmutableMultimap<APKModule, NativeLinkable> linkablesAssets) throws NoSuchBuildTargetException { NativeLibraryMergeEnhancer.ruleFinder = ruleFinder; NativeLibraryMergeEnhancementResult.Builder builder = NativeLibraryMergeEnhancementResult.builder(); ImmutableSet<APKModule> modules = ImmutableSet.<APKModule>builder().addAll(linkables.keySet()) .addAll(linkablesAssets.keySet()).build(); ImmutableSortedMap.Builder<String, String> sonameMapBuilder = ImmutableSortedMap.naturalOrder(); for (APKModule module : modules) { // Sort by build target here to ensure consistent behavior. Iterable<NativeLinkable> allLinkables = FluentIterable .from(Iterables.concat(linkables.get(module), linkablesAssets.get(module))) .toSortedList(HasBuildTarget.BUILD_TARGET_COMPARATOR); final ImmutableSet<NativeLinkable> linkableAssetSet = ImmutableSet.copyOf(linkablesAssets.get(module)); Map<NativeLinkable, MergedNativeLibraryConstituents> linkableMembership = makeConstituentMap( buildRuleParams, mergeMap, allLinkables, linkableAssetSet); sonameMapBuilder.putAll(makeSonameMap( // sonames can *theoretically* differ per-platform, but right now they don't on Android, // so just pick the first platform and use that to get all the sonames. nativePlatforms.values().iterator().next().getCxxPlatform(), linkableMembership)); Iterable<MergedNativeLibraryConstituents> orderedConstituents = getOrderedMergedConstituents( buildRuleParams, linkableMembership); Optional<NativeLinkable> glueLinkable = Optional.empty(); if (nativeLibraryMergeGlue.isPresent()) { BuildRule rule = ruleResolver.getRule(nativeLibraryMergeGlue.get()); if (!(rule instanceof NativeLinkable)) { throw new RuntimeException("Native library merge glue " + rule.getBuildTarget() + " for application " + buildRuleParams.getBuildTarget() + " is not linkable."); }//from w w w. j av a 2 s . com glueLinkable = Optional.of(((NativeLinkable) rule)); } Set<MergedLibNativeLinkable> mergedLinkables = createLinkables(cxxBuckConfig, ruleResolver, pathResolver, buildRuleParams, glueLinkable, orderedConstituents); for (MergedLibNativeLinkable linkable : mergedLinkables) { if (Collections.disjoint(linkable.constituents.getLinkables(), linkableAssetSet)) { builder.putMergedLinkables(module, linkable); } else if (linkableAssetSet.containsAll(linkable.constituents.getLinkables())) { builder.putMergedLinkablesAssets(module, linkable); } } } builder.setSonameMapping(sonameMapBuilder.build()); return builder.build(); }
From source file:com.facebook.presto.tests.AbstractTestQueries.java
@Test public void testShowSchemas() throws Exception { MaterializedResult result = computeActual("SHOW SCHEMAS"); ImmutableSet<String> schemaNames = ImmutableSet .copyOf(transform(result.getMaterializedRows(), onlyColumnGetter())); assertTrue(schemaNames.containsAll(ImmutableSet.of(getSession().getSchema().get(), INFORMATION_SCHEMA))); }
From source file:com.facebook.presto.tests.AbstractTestQueries.java
@Test public void testShowSchemasFrom() throws Exception { MaterializedResult result = computeActual(format("SHOW SCHEMAS FROM %s", getSession().getCatalog().get())); ImmutableSet<String> schemaNames = ImmutableSet .copyOf(transform(result.getMaterializedRows(), onlyColumnGetter())); assertTrue(schemaNames.containsAll(ImmutableSet.of(getSession().getSchema().get(), INFORMATION_SCHEMA))); }