Java 类org.gradle.api.Action 实例源码

项目:Reer    文件:NativeComponents.java   
public static void createExecutableTask(final NativeBinarySpecInternal binary, final File executableFile) {
    String taskName = binary.getNamingScheme().getTaskName("link");
    binary.getTasks().create(taskName, LinkExecutable.class, new Action<LinkExecutable>() {
        @Override
        public void execute(LinkExecutable linkTask) {
            linkTask.setDescription("Links " + binary.getDisplayName());
            linkTask.setToolChain(binary.getToolChain());
            linkTask.setTargetPlatform(binary.getTargetPlatform());
            linkTask.setOutputFile(executableFile);
            linkTask.setLinkerArgs(binary.getLinker().getArgs());

            linkTask.lib(new BinaryLibs(binary) {
                @Override
                protected FileCollection getFiles(NativeDependencySet nativeDependencySet) {
                    return nativeDependencySet.getLinkFiles();
                }
            });
            binary.builtBy(linkTask);
        }
    });
}
项目:Reer    文件:DependencyGraphRenderer.java   
private void doRender(final RenderableDependency node, boolean last, Set<Object> visited) {
    Set<? extends RenderableDependency> children = node.getChildren();
    final boolean alreadyRendered = !visited.add(node.getId());
    if (alreadyRendered) {
        legendRenderer.setHasCyclicDependencies(true);
    }


    renderer.visit(new Action<StyledTextOutput>() {
        public void execute(StyledTextOutput output) {
            nodeRenderer.renderNode(output, node, alreadyRendered);
        }

    }, last);

    if (!alreadyRendered) {
        renderChildren(children, visited);
    }

}
项目:Reer    文件:EclipsePlugin.java   
@Override
protected void onApply(Project project) {
    getLifecycleTask().setDescription("Generates all Eclipse files.");
    getCleanTask().setDescription("Cleans all Eclipse files.");

    EclipseModel model = project.getExtensions().create("eclipse", EclipseModel.class);

    configureEclipseProject(project, model);
    configureEclipseJdt(project, model);
    configureEclipseClasspath(project, model);

    postProcess("eclipse", new Action<Gradle>() {
        @Override
        public void execute(Gradle gradle) {
            performPostEvaluationActions();
        }
    });

    applyEclipseWtpPluginOnWebProjects(project);
}
项目:Reer    文件:IoActions.java   
public void execute(Action<? super BufferedWriter> action) {
    try {
        File parentFile = file.getParentFile();
        if (parentFile != null) {
            if (!parentFile.mkdirs() && !parentFile.isDirectory()) {
                throw new IOException(String.format("Unable to create directory '%s'", parentFile));
            }
        }
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), encoding));
        try {
            action.execute(writer);
        } finally {
            writer.close();
        }
    } catch (Exception e) {
        throw new UncheckedIOException(String.format("Could not write to file '%s'.", file), e);
    }
}
项目:Reer    文件:DefaultIvyPluginRepository.java   
@Override
protected ArtifactRepository internalCreateArtifactRepository(RepositoryHandler repositoryHandler) {
    return repositoryHandler.ivy(new Action<IvyArtifactRepository>() {
        @Override
        public void execute(IvyArtifactRepository ivyArtifactRepository) {
            ivyArtifactRepository.setName(getArtifactRepositoryName());
            ivyArtifactRepository.setUrl(getUrl());
            Credentials credentials = authenticationSupport().getConfiguredCredentials();
            if (credentials != null) {
                ((AuthenticationSupportedInternal)ivyArtifactRepository).setConfiguredCredentials(credentials);
                ivyArtifactRepository.authentication(new Action<AuthenticationContainer>() {
                    @Override
                    public void execute(AuthenticationContainer authenticationContainer) {
                        authenticationContainer.addAll(authenticationSupport().getConfiguredAuthentication());
                    }
                });
            }
        }
    });
}
项目:Reer    文件:DefaultTaskContainer.java   
public <T extends TaskInternal> void addPlaceholderAction(final String placeholderName, final Class<T> taskType, final Action<? super T> configure) {
    if (!modelNode.hasLink(placeholderName)) {
        final ModelType<T> taskModelType = ModelType.of(taskType);
        ModelPath path = MODEL_PATH.child(placeholderName);
        modelNode.addLink(
            ModelRegistrations.of(path)
                .action(ModelActionRole.Create, new TaskCreator<T>(placeholderName, taskType, configure, taskModelType))
                .withProjection(new UnmanagedModelProjection<T>(taskModelType))
                .descriptor(new SimpleModelRuleDescriptor("tasks.addPlaceholderAction(" + placeholderName + ")"))
                .build()
        );
    }
    if (findByNameWithoutRules(placeholderName) == null) {
        placeholders.add(placeholderName);
    }
}
项目:Reer    文件:AbstractCodeQualityPlugin.java   
private void configureExtensionRule() {
    final ConventionMapping extensionMapping = conventionMappingOf(extension);
    extensionMapping.map("sourceSets", Callables.returning(new ArrayList()));
    extensionMapping.map("reportsDir", new Callable<File>() {
        @Override
        public File call() {
            return project.getExtensions().getByType(ReportingExtension.class).file(getReportName());
        }
    });
    withBasePlugin(new Action<Plugin>() {
        @Override
        public void execute(Plugin plugin) {
            extensionMapping.map("sourceSets", new Callable<SourceSetContainer>() {
                @Override
                public SourceSetContainer call() {
                    return getJavaPluginConvention().getSourceSets();
                }
            });
        }
    });
}
项目:Reer    文件:ProjectReportTask.java   
private void render(final Project project, GraphRenderer renderer, boolean lastChild,
                    final StyledTextOutput textOutput) {
    renderer.visit(new Action<StyledTextOutput>() {
        public void execute(StyledTextOutput styledTextOutput) {
            styledTextOutput.text(StringUtils.capitalize(project.toString()));
            if (GUtil.isTrue(project.getDescription())) {
                textOutput.withStyle(Description).format(" - %s", project.getDescription());
            }
        }
    }, lastChild);
    renderer.startChildren();
    List<Project> children = getChildren(project);
    for (Project child : children) {
        render(child, renderer, child == children.get(children.size() - 1), textOutput);
    }
    renderer.completeChildren();
}
项目:Reer    文件:BasePlugin.java   
private void configureConfigurations(final Project project) {
    ConfigurationContainer configurations = project.getConfigurations();
    project.setProperty("status", "integration");

    Configuration archivesConfiguration = configurations.maybeCreate(Dependency.ARCHIVES_CONFIGURATION).
            setDescription("Configuration for archive artifacts.");

    configurations.maybeCreate(Dependency.DEFAULT_CONFIGURATION).
            setDescription("Configuration for default artifacts.");

    final DefaultArtifactPublicationSet defaultArtifacts = project.getExtensions().create(
            "defaultArtifacts", DefaultArtifactPublicationSet.class, archivesConfiguration.getArtifacts()
    );

    configurations.all(new Action<Configuration>() {
        public void execute(Configuration configuration) {
            configuration.getArtifacts().all(new Action<PublishArtifact>() {
                public void execute(PublishArtifact artifact) {
                    defaultArtifacts.addCandidate(artifact);
                }
            });
        }
    });
}
项目:Reer    文件:LinkExeLinker.java   
@Override
public WorkResult execute(final LinkerSpec spec) {
    LinkerSpec transformedSpec = specTransformer.transform(spec);
    List<String> args = argsTransformer.transform(transformedSpec);
    invocationContext.getArgAction().execute(args);
    new VisualCppOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation(
            "linking " + spec.getOutputFile().getName(), args, spec.getOperationLogger());

    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {
        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });

    return new SimpleWorkResult(true);
}
项目:Reer    文件:CoffeeScriptCompilerWorker.java   
public void process(SerializableCoffeeScriptCompileSpec spec) {
    Scriptable coffeeScriptScope = parse(spec.getCoffeeScriptJs(), "UTF-8", new Action<Context>() {
        public void execute(Context context) {
            context.setOptimizationLevel(-1);
        }
    });

    String encoding = spec.getOptions().getEncoding();

    CoffeeScriptCompileDestinationCalculator destinationCalculator = new CoffeeScriptCompileDestinationCalculator(spec.getDestinationDir());

    for (RelativeFile target : spec.getSource()) {
        String source = readFile(target.getFile(), encoding);
        String output = compile(coffeeScriptScope, source, target.getRelativePath().getPathString());
        writeFile(output, destinationCalculator.transform(target.getRelativePath()), encoding);
    }
}
项目:Reer    文件:ScalaBasePlugin.java   
private static void configureCompileDefaults(final Project project, final ScalaRuntime scalaRuntime) {
    project.getTasks().withType(ScalaCompile.class, new Action<ScalaCompile>() {
        @Override
        public void execute(final ScalaCompile compile) {
            compile.getConventionMapping().map("scalaClasspath", new Callable<FileCollection>() {
                @Override
                public FileCollection call() throws Exception {
                    return scalaRuntime.inferScalaClasspath(compile.getClasspath());
                }
            });
            compile.getConventionMapping().map("zincClasspath", new Callable<Configuration>() {
                @Override
                public Configuration call() throws Exception {
                    Configuration config = project.getConfigurations().getAt(ZINC_CONFIGURATION_NAME);
                    if (config.getDependencies().isEmpty()) {
                        project.getDependencies().add("zinc", "com.typesafe.zinc:zinc:" + DefaultScalaToolProvider.DEFAULT_ZINC_VERSION);
                    }
                    return config;
                }
            });
        }
    });
}
项目:Reer    文件:RhinoWorkerUtils.java   
public static Scriptable parse(File source, String encoding, Action<Context> contextConfig) {
    Context context = Context.enter();
    if (contextConfig != null) {
        contextConfig.execute(context);
    }

    Scriptable scope = context.initStandardObjects();
    try {
        Reader reader = new InputStreamReader(new FileInputStream(source), encoding);
        try {
            context.evaluateReader(scope, reader, source.getName(), 0, null);
        } finally {
            reader.close();
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    } finally {
        Context.exit();
    }

    return scope;
}
项目:gradle-circle-style    文件:CircleStylePlugin.java   
@Override
public void apply(Project rootProject) {
    final String circleReportsDir = System.getenv("CIRCLE_TEST_REPORTS");
    if (circleReportsDir == null) {
        return;
    }

    configureBuildFailureFinalizer(rootProject, circleReportsDir);

    final StyleTaskTimer timer = new StyleTaskTimer();
    rootProject.getGradle().addListener(timer);

    rootProject.allprojects(new Action<Project>() {
        @Override
        public void execute(final Project project) {
            project.getTasks().withType(Checkstyle.class, new Action<Checkstyle>() {
                @Override
                public void execute(Checkstyle checkstyleTask) {
                    configureCheckstyleTask(project, checkstyleTask, circleReportsDir, timer);
                }
            });
            project.getTasks().withType(FindBugs.class, new Action<FindBugs>() {
                @Override
                public void execute(FindBugs findbugsTask) {
                    configureFindbugsTask(project, findbugsTask, circleReportsDir, timer);
                }
            });
        }
    });
}
项目:gradle-circle-style    文件:CircleStylePlugin.java   
private void configureFindbugsTask(
        final Project project,
        final FindBugs findbugsTask,
        final String circleReportsDir,
        final StyleTaskTimer timer) {
    // Ensure XML output is enabled
    findbugsTask.doFirst(new Action<Task>() {
        @Override
        public void execute(Task task) {
            for (SingleFileReport report : findbugsTask.getReports()) {
                report.setEnabled(false);
            }
            FindBugsXmlReport xmlReport = (FindBugsXmlReport) findbugsTask.getReports().findByName("xml");
            xmlReport.setEnabled(true);
            xmlReport.setWithMessages(true);
        }
    });

    // Configure the finalizer task
    CircleStyleFinalizer finalizer = createTask(
            project.getTasks(),
            findbugsTask.getName() + "CircleFinalizer",
            CircleStyleFinalizer.class);
    if (finalizer == null) {
        // Already registered (happens if the user applies us to the root project and subprojects)
        return;
    }
    finalizer.setReportParser(FindBugsReportHandler.PARSER);
    finalizer.setStyleTask(findbugsTask);
    finalizer.setReporting(findbugsTask);
    finalizer.setStyleTaskTimer(timer);
    finalizer.setTargetFile(new File(
            new File(circleReportsDir, "findbugs"),
            project.getName() + "-" + findbugsTask.getName() + ".xml"));

    findbugsTask.finalizedBy(finalizer);
}
项目:Reer    文件:DefaultCachePolicy.java   
public boolean mustRefreshVersionList(final ModuleIdentifier moduleIdentifier, Set<ModuleVersionIdentifier> matchingVersions, long ageMillis) {
    CachedDependencyResolutionControl dependencyResolutionControl = new CachedDependencyResolutionControl(moduleIdentifier, matchingVersions, ageMillis);

    for (Action<? super DependencyResolutionControl> rule : dependencyCacheRules) {
        rule.execute(dependencyResolutionControl);
        if (dependencyResolutionControl.ruleMatch()) {
            return dependencyResolutionControl.mustCheck();
        }
    }

    return false;
}
项目:Reer    文件:CommandLineActionFactory.java   
private Action<? super ExecutionListener> createAction(Iterable<CommandLineAction> factories, CommandLineParser parser, ParsedCommandLine commandLine) {
    for (CommandLineAction factory : factories) {
        Runnable action = factory.createAction(parser, commandLine);
        if (action != null) {
            return Actions.toAction(action);
        }
    }
    throw new UnsupportedOperationException("No action factory for specified command-line arguments.");
}
项目:Reer    文件:EclipseWtpPlugin.java   
private <T extends Task> void maybeAddTask(Project project, IdePlugin plugin, String taskName, Class<T> taskType, Action<T> action) {
    if (project.getTasks().findByName(taskName) != null) {
        return;

    }

    T task = project.getTasks().create(taskName, taskType);
    action.execute(task);
    plugin.addWorker(task);
}
项目:Reer    文件:JvmComponentPlugin.java   
private static List<LocalJava> toImmutableJdkList(ModelMap<LocalJava> jdks) {
    final List<LocalJava> asImmutable = Lists.newArrayList();
    jdks.afterEach(new Action<LocalJava>() {
        @Override
        public void execute(LocalJava localJava) {
            asImmutable.add(localJava);
        }
    });
    return asImmutable;
}
项目:Reer    文件:BiActions.java   
public static <A> BiAction<A, Object> usingFirstArgument(final Action<? super A> action) {
    return new BiAction<A, Object>() {
        public void execute(A a, Object o) {
            action.execute(a);
        }
    };
}
项目:Reer    文件:LifecycleBasePlugin.java   
private void addClean(final ProjectInternal project) {
    addPlaceholderAction(project, CLEAN_TASK_NAME, Delete.class, new Action<Delete>() {
        @Override
        public void execute(Delete clean) {
            clean.setDescription("Deletes the build directory.");
            clean.setGroup(BUILD_GROUP);
            clean.delete(new Callable<File>() {
                public File call() throws Exception {
                    return project.getBuildDir();
                }
            });
        }
    });
}
项目:Reer    文件:ComponentModelBasePlugin.java   
@Defaults
// TODO:LPTR We should collect all source sets in the project source set, however this messes up ComponentReportRenderer
void addComponentSourcesSetsToProjectSourceSet(@Each SourceComponentSpec component, final ProjectSourceSet projectSourceSet) {
    component.getSources().afterEach(new Action<LanguageSourceSet>() {
        @Override
        public void execute(LanguageSourceSet languageSourceSet) {
            projectSourceSet.add(languageSourceSet);
        }
    });
}
项目:Reer    文件:DefaultCacheFactory.java   
@Override
public PersistentCache open(File cacheDir, String displayName, @Nullable CacheValidator cacheValidator, Map<String, ?> properties, CacheBuilder.LockTarget lockTarget, LockOptions lockOptions, Action<? super PersistentCache> initializer) throws CacheOpenException {
    lock.lock();
    try {
        return doOpen(cacheDir, displayName, cacheValidator, properties, lockTarget, lockOptions, initializer);
    } finally {
        lock.unlock();
    }
}
项目:Reer    文件:SigningExtension.java   
/**
 * Creates signing tasks that sign {@link Configuration#getAllArtifacts() all of the artifacts} of the given configurations.
 *
 * <p>The created tasks will be named "sign<i>&lt;configuration name capitalized&gt;</i>". That is, given a configuration with the name "archives" the created task will be named "signArchives".
 *
 * The signature artifact for the created task is added to the {@link #getConfiguration() for this settings object}.
 *
 * @param configurations The configurations whose archives are to be signed
 * @return the created tasks.
 */
public List<Sign> sign(Configuration... configurations) {
    List<Sign> result = new ArrayList<Sign>(configurations.length);
    for (final Configuration configurationToSign : configurations) {
        result.add(
            createSignTaskFor(configurationToSign.getName(), new Action<Sign>() {
                public void execute(Sign task) {
                    task.sign(configurationToSign);
                }
            })
        );
    }
    return result;
}
项目:Reer    文件:FileCopier.java   
private DestinationRootCopySpec createCopySpec(Action<? super CopySpec> action) {
    DefaultCopySpec copySpec = new DefaultCopySpec(this.fileResolver, instantiator);
    DestinationRootCopySpec destinationRootCopySpec = new DestinationRootCopySpec(fileResolver, copySpec);
    CopySpec wrapped = instantiator.newInstance(CopySpecWrapper.class, destinationRootCopySpec);
    action.execute(wrapped);
    return destinationRootCopySpec;
}
项目:Reer    文件:ProjectScopeServices.java   
public ProjectScopeServices(final ServiceRegistry parent, final ProjectInternal project, Factory<LoggingManagerInternal> loggingManagerInternalFactory) {
    super(parent);
    this.project = project;
    this.loggingManagerInternalFactory = loggingManagerInternalFactory;
    register(new Action<ServiceRegistration>() {
        public void execute(ServiceRegistration registration) {
            registration.add(DomainObjectContext.class, project);
            parent.get(DependencyManagementServices.class).addDslServices(registration);
            for (PluginServiceRegistry pluginServiceRegistry : parent.getAll(PluginServiceRegistry.class)) {
                pluginServiceRegistry.registerProjectServices(registration);
            }
        }
    });
}
项目:Reer    文件:FixedExclusiveModeCrossProcessCacheAccess.java   
public FixedExclusiveModeCrossProcessCacheAccess(String cacheDisplayName, File lockTarget, LockOptions lockOptions, FileLockManager lockManager, CacheInitializationAction initializationAction, Action<FileLock> onOpenAction, Action<FileLock> onCloseAction) {
    assert lockOptions.getMode() == Exclusive;
    this.initializationAction = initializationAction;
    this.onOpenAction = onOpenAction;
    this.onCloseAction = onCloseAction;
    assert lockOptions.getMode() == Exclusive;
    this.cacheDisplayName = cacheDisplayName;
    this.lockTarget = lockTarget;
    this.lockOptions = lockOptions;
    this.lockManager = lockManager;
}
项目:Reer    文件:NodeBackedModelMap.java   
private <S extends T> void doCreate(String name, ModelType<S> type, @Nullable Action<? super S> initAction) {
    ModelPath childPath = modelNode.getPath().child(name);
    ModelRuleDescriptor descriptor = sourceDescriptor.append("create(%s)", name);
    if (initAction != null) {
        doCreate(childPath, type, descriptor, NoInputsModelAction.of(ModelReference.of(childPath, type), descriptor, initAction));
    } else {
        doCreate(childPath, type, descriptor, null);
    }
}
项目:Reer    文件:DefaultTaskGraphExecuter.java   
public void whenReady(final Action<TaskExecutionGraph> action) {
    graphListeners.add(new TaskExecutionGraphListener() {
        @Override
        public void graphPopulated(TaskExecutionGraph graph) {
            action.execute(graph);
        }
    });
}
项目:Reer    文件:FileCacheBackedScriptClassCompiler.java   
public ProgressReportingInitializer(ProgressLoggerFactory progressLoggerFactory,
                                    Action<PersistentCache> delegate,
                                    String shortDescription,
                                    String longDescription) {
    this.progressLoggerFactory = progressLoggerFactory;
    this.delegate = delegate;
    this.shortDescription = shortDescription;
    this.longDescription = longDescription;
}
项目:Reer    文件:JavaBasePlugin.java   
private BridgedBinaries configureSourceSetDefaults(final JavaPluginConvention pluginConvention) {
    final Project project = pluginConvention.getProject();
    final List<ClassDirectoryBinarySpecInternal> binaries = Lists.newArrayList();
    pluginConvention.getSourceSets().all(new Action<SourceSet>() {
        public void execute(final SourceSet sourceSet) {
            ConventionMapping outputConventionMapping = ((IConventionAware) sourceSet.getOutput()).getConventionMapping();

            ConfigurationContainer configurations = project.getConfigurations();

            defineConfigurationsForSourceSet(sourceSet, configurations);
            definePathsForSourceSet(sourceSet, outputConventionMapping, project);

            createProcessResourcesTaskForBinary(sourceSet, sourceSet.getResources(), project);
            createCompileJavaTaskForBinary(sourceSet, sourceSet.getJava(), project);
            createBinaryLifecycleTask(sourceSet, project);

            DefaultComponentSpecIdentifier binaryId = new DefaultComponentSpecIdentifier(project.getPath(), sourceSet.getName());
            ClassDirectoryBinarySpecInternal binary = instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, binaryId, sourceSet, javaToolChain, DefaultJavaPlatform.current(), instantiator, taskFactory);

            Classpath compileClasspath = new SourceSetCompileClasspath(sourceSet);
            DefaultJavaSourceSet javaSourceSet = instantiator.newInstance(DefaultJavaSourceSet.class, binaryId.child("java"), sourceSet.getJava(), compileClasspath);
            JvmResourceSet resourceSet = instantiator.newInstance(DefaultJvmResourceSet.class, binaryId.child("resources"), sourceSet.getResources());

            binary.addSourceSet(javaSourceSet);
            binary.addSourceSet(resourceSet);

            attachTasksToBinary(binary, sourceSet, project);
            binaries.add(binary);
        }
    });
    return new BridgedBinaries(binaries);
}
项目:Reer    文件:ModelMapStrategy.java   
private <T, E> ModelSchema<T> getModelSchema(ModelSchemaExtractionContext<T> extractionContext, ModelType<E> elementType) {
    final ModelMapSchema<T, E> schema = new ModelMapSchema<T, E>(extractionContext.getType(), elementType);
    extractionContext.child(elementType, "element type", new Action<ModelSchema<E>>() {
        @Override
        public void execute(ModelSchema<E> elementTypeSchema) {
            schema.setElementTypeSchema(elementTypeSchema);
        }
    });
    return schema;
}
项目:Reer    文件:Deleter.java   
public WorkResult delete(Action<? super DeleteSpec> action) {
    boolean didWork = false;
    DeleteSpecInternal deleteSpec = new DefaultDeleteSpec();
    action.execute(deleteSpec);
    Object[] paths = deleteSpec.getPaths();
    for (File file : fileResolver.resolveFiles(paths)) {
        if (!file.exists()) {
            continue;
        }
        LOGGER.debug("Deleting {}", file);
        didWork = true;
        doDeleteInternal(file, deleteSpec);
    }
    return new SimpleWorkResult(didWork);
}
项目:Reer    文件:DefaultModelSchemaExtractionContext.java   
private DefaultModelSchemaExtractionContext(DefaultModelSchemaExtractionContext<?> parent, ModelType<T> type, String description, Action<? super ModelSchema<T>> validator) {
    this.parent = parent;
    this.type = type;
    this.description = description;
    this.problems = new FormattingValidationProblemCollector("model element type", type);
    this.validator = validator;
}
项目:Reer    文件:OperationTimer.java   
public MeasuredOperation measure(final Action<? super MeasuredOperation> action) {
    final MeasuredOperation result = new MeasuredOperation();
    try {
        DurationMeasurementImpl.measure(result, new Runnable() {
            @Override
            public void run() {
                action.execute(result);
            }
        });
    } catch (Exception e) {
        result.setException(e);
    }
    return result;
}
项目:Reer    文件:GraphRenderer.java   
/**
 * Visits a node in the graph.
 */
public void visit(Action<? super StyledTextOutput> node, boolean lastChild) {
    if (seenRootChildren) {
        output.withStyle(Info).text(prefix + (lastChild ? "\\--- " : "+--- "));
    }
    this.lastChild = lastChild;
    node.execute(output);
    output.println();
}
项目:Reer    文件:WarPlugin.java   
public void apply(final Project project) {
    project.getPluginManager().apply(JavaPlugin.class);
    final WarPluginConvention pluginConvention = new WarPluginConvention(project);
    project.getConvention().getPlugins().put("war", pluginConvention);

    project.getTasks().withType(War.class, new Action<War>() {
        public void execute(War task) {
            task.from(new Callable() {
                public Object call() throws Exception {
                    return pluginConvention.getWebAppDir();
                }
            });
            task.dependsOn(new Callable() {
                public Object call() throws Exception {
                    return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(
                            SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                }
            });
            task.classpath(new Object[] {new Callable() {
                public Object call() throws Exception {
                    FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
                            .getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                    Configuration providedRuntime = project.getConfigurations().getByName(
                            PROVIDED_RUNTIME_CONFIGURATION_NAME);
                    return runtimeClasspath.minus(providedRuntime);
                }
            }});
        }
    });

    War war = project.getTasks().create(WAR_TASK_NAME, War.class);
    war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
    war.setGroup(BasePlugin.BUILD_GROUP);
    ArchivePublishArtifact warArtifact = new ArchivePublishArtifact(war);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(warArtifact);
    configureConfigurations(project.getConfigurations());
    configureComponent(project, warArtifact);
}
项目:Reer    文件:JacocoMerge.java   
/**
 * Adds execution data generated by the given tasks to the list of those merged. Only tasks with a {@link JacocoTaskExtension} will be included; all others will be ignored.
 *
 * @param tasks one or more tasks to merge
 */
public void executionData(TaskCollection tasks) {
    tasks.all(new Action<Task>() {
        @Override
        public void execute(Task task) {
            executionData(task);
        }
    });
}
项目:Reer    文件:DefaultCachePolicy.java   
private void cacheMissingArtifactsFor(final int value, final TimeUnit units) {
    eachArtifact(new Action<ArtifactResolutionControl>() {
        public void execute(ArtifactResolutionControl artifactResolutionControl) {
            if (artifactResolutionControl.getCachedResult() == null) {
                artifactResolutionControl.cacheFor(value, units);
            }
        }
    });
}
项目:Reer    文件:DefaultBuildableCompositeBuildContext.java   
@Override
public Action<DependencySubstitution> getRuleAction() {
    List<Action<DependencySubstitution>> allActions = Lists.newArrayList();
    if (!provided.isEmpty()) {
        allActions.add(new CompositeBuildDependencySubstitutions(provided));
    }
    allActions.addAll(substitutionRules);
    return Actions.composite(allActions);
}