Java Code Examples for com.google.common.collect.ImmutableCollection#Builder
The following examples show how to use
com.google.common.collect.ImmutableCollection#Builder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CxxTestDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractCxxTestDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { // Get any parse time deps from the C/C++ platforms. targetGraphOnlyDepsBuilder.addAll( getCxxPlatform(buildTarget, constructorArg) .getParseTimeDeps(buildTarget.getTargetConfiguration())); // Add in any implicit framework deps. extraDepsBuilder.addAll( getImplicitFrameworkDeps(buildTarget.getTargetConfiguration(), constructorArg)); constructorArg .getDepsQuery() .ifPresent( depsQuery -> QueryUtils.extractParseTimeTargets(buildTarget, cellRoots, depsQuery) .forEach(extraDepsBuilder::add)); }
Example 2
Source File: ScalaTestDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractScalaTestDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { extraDepsBuilder.add(config.getScalaLibraryTarget(buildTarget.getTargetConfiguration())); Optionals.addIfPresent( config.getScalacTarget(buildTarget.getTargetConfiguration()), extraDepsBuilder); javaOptionsForTests .apply(buildTarget.getTargetConfiguration()) .addParseTimeDeps(targetGraphOnlyDepsBuilder, buildTarget.getTargetConfiguration()); javacFactory.addParseTimeDeps( targetGraphOnlyDepsBuilder, constructorArg, buildTarget.getTargetConfiguration()); }
Example 3
Source File: CxxPythonExtensionDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractCxxPythonExtensionDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { // Get any parse time deps from the C/C++ platforms. getCxxPlatforms(buildTarget.getTargetConfiguration()) .getValues(buildTarget) .forEach( p -> extraDepsBuilder.addAll(p.getParseTimeDeps(buildTarget.getTargetConfiguration()))); for (PythonPlatform pythonPlatform : getPythonPlatforms(buildTarget.getTargetConfiguration()).getValues()) { Optionals.addIfPresent(pythonPlatform.getCxxLibrary(), extraDepsBuilder); } }
Example 4
Source File: HaskellBinaryDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractHaskellBinaryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { HaskellDescriptionUtils.getParseTimeDeps( buildTarget.getTargetConfiguration(), ImmutableList.of(getPlatform(buildTarget, constructorArg)), targetGraphOnlyDepsBuilder); constructorArg .getDepsQuery() .ifPresent( depsQuery -> QueryUtils.extractParseTimeTargets(buildTarget, cellRoots, depsQuery) .forEach(targetGraphOnlyDepsBuilder::add)); }
Example 5
Source File: AndroidLibraryDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractAndroidLibraryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { compilerFactory .getCompiler( constructorArg.getLanguage().orElse(JvmLanguage.JAVA), javacFactory, buildTarget.getTargetConfiguration()) .addTargetDeps( buildTarget.getTargetConfiguration(), extraDepsBuilder, targetGraphOnlyDepsBuilder); javacFactory.addParseTimeDeps( targetGraphOnlyDepsBuilder, constructorArg, buildTarget.getTargetConfiguration()); unresolvedInferPlatform .apply(buildTarget.getTargetConfiguration()) .ifPresent( p -> UnresolvedInferPlatform.addParseTimeDepsToInferFlavored( targetGraphOnlyDepsBuilder, buildTarget, p)); }
Example 6
Source File: CxxBinaryDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractCxxBinaryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { extraDepsBuilder.addAll( CxxPlatforms.findDepsForTargetFromConstructorArgs( getCxxPlatformsProvider(buildTarget.getTargetConfiguration()), buildTarget, constructorArg.getDefaultPlatform())); constructorArg .getDepsQuery() .ifPresent( depsQuery -> QueryUtils.extractParseTimeTargets(buildTarget, cellRoots, depsQuery) .forEach(targetGraphOnlyDepsBuilder::add)); }
Example 7
Source File: GoTestDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractGoTestDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { // Add the C/C++ platform parse time deps. GoPlatform platform = GoDescriptors.getPlatformForRule( getGoToolchain(buildTarget.getTargetConfiguration()), this.goBuckConfig, buildTarget, constructorArg); targetGraphOnlyDepsBuilder.addAll( CxxPlatforms.getParseTimeDeps( buildTarget.getTargetConfiguration(), platform.getCxxPlatform())); }
Example 8
Source File: OcamlLibraryDescription.java From buck with Apache License 2.0 | 6 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractOcamlLibraryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { for (OcamlPlatform platform : toolchainProvider .getByName( OcamlToolchain.DEFAULT_NAME, buildTarget.getTargetConfiguration(), OcamlToolchain.class) .getOcamlPlatforms() .getValues()) { targetGraphOnlyDepsBuilder.addAll( OcamlUtil.getParseTimeDeps(buildTarget.getTargetConfiguration(), platform)); } }
Example 9
Source File: ValueWithFailures.java From Strata with Apache License 2.0 | 5 votes |
private static <T> ImmutableList<FailureItem> combine( Iterable<? extends ValueWithFailures<? extends T>> items, ImmutableCollection.Builder<T> values) { ImmutableList.Builder<FailureItem> failures = ImmutableList.builder(); for (ValueWithFailures<? extends T> item : items) { values.add(item.getValue()); failures.addAll(item.getFailures()); } return failures.build(); }
Example 10
Source File: JavacFactory.java From buck with Apache License 2.0 | 5 votes |
/** * Adds the parse time deps required for javac based on the args. If the args has a spec for * javac, we assume that the parse time deps will be derived elsewhere. */ public void addParseTimeDeps( ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder, @Nullable JvmLibraryArg args, TargetConfiguration toolchainTargetConfiguration) { if (args == null || !args.hasJavacSpec()) { javacProvider .apply(toolchainTargetConfiguration) .addParseTimeDeps(targetGraphOnlyDepsBuilder); } }
Example 11
Source File: KotlinLibraryDescription.java From buck with Apache License 2.0 | 5 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, KotlinLibraryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { javacFactory.addParseTimeDeps( targetGraphOnlyDepsBuilder, constructorArg, buildTarget.getTargetConfiguration()); }
Example 12
Source File: GroovyConfiguredCompilerFactory.java From buck with Apache License 2.0 | 5 votes |
@Override public void addTargetDeps( TargetConfiguration targetConfiguration, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { if (groovyBuckConfig != null) { Optionals.addIfPresent( groovyBuckConfig.getGroovycTarget(targetConfiguration), extraDepsBuilder); } }
Example 13
Source File: PrebuiltCxxLibraryDescription.java From buck with Apache License 2.0 | 5 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractPrebuiltCxxLibraryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { getPaths(buildTarget, constructorArg) .findParseTimeDeps(cellRoots, extraDepsBuilder, targetGraphOnlyDepsBuilder); getUnresolvedCxxPlatform(buildTarget) .ifPresent( provider -> targetGraphOnlyDepsBuilder.addAll( provider.getValue().getParseTimeDeps(buildTarget.getTargetConfiguration()))); }
Example 14
Source File: RustTestDescription.java From buck with Apache License 2.0 | 5 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractRustTestDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { targetGraphOnlyDepsBuilder.addAll( RustCompileUtils.getPlatformParseTimeDeps( getRustToolchain(buildTarget.getTargetConfiguration()), buildTarget, constructorArg)); }
Example 15
Source File: SwiftLibraryDescription.java From buck with Apache License 2.0 | 5 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractSwiftLibraryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { getSwiftPlatformsFlavorDomain(buildTarget.getTargetConfiguration()) .getValues() .forEach( platform -> extraDepsBuilder.addAll( platform.getParseTimeDeps(buildTarget.getTargetConfiguration()))); }
Example 16
Source File: DBinaryDescription.java From buck with Apache License 2.0 | 5 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, AbstractDBinaryDescriptionArg constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { extraDepsBuilder.addAll( DDescriptionUtils.getUnresolvedCxxPlatform( toolchainProvider, buildTarget.getTargetConfiguration(), dBuckConfig) .getParseTimeDeps(buildTarget.getTargetConfiguration())); }
Example 17
Source File: AbstractGenruleDescription.java From buck with Apache License 2.0 | 5 votes |
@Override public void findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, CellNameResolver cellRoots, T constructorArg, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) { if (constructorArg.isNeedAndroidTools()) { AndroidTools.addParseTimeDepsToAndroidTools( toolchainProvider, buildTarget, targetGraphOnlyDepsBuilder); } }
Example 18
Source File: PrebuiltCxxLibraryPaths.java From buck with Apache License 2.0 | 4 votes |
@SuppressWarnings("unused") default void findParseTimeDeps( CellNameResolver cellRoots, ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) {}
Example 19
Source File: ConfiguredCompilerFactory.java From buck with Apache License 2.0 | 4 votes |
public void addTargetDeps( @SuppressWarnings("unused") TargetConfiguration targetConfiguration, @SuppressWarnings("unused") ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, @SuppressWarnings("unused") ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) {}
Example 20
Source File: ModelBuilder.java From javaide with GNU General Public License v3.0 | 4 votes |
private AndroidArtifact createAndroidArtifact( @NonNull String name, @NonNull BaseVariantData<? extends BaseVariantOutputData> variantData) { VariantScope scope = variantData.getScope(); GradleVariantConfiguration variantConfiguration = variantData.getVariantConfiguration(); SigningConfig signingConfig = variantConfiguration.getSigningConfig(); String signingConfigName = null; if (signingConfig != null) { signingConfigName = signingConfig.getName(); } SourceProviders sourceProviders = determineSourceProviders(variantData); // get the outputs List<? extends BaseVariantOutputData> variantOutputs = variantData.getOutputs(); List<AndroidArtifactOutput> outputs = Lists.newArrayListWithCapacity(variantOutputs.size()); Collection<NativeLibrary> nativeLibraries = ImmutableList.of(); for (BaseVariantOutputData variantOutputData : variantOutputs) { int intVersionCode; if (variantOutputData instanceof ApkVariantOutputData) { intVersionCode = variantOutputData.getVersionCode(); } else { Integer versionCode = variantConfiguration.getMergedFlavor().getVersionCode(); intVersionCode = versionCode != null ? versionCode : 1; } ImmutableCollection.Builder<OutputFile> outputFiles = ImmutableList.builder(); // add the main APK outputFiles.add(new OutputFileImpl( variantOutputData.getMainOutputFile().getFilters(), variantOutputData.getMainOutputFile().getType().name(), variantOutputData.getOutputFile())); for (ApkOutputFile splitApk : variantOutputData.getOutputs()) { if (splitApk.getType() == OutputFile.OutputType.SPLIT) { outputFiles.add(new OutputFileImpl( splitApk.getFilters(), OutputFile.SPLIT, splitApk.getOutputFile())); } } // add the main APK. outputs.add(new AndroidArtifactOutputImpl( outputFiles.build(), "assemble" + variantOutputData.getFullName(), variantOutputData.getScope().getManifestOutputFile(), intVersionCode)); } return new AndroidArtifactImpl( name, outputs, variantData.assembleVariantTask == null ? scope.getTaskName("assemble") : variantData.assembleVariantTask.getName(), variantConfiguration.isSigningReady() || variantData.outputsAreSigned, signingConfigName, variantConfiguration.getApplicationId(), // TODO: Need to determine the tasks' name when the tasks may not be created // in component plugin. scope.getSourceGenTask() == null ? scope.getTaskName("generate", "Sources") : scope.getSourceGenTask().getName(), scope.getCompileTask() == null ? scope.getTaskName("compile", "Sources") : scope.getCompileTask().getName(), getGeneratedSourceFolders(variantData), getGeneratedResourceFolders(variantData), (variantData.javacTask != null) ? variantData.javacTask.getDestinationDir() : scope.getJavaOutputDir(), scope.getJavaResourcesDestinationDir(), DependenciesImpl.cloneDependencies(variantData, androidBuilder), sourceProviders.variantSourceProvider, sourceProviders.multiFlavorSourceProvider, nativeLibraries, variantConfiguration.getMergedBuildConfigFields(), variantConfiguration.getMergedResValues()); }