List of usage examples for com.google.common.collect ImmutableList.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:com.spectralogic.ds3contractcomparator.print.htmlprinter.generators.row.HtmlRowGenerator.java
/** * Recursively traverse an object using reflection and constructs the rows that * represent the object using the specified function. *//*from w ww .j av a 2s . com*/ public static <T> ImmutableList<Row> createRows(final T object, final int indent, Function<RowAttributes, Row> function) { final Field[] fields = object.getClass().getDeclaredFields(); final ImmutableList.Builder<Row> builder = ImmutableList.builder(); for (final Field field : fields) { final String property = field.getName(); final Optional<String> value = getPropertyValue(object, property); final int fieldIndent = toFieldIndent(indent, object, field); if (value.isPresent()) { if (field.getType() == ImmutableList.class) { builder.add(new NoChangeRow(fieldIndent, property, "")); final ImmutableList<?> objList = getListPropertyFromObject(field, object); objList.forEach(obj -> builder.addAll(createRows(obj, fieldIndent + 1, function))); } else { final RowAttributes attributes = new RowAttributes(fieldIndent, property, value.get()); builder.add(function.apply(attributes)); } } } return builder.build(); }
From source file:io.prestosql.orc.writer.SliceDictionaryColumnWriter.java
private static List<Integer> createSliceColumnPositionList(boolean compressed, LongStreamCheckpoint dataCheckpoint, Optional<BooleanStreamCheckpoint> presentCheckpoint) { ImmutableList.Builder<Integer> positionList = ImmutableList.builder(); presentCheckpoint.ifPresent(//from ww w . j a v a2 s .co m booleanStreamCheckpoint -> positionList.addAll(booleanStreamCheckpoint.toPositionList(compressed))); positionList.addAll(dataCheckpoint.toPositionList(compressed)); return positionList.build(); }
From source file:com.facebook.buck.cxx.CxxLibraryFactory.java
/** @return a {@link CxxLink} rule which builds a shared library version of this C/C++ library. */ private static CxxLink createSharedLibraryBuildRule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, ActionGraphBuilder graphBuilder, CellPathResolver cellRoots, CxxBuckConfig cxxBuckConfig, CxxPlatform cxxPlatform, CxxLibraryDescriptionArg args, ImmutableSet<BuildRule> deps, Linker.LinkType linkType, Linker.LinkableDepType linkableDepType, Optional<SourcePath> bundleLoader, ImmutableSet<BuildTarget> blacklist, CxxLibraryDescription.TransitiveCxxPreprocessorInputFunction transitiveCxxPreprocessorInputFunction, Optional<CxxLibraryDescriptionDelegate> delegate) { ImmutableList.Builder<StringWithMacros> linkerFlags = ImmutableList.builder(); linkerFlags.addAll(CxxFlags.getFlagsWithMacrosWithPlatformMacroExpansion(args.getLinkerFlags(), args.getPlatformLinkerFlags(), cxxPlatform)); linkerFlags.addAll(CxxFlags.getFlagsWithMacrosWithPlatformMacroExpansion(args.getExportedLinkerFlags(), args.getExportedPlatformLinkerFlags(), cxxPlatform)); ImmutableList.Builder<StringWithMacros> postLinkerFlags = ImmutableList.builder(); postLinkerFlags.addAll(CxxFlags.getFlagsWithMacrosWithPlatformMacroExpansion(args.getPostLinkerFlags(), args.getPostPlatformLinkerFlags(), cxxPlatform)); postLinkerFlags.addAll(CxxFlags.getFlagsWithMacrosWithPlatformMacroExpansion( args.getExportedPostLinkerFlags(), args.getExportedPostPlatformLinkerFlags(), cxxPlatform)); SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(graphBuilder); SourcePathResolver sourcePathResolver = DefaultSourcePathResolver.from(ruleFinder); return createSharedLibrary(buildTarget, projectFilesystem, graphBuilder, sourcePathResolver, ruleFinder, cellRoots, cxxBuckConfig, cxxPlatform, args, deps, linkerFlags.build(), postLinkerFlags.build(), args.getFrameworks(), args.getLibraries(), args.getSoname(), args.getCxxRuntimeType(), linkType, linkableDepType, bundleLoader, blacklist, transitiveCxxPreprocessorInputFunction, delegate); }
From source file:com.facebook.buck.cxx.CxxLibraryDescription.java
/** * @return a {@link CxxLink} rule which builds a shared library version of this C/C++ library. */// w w w. j a va 2s. c o m private static <A extends Arg> BuildRule createSharedLibraryBuildRule(BuildRuleParams params, BuildRuleResolver resolver, CxxBuckConfig cxxBuckConfig, CxxPlatform cxxPlatform, A args, Linker.LinkType linkType, Linker.LinkableDepType linkableDepType, Optional<SourcePath> bundleLoader, ImmutableSet<BuildTarget> blacklist) throws NoSuchBuildTargetException { ImmutableList.Builder<String> linkerFlags = ImmutableList.builder(); linkerFlags.addAll(CxxFlags.getFlags(args.linkerFlags, args.platformLinkerFlags, cxxPlatform)); linkerFlags .addAll(CxxFlags.getFlags(args.exportedLinkerFlags, args.exportedPlatformLinkerFlags, cxxPlatform)); SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(resolver); SourcePathResolver sourcePathResolver = new SourcePathResolver(ruleFinder); return createSharedLibrary(params, resolver, sourcePathResolver, ruleFinder, cxxBuckConfig, cxxPlatform, args, linkerFlags.build(), args.frameworks, args.libraries, args.soname, args.cxxRuntimeType, linkType, linkableDepType, bundleLoader, blacklist); }
From source file:com.facebook.presto.atop.AtopTable.java
private static List<AtopColumn> baseColumnsAnd(AtopColumn... additionalColumns) { ImmutableList.Builder<AtopColumn> columns = ImmutableList.builder(); columns.add(HOST_IP);/*from ww w . j a va 2s . c o m*/ // 0th field is the label (i.e. table name) // 1st field is the name of the host, but isn't fully qualified columns.add(START_TIME); // 2nd field is the end timestamp as unix time columns.add(END_TIME); // 3rd field is the date, but we already have the epoch // 4th field is the time, but we already have the epoch // 5th field is the duration, and will be combined with 2 to compute start_time columns.addAll(Arrays.asList(additionalColumns)); return columns.build(); }
From source file:com.proofpoint.reporting.HealthBean.java
public static HealthBean forTarget(Object target) { requireNonNull(target, "target is null"); ImmutableList.Builder<HealthBeanAttribute> attributes = ImmutableList.builder(); for (Map.Entry<Method, Method> entry : AnnotationUtils.findAnnotatedMethods(target.getClass(), HealthCheck.class, HealthCheckRemoveFromRotation.class, HealthCheckRestartDesired.class) .entrySet()) {//ww w . j ava 2 s. co m Method concreteMethod = entry.getKey(); Method annotatedMethod = entry.getValue(); if (!isValidGetter(concreteMethod)) { throw new RuntimeException( "healthcheck annotation on non-getter " + annotatedMethod.toGenericString()); } attributes.addAll(new HealthBeanAttributeBuilder().onInstance(target).withConcreteGetter(concreteMethod) .withAnnotatedGetter(annotatedMethod).build()); } for (Field field : AnnotationUtils.findAnnotatedFields(target.getClass(), HealthCheck.class, HealthCheckRemoveFromRotation.class, HealthCheckRestartDesired.class)) { if (!AtomicReference.class.isAssignableFrom(field.getType())) { throw new RuntimeException( "healthcheck annotation on non-AtomicReference field " + field.toGenericString()); } attributes.addAll(new HealthBeanAttributeBuilder().onInstance(target).withField(field).build()); } return new AutoValue_HealthBean(attributes.build()); }
From source file:org.spongepowered.common.data.SpongeDataManager.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static void finalizeRegistration() { allowRegistrations = false;//from w ww.ja v a2 s . c o m final SpongeDataManager registry = instance; registry.valueProcessorMap.entrySet().forEach(entry -> { ImmutableList.Builder<ValueProcessor<?, ?>> valueListBuilder = ImmutableList.builder(); Collections.sort(entry.getValue(), ComparatorUtil.VALUE_PROCESSOR_COMPARATOR); valueListBuilder.addAll(entry.getValue()); final ValueProcessorDelegate<?, ?> delegate = new ValueProcessorDelegate(entry.getKey(), valueListBuilder.build()); registry.valueDelegates.put(entry.getKey(), delegate); }); registry.valueProcessorMap.clear(); registry.processorMap.entrySet().forEach(entry -> { ImmutableList.Builder<DataProcessor<?, ?>> dataListBuilder = ImmutableList.builder(); Collections.sort(entry.getValue(), ComparatorUtil.DATA_PROCESSOR_COMPARATOR); dataListBuilder.addAll(entry.getValue()); final DataProcessorDelegate<?, ?> delegate = new DataProcessorDelegate(dataListBuilder.build()); registry.dataProcessorDelegates.put(entry.getKey(), delegate); }); registry.processorMap.clear(); SpongeDataManager serializationService = SpongeDataManager.getInstance(); registry.dataProcessorDelegates.entrySet().forEach(entry -> { if (!Modifier.isInterface(entry.getKey().getModifiers()) && !Modifier.isAbstract(entry.getKey().getModifiers())) { DataFunction<DataContainer, DataManipulator, Optional<? extends DataManipulator<?, ?>>> function = ( dataContainer, dataManipulator) -> ((DataProcessor) entry.getValue()).fill(dataContainer, dataManipulator); SpongeDataManipulatorBuilder builder = new SpongeDataManipulatorBuilder(entry.getValue(), entry.getKey(), function); registry.builderMap.put(entry.getKey(), checkNotNull(builder)); serializationService.registerBuilder(entry.getKey(), builder); } else { final Class<? extends DataManipulator<?, ?>> clazz = registry.interfaceToImplDataManipulatorClasses .get(entry.getKey()); DataFunction<DataContainer, DataManipulator, Optional<? extends DataManipulator<?, ?>>> function = ( dataContainer, dataManipulator) -> ((DataProcessor) entry.getValue()).fill(dataContainer, dataManipulator); SpongeDataManipulatorBuilder builder = new SpongeDataManipulatorBuilder(entry.getValue(), clazz, function); registry.builderMap.put(entry.getKey(), checkNotNull(builder)); serializationService.registerBuilder(entry.getKey(), builder); } }); registry.immutableProcessorMap.entrySet().forEach(entry -> { ImmutableList.Builder<DataProcessor<?, ?>> dataListBuilder = ImmutableList.builder(); Collections.sort(entry.getValue(), ComparatorUtil.DATA_PROCESSOR_COMPARATOR); dataListBuilder.addAll(entry.getValue()); final DataProcessorDelegate<?, ?> delegate = new DataProcessorDelegate(dataListBuilder.build()); registry.immutableDataProcessorDelegates.put(entry.getKey(), delegate); }); registry.immutableProcessorMap.clear(); }
From source file:com.github.rinde.opt.localsearch.Insertions.java
/** * Inserts <code>item</code> in the specified indices in the * <code>originalList</code>. * @param originalList The list which will be inserted by <code>item</code>. * @param insertionIndices List of insertion indices in ascending order. * @param item The item to insert.// w w w . j a v a 2 s . c o m * @param <T> The list item type. * @return A list based on the original list but inserted with item in the * specified places. */ public static <T> ImmutableList<T> insert(List<T> originalList, List<Integer> insertionIndices, T item) { checkArgument(!insertionIndices.isEmpty(), "At least one insertion index must be defined."); int prev = 0; final ImmutableList.Builder<T> builder = ImmutableList.<T>builder(); for (int i = 0; i < insertionIndices.size(); i++) { final int cur = insertionIndices.get(i); checkArgument(cur >= 0 && cur <= originalList.size(), "The specified indices must be >= 0 and <= %s (list size), it is %s.", originalList.size(), cur); checkArgument(cur >= prev, "The specified indices must be in ascending order. Received %s.", insertionIndices); builder.addAll(originalList.subList(prev, cur)); builder.add(item); prev = cur; } builder.addAll(originalList.subList(prev, originalList.size())); return builder.build(); }
From source file:com.google.javascript.jscomp.parsing.parser.codegeneration.ParseTreeFactory.java
public static ImmutableList<ParseTree> createStatementList(List<ParseTree> head, ParseTree tail) { ImmutableList.Builder<ParseTree> result = new ImmutableList.Builder<ParseTree>(); result.addAll(head); result.add(tail);/*from w w w . j a v a2s .com*/ return result.build(); }
From source file:com.facebook.buck.apple.toolchain.impl.AppleCxxPlatforms.java
@VisibleForTesting public static AppleCxxPlatform buildWithXcodeToolFinder(ProjectFilesystem filesystem, AppleSdk targetSdk, String minVersion, String targetArchitecture, AppleSdkPaths sdkPaths, BuckConfig buckConfig, XcodeToolFinder xcodeToolFinder, XcodeBuildVersionCache xcodeBuildVersionCache) { AppleCxxPlatform.Builder platformBuilder = AppleCxxPlatform.builder(); ImmutableList.Builder<Path> toolSearchPathsBuilder = ImmutableList.builder(); // Search for tools from most specific to least specific. toolSearchPathsBuilder.add(sdkPaths.getSdkPath().resolve(USR_BIN)) .add(sdkPaths.getSdkPath().resolve("Developer").resolve(USR_BIN)) .add(sdkPaths.getPlatformPath().resolve("Developer").resolve(USR_BIN)); for (Path toolchainPath : sdkPaths.getToolchainPaths()) { toolSearchPathsBuilder.add(toolchainPath.resolve(USR_BIN)); }//from www . j ava 2s . c o m if (sdkPaths.getDeveloperPath().isPresent()) { toolSearchPathsBuilder.add(sdkPaths.getDeveloperPath().get().resolve(USR_BIN)); toolSearchPathsBuilder.add(sdkPaths.getDeveloperPath().get().resolve("Tools")); } // TODO(beng): Add more and better cflags. ImmutableList.Builder<String> cflagsBuilder = ImmutableList.builder(); cflagsBuilder.add("-isysroot", sdkPaths.getSdkPath().toString()); cflagsBuilder.add("-arch", targetArchitecture); cflagsBuilder.add(targetSdk.getApplePlatform().getMinVersionFlagPrefix() + minVersion); if (targetSdk.getApplePlatform().equals(ApplePlatform.WATCHOS)) { cflagsBuilder.add("-fembed-bitcode"); } AppleConfig appleConfig = buckConfig.getView(AppleConfig.class); ImmutableList.Builder<String> ldflagsBuilder = ImmutableList.builder(); ldflagsBuilder.addAll(Linkers.iXlinker("-sdk_version", targetSdk.getVersion())); if (appleConfig.linkAllObjC()) { ldflagsBuilder.addAll(Linkers.iXlinker("-ObjC")); } if (targetSdk.getApplePlatform().equals(ApplePlatform.WATCHOS)) { ldflagsBuilder.addAll(Linkers.iXlinker("-bitcode_verify")); } // Populate Xcode version keys from Xcode's own Info.plist if available. Optional<String> xcodeBuildVersion = Optional.empty(); Optional<Path> developerPath = sdkPaths.getDeveloperPath(); if (developerPath.isPresent()) { Path xcodeBundlePath = developerPath.get().getParent(); if (xcodeBundlePath != null) { Path xcodeInfoPlistPath = xcodeBundlePath.resolve("Info.plist"); try (InputStream stream = Files.newInputStream(xcodeInfoPlistPath)) { NSDictionary parsedXcodeInfoPlist = (NSDictionary) PropertyListParser.parse(stream); NSObject xcodeVersionObject = parsedXcodeInfoPlist.objectForKey("DTXcode"); if (xcodeVersionObject != null) { Optional<String> xcodeVersion = Optional.of(xcodeVersionObject.toString()); platformBuilder.setXcodeVersion(xcodeVersion); } } catch (IOException e) { LOG.warn("Error reading Xcode's info plist %s; ignoring Xcode versions", xcodeInfoPlistPath); } catch (PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) { LOG.warn("Error in parsing %s; ignoring Xcode versions", xcodeInfoPlistPath); } } xcodeBuildVersion = xcodeBuildVersionCache.lookup(developerPath.get()); platformBuilder.setXcodeBuildVersion(xcodeBuildVersion); LOG.debug("Xcode build version is: " + xcodeBuildVersion.orElse("<absent>")); } ImmutableList.Builder<String> versions = ImmutableList.builder(); versions.add(targetSdk.getVersion()); ImmutableList<String> toolchainVersions = targetSdk.getToolchains().stream().map(AppleToolchain::getVersion) .flatMap(Optionals::toStream).collect(ImmutableList.toImmutableList()); if (toolchainVersions.isEmpty()) { if (!xcodeBuildVersion.isPresent()) { throw new HumanReadableException("Failed to read toolchain versions and Xcode version."); } versions.add(xcodeBuildVersion.get()); } else { versions.addAll(toolchainVersions); } String version = Joiner.on(':').join(versions.build()); ImmutableList<Path> toolSearchPaths = toolSearchPathsBuilder.build(); Tool clangPath = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "clang", version); Tool clangXxPath = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "clang++", version); Tool ar = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "ar", version); Tool ranlib = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "ranlib", version); Tool strip = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "strip", version); Tool nm = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "nm", version); Tool actool = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "actool", version); Tool ibtool = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "ibtool", version); Tool momc = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "momc", version); Tool xctest = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "xctest", version); Tool dsymutil = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "dsymutil", version); Tool lipo = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "lipo", version); Tool lldb = getXcodeTool(filesystem, toolSearchPaths, xcodeToolFinder, appleConfig, "lldb", version); Optional<Path> stubBinaryPath = targetSdk.getApplePlatform().getStubBinaryPath() .map(input -> sdkPaths.getSdkPath().resolve(input)); UserFlavor targetFlavor = UserFlavor.of( Flavor.replaceInvalidCharacters(targetSdk.getName() + "-" + targetArchitecture), String.format("SDK: %s, architecture: %s", targetSdk.getName(), targetArchitecture)); CxxBuckConfig config = appleConfig.useFlavoredCxxSections() ? new CxxBuckConfig(buckConfig, targetFlavor) : new CxxBuckConfig(buckConfig); ImmutableBiMap.Builder<Path, String> sanitizerPaths = ImmutableBiMap.builder(); sanitizerPaths.put(sdkPaths.getSdkPath(), "APPLE_SDKROOT"); sanitizerPaths.put(sdkPaths.getPlatformPath(), "APPLE_PLATFORM_DIR"); if (sdkPaths.getDeveloperPath().isPresent()) { sanitizerPaths.put(sdkPaths.getDeveloperPath().get(), "APPLE_DEVELOPER_DIR"); } // https://github.com/facebook/buck/pull/1168: add the root cell's absolute path to the quote // include path, and also force it to be sanitized by all user rule keys. sanitizerPaths.put(filesystem.getRootPath(), "."); cflagsBuilder.add("-iquote", filesystem.getRootPath().toString()); DebugPathSanitizer compilerDebugPathSanitizer = new PrefixMapDebugPathSanitizer( DebugPathSanitizer.getPaddedDir(".", config.getDebugPathSanitizerLimit(), File.separatorChar), sanitizerPaths.build()); DebugPathSanitizer assemblerDebugPathSanitizer = new MungingDebugPathSanitizer( config.getDebugPathSanitizerLimit(), File.separatorChar, Paths.get("."), sanitizerPaths.build()); ImmutableList<String> cflags = cflagsBuilder.build(); ImmutableMap.Builder<String, String> macrosBuilder = ImmutableMap.builder(); macrosBuilder.put("SDKROOT", sdkPaths.getSdkPath().toString()); macrosBuilder.put("PLATFORM_DIR", sdkPaths.getPlatformPath().toString()); macrosBuilder.put("CURRENT_ARCH", targetArchitecture); if (sdkPaths.getDeveloperPath().isPresent()) { macrosBuilder.put("DEVELOPER_DIR", sdkPaths.getDeveloperPath().get().toString()); } ImmutableMap<String, String> macros = macrosBuilder.build(); Optional<String> buildVersion = Optional.empty(); Path platformVersionPlistPath = sdkPaths.getPlatformPath().resolve("version.plist"); try (InputStream versionPlist = Files.newInputStream(platformVersionPlistPath)) { NSDictionary versionInfo = (NSDictionary) PropertyListParser.parse(versionPlist); if (versionInfo != null) { NSObject productBuildVersion = versionInfo.objectForKey("ProductBuildVersion"); if (productBuildVersion != null) { buildVersion = Optional.of(productBuildVersion.toString()); } else { LOG.warn("In %s, missing ProductBuildVersion. Build version will be unset for this platform.", platformVersionPlistPath); } } else { LOG.warn("Empty version plist in %s. Build version will be unset for this platform.", platformVersionPlistPath); } } catch (NoSuchFileException e) { LOG.warn("%s does not exist. Build version will be unset for this platform.", platformVersionPlistPath); } catch (PropertyListFormatException | SAXException | ParserConfigurationException | ParseException | IOException e) { // Some other error occurred, print the exception since it may contain error details. LOG.warn(e, "Failed to parse %s. Build version will be unset for this platform.", platformVersionPlistPath); } PreprocessorProvider aspp = new PreprocessorProvider(new ConstantToolProvider(clangPath), CxxToolProvider.Type.CLANG); CompilerProvider as = new CompilerProvider(new ConstantToolProvider(clangPath), CxxToolProvider.Type.CLANG, config.getUseDetailedUntrackedHeaderMessages()); PreprocessorProvider cpp = new PreprocessorProvider(new ConstantToolProvider(clangPath), CxxToolProvider.Type.CLANG); CompilerProvider cc = new CompilerProvider(new ConstantToolProvider(clangPath), CxxToolProvider.Type.CLANG, config.getUseDetailedUntrackedHeaderMessages()); PreprocessorProvider cxxpp = new PreprocessorProvider(new ConstantToolProvider(clangXxPath), CxxToolProvider.Type.CLANG); CompilerProvider cxx = new CompilerProvider(new ConstantToolProvider(clangXxPath), CxxToolProvider.Type.CLANG, config.getUseDetailedUntrackedHeaderMessages()); ImmutableList.Builder<String> whitelistBuilder = ImmutableList.builder(); whitelistBuilder.add("^" + Pattern.quote(sdkPaths.getSdkPath().toString()) + "\\/.*"); whitelistBuilder .add("^" + Pattern.quote(sdkPaths.getPlatformPath() + "/Developer/Library/Frameworks") + "\\/.*"); for (Path toolchainPath : sdkPaths.getToolchainPaths()) { LOG.debug("Apple toolchain path: %s", toolchainPath); try { whitelistBuilder.add("^" + Pattern.quote(toolchainPath.toRealPath().toString()) + "\\/.*"); } catch (IOException e) { LOG.warn(e, "Apple toolchain path could not be resolved: %s", toolchainPath); } } HeaderVerification headerVerification = config.getHeaderVerificationOrIgnore() .withPlatformWhitelist(whitelistBuilder.build()); LOG.debug("Headers verification platform whitelist: %s", headerVerification.getPlatformWhitelist()); CxxPlatform cxxPlatform = CxxPlatforms.build(targetFlavor, Platform.MACOS, config, as, aspp, cc, cxx, cpp, cxxpp, new DefaultLinkerProvider(LinkerProvider.Type.DARWIN, new ConstantToolProvider(clangXxPath), config.shouldCacheLinks()), ImmutableList.<String>builder().addAll(cflags).addAll(ldflagsBuilder.build()).build(), ImmutableMultimap.of(), strip, ArchiverProvider.from(new BsdArchiver(ar)), ArchiveContents.NORMAL, Optional.of(new ConstantToolProvider(ranlib)), new PosixNmSymbolNameTool(nm), cflagsBuilder.build(), ImmutableList.of(), cflags, ImmutableList.of(), cflags, ImmutableList.of(), "dylib", "%s.dylib", "a", "o", compilerDebugPathSanitizer, assemblerDebugPathSanitizer, macros, Optional.empty(), headerVerification, PicType.PIC); ApplePlatform applePlatform = targetSdk.getApplePlatform(); ImmutableList.Builder<Path> swiftOverrideSearchPathBuilder = ImmutableList.builder(); AppleSdkPaths.Builder swiftSdkPathsBuilder = AppleSdkPaths.builder().from(sdkPaths); Optional<SwiftPlatform> swiftPlatform = getSwiftPlatform(applePlatform.getName(), targetArchitecture + "-apple-" + applePlatform.getSwiftName().orElse(applePlatform.getName()) + minVersion, version, swiftSdkPathsBuilder.build(), swiftOverrideSearchPathBuilder.addAll(toolSearchPaths).build(), xcodeToolFinder, filesystem); platformBuilder.setCxxPlatform(cxxPlatform).setSwiftPlatform(swiftPlatform).setAppleSdk(targetSdk) .setAppleSdkPaths(sdkPaths).setMinVersion(minVersion).setBuildVersion(buildVersion) .setActool(actool).setIbtool(ibtool).setMomc(momc) .setCopySceneKitAssets(getOptionalTool("copySceneKitAssets", toolSearchPaths, xcodeToolFinder, version, filesystem)) .setXctest(xctest).setDsymutil(dsymutil).setLipo(lipo).setStubBinary(stubBinaryPath).setLldb(lldb) .setCodesignAllocate( getOptionalTool("codesign_allocate", toolSearchPaths, xcodeToolFinder, version, filesystem)) .setCodesignProvider(appleConfig.getCodesignProvider()); return platformBuilder.build(); }