List of usage examples for com.google.common.collect ImmutableList.Builder addAll
boolean addAll(Collection<? extends E> c);
From source file:com.facebook.buck.jvm.groovy.GroovycStep.java
private ImmutableList<String> createCommand() { final ImmutableList.Builder<String> command = ImmutableList.builder(); command.addAll(groovyc.getCommandPrefix(resolver)); String classpath = Joiner.on(File.pathSeparator) .join(transform(declaredClasspathEntries, Object::toString)); command.add("-cp").add(classpath.isEmpty() ? "''" : classpath).add("-d").add(outputDirectory.toString()); addCrossCompilationOptions(command); command.addAll(extraArguments.orElse(ImmutableList.of())); command.add("@" + pathToSrcsList); return command.build(); }
From source file:com.facebook.buck.util.CommandSplitter.java
public ImmutableList<ImmutableList<String>> getCommandsForArguments(Iterable<String> arguments) { Iterator<String> argumentIterator = arguments.iterator(); if (!argumentIterator.hasNext()) { return ImmutableList.of(); }//from w ww .j a v a2 s . co m ImmutableList.Builder<ImmutableList<String>> commands = ImmutableList.builder(); ImmutableList.Builder<String> commandBuilder = ImmutableList.builder(); String firstArgument = argumentIterator.next(); commandBuilder.addAll(commandPrefix).add(firstArgument); int commandLength = commandPrefixLength + firstArgument.length() + 1; // +1 for separator while (argumentIterator.hasNext()) { // Loop invariant: commandBuilder contains at least one argument after the command prefix. String argument = argumentIterator.next(); int updatedCommandLength = commandLength + argument.length() + 1; // +1 for separator if (updatedCommandLength > desiredLimit) { // Put the current command into the output list and start building a new command commands.add(commandBuilder.build()); commandBuilder = ImmutableList.<String>builder().addAll(commandPrefix); commandLength = commandPrefixLength; } commandBuilder.add(argument); commandLength += argument.length() + 1; // +1 for separator } commands.add(commandBuilder.build()); return commands.build(); }
From source file:com.facebook.buck.features.gwt.GwtModule.java
@Override public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) { ImmutableList.Builder<Step> steps = ImmutableList.builder(); Path workingDirectory = outputFile.getParent(); steps.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath .fromCellRelativePath(context.getBuildCellRootPath(), getProjectFilesystem(), workingDirectory))); // A CopyResourcesStep is needed so that a file that is at java/com/example/resource.txt in the // repository will be added as com/example/resource.txt in the resulting JAR (assuming that // "/java/" is listed under src_roots in .buckconfig). Path tempJarFolder = workingDirectory.resolve("tmp"); steps.add(new CopyResourcesStep(getProjectFilesystem(), context, getBuildTarget(), ResourcesParameters.builder() .setResources(ResourcesParameters.getNamedResources(context.getSourcePathResolver(), ruleFinder, getProjectFilesystem(), filesForGwtModule)) .setResourcesRoot(resourcesRoot).build(), tempJarFolder));/*w w w .ja v a2s . c o m*/ steps.add(new JarDirectoryStep(getProjectFilesystem(), JarParameters.builder().setJarPath(outputFile) .setEntriesToJar(ImmutableSortedSet.of(tempJarFolder)).setMergeManifests(true).build())); buildableContext.recordArtifact(outputFile); return steps.build(); }
From source file:org.sonar.plugins.designite.DesignitePlugin.java
@Override public List getExtensions() { ImmutableList.Builder builder = ImmutableList.builder(); builder.add(DesigniteConfiguration.class, DesigniteRulesDefinition.class, DesigniteSensor.class); builder.addAll(pluginProperties()); return builder.build(); }
From source file:com.facebook.buck.apple.SceneKitAssets.java
@Override public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) { ImmutableList.Builder<Step> stepsBuilder = ImmutableList.builder(); stepsBuilder.add(new MakeCleanDirectoryStep(getProjectFilesystem(), outputDir)); for (SourcePath inputPath : sceneKitAssetsPaths) { final Path absoluteInputPath = context.getSourcePathResolver().getAbsolutePath(inputPath); if (copySceneKitAssets.isPresent()) { stepsBuilder.add(new ShellStep(getProjectFilesystem().getRootPath()) { @Override/*from w ww.ja v a2s . c o m*/ protected ImmutableList<String> getShellCommandInternal(ExecutionContext executionContext) { ImmutableList.Builder<String> commandBuilder = ImmutableList.builder(); commandBuilder .addAll(copySceneKitAssets.get().getCommandPrefix(context.getSourcePathResolver())); commandBuilder.add(absoluteInputPath.toString(), "-o", getProjectFilesystem().resolve(outputDir).resolve(absoluteInputPath.getFileName()) .toString(), "--target-platform=" + sdkName, "--target-version=" + minOSVersion); return commandBuilder.build(); } @Override public ImmutableMap<String, String> getEnvironmentVariables(ExecutionContext context) { return copySceneKitAssets.get().getEnvironment(); } @Override public String getShortName() { return "copy-scenekit-assets"; } }); } else { stepsBuilder.add(CopyStep.forDirectory(getProjectFilesystem(), absoluteInputPath, outputDir, CopyStep.DirectoryMode.CONTENTS_ONLY)); } } buildableContext.recordArtifact(getPathToOutput()); return stepsBuilder.build(); }
From source file:org.embulk.guice.Bootstrap.java
private Injector start() { if (started) { throw new IllegalStateException("System already initialized"); }//from w ww. j a v a 2 s . c om started = true; ImmutableList.Builder<Module> moduleList = ImmutableList.builder(); moduleList.addAll(modules); moduleList.add(new Module() { @Override public void configure(Binder binder) { binder.disableCircularProxies(); if (requireExplicitBindings) { binder.requireExplicitBindings(); } } }); moduleList.add(new LifeCycleModule()); Injector injector = Guice.createInjector(Stage.PRODUCTION, moduleList.build()); LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class); if (lifeCycleManager.size() > 0) { lifeCycleManager.start(); } return injector; }
From source file:com.google.googlejavaformat.java.javadoc.JavadocLexer.java
/** * Adjust indentation inside `<pre>{@code` blocks. * * <p>Also trim leading and trailing blank lines, and move the trailing `}` to its own line. *//* w ww . ja va 2s.co m*/ private static ImmutableList<Token> deindentPreCodeBlocks(List<Token> input) { ImmutableList.Builder<Token> output = ImmutableList.builder(); for (PeekingIterator<Token> tokens = peekingIterator(input.iterator()); tokens.hasNext();) { if (tokens.peek().getType() != PRE_OPEN_TAG) { output.add(tokens.next()); continue; } output.add(tokens.next()); List<Token> initialNewlines = new ArrayList<>(); while (tokens.hasNext() && tokens.peek().getType() == FORCED_NEWLINE) { initialNewlines.add(tokens.next()); } if (tokens.peek().getType() != LITERAL || !tokens.peek().getValue().matches("[ \t]*[{]@code")) { output.addAll(initialNewlines); output.add(tokens.next()); continue; } deindentPreCodeBlock(output, tokens); } return output.build(); }
From source file:com.android.idegen.AggregatedModule.java
@Override protected ImmutableList<File> getSourceDirs() { ImmutableList.Builder<File> builder = ImmutableList.builder(); for (Module module : modules) { builder.addAll(module.getSourceDirs()); }//from w ww . j a v a2 s . c o m return builder.build(); }
From source file:com.android.idegen.AggregatedModule.java
@Override protected ImmutableList<File> getExcludeDirs() { ImmutableList.Builder<File> builder = ImmutableList.builder(); for (Module module : modules) { builder.addAll(module.getExcludeDirs()); }// w ww . j a va 2 s .c o m return builder.build(); }
From source file:org.apache.flex.compiler.internal.css.semantics.ActivatedStyleSheets.java
/** * @return A list of all activated CSS model sorted by precedence. */// w ww . j av a2 s . c om public List<ICSSDocument> sort() { // Sort CSS models from SWC libraries by library path order. final List<ICSSDocument> librariesSorted = new ArrayList<ICSSDocument>(libraries.keySet()); Collections.sort(librariesSorted, comparator); final ImmutableList.Builder<ICSSDocument> builder = new ImmutableList.Builder<ICSSDocument>(); builder.addAll(defaults); builder.addAll(librariesSorted); builder.addAll(themes); return builder.build(); }