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

项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
@Override
public Rule addRule(final String description, final Action<String> ruleAction) {
    return addRule(new Rule() {
        public String getDescription() {
            return description;
        }

        public void apply(String taskName) {
            ruleAction.execute(taskName);
        }

        @Override
        public String toString() {
            return "Rule: " + description;
        }
    });
}
项目:Reer    文件:TaskReportRenderer.java   
/**
 * Writes a rule for the current project.
 *
 * @param rule The rule
 */
public void addRule(Rule rule) {
    if (!currentProjectHasRules) {
        addSubheading("Rules");
    }
    getTextOutput().println(GUtil.elvis(rule.getDescription(), ""));
    currentProjectHasRules = true;
}
项目:Reer    文件:TaskReportTask.java   
@Override
public void generate(Project project) throws IOException {
    renderer.showDetail(isDetail());
    renderer.addDefaultTasks(project.getDefaultTasks());

    AggregateMultiProjectTaskReportModel aggregateModel = new AggregateMultiProjectTaskReportModel(!isDetail(), isDetail());
    TaskDetailsFactory taskDetailsFactory = new TaskDetailsFactory(project);

    SingleProjectTaskReportModel projectTaskModel = new SingleProjectTaskReportModel(taskDetailsFactory);
    projectTaskModel.build(getProjectTaskLister().listProjectTasks(project));
    aggregateModel.add(projectTaskModel);

    for (Project subproject : project.getSubprojects()) {
        SingleProjectTaskReportModel subprojectTaskModel = new SingleProjectTaskReportModel(taskDetailsFactory);
        subprojectTaskModel.build(getProjectTaskLister().listProjectTasks(subproject));
        aggregateModel.add(subprojectTaskModel);
    }

    aggregateModel.build();

    DefaultGroupTaskReportModel model = new DefaultGroupTaskReportModel();
    model.build(aggregateModel);

    for (String group : model.getGroups()) {
        renderer.startTaskGroup(group);
        for (TaskDetails task : model.getTasksForGroup(group)) {
            renderer.addTask(task);
        }
    }
    renderer.completeTasks();

    for (Rule rule : project.getTasks().getRules()) {
        renderer.addRule(rule);
    }
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
private void applyRules(String name) {
    if (applyingRulesFor.contains(name)) {
        return;
    }
    applyingRulesFor.add(name);
    try {
        for (Rule rule : rules) {
            rule.apply(name);
        }
    } finally {
        applyingRulesFor.remove(name);
    }
}
项目:Pushjet-Android    文件:TaskReportRenderer.java   
/**
 * Writes a rule for the current project.
 *
 * @param rule The rule
 */
public void addRule(Rule rule) {
    if (!currentProjectHasRules) {
        addSubheading("Rules");
    }
    getTextOutput().println(GUtil.elvis(rule.getDescription(), ""));
    currentProjectHasRules = true;
}
项目:Pushjet-Android    文件:TaskReportTask.java   
public void generate(Project project) throws IOException {
    renderer.showDetail(isDetail());
    renderer.addDefaultTasks(project.getDefaultTasks());

    AggregateMultiProjectTaskReportModel aggregateModel = new AggregateMultiProjectTaskReportModel(!isDetail());
    TaskDetailsFactory taskDetailsFactory = new TaskDetailsFactory(project);

    SingleProjectTaskReportModel projectTaskModel = new SingleProjectTaskReportModel(taskDetailsFactory);
    projectTaskModel.build(getProjectTaskLister().listProjectTasks(project));
    aggregateModel.add(projectTaskModel);

    for (Project subproject : project.getSubprojects()) {
        SingleProjectTaskReportModel subprojectTaskModel = new SingleProjectTaskReportModel(taskDetailsFactory);
        subprojectTaskModel.build(getProjectTaskLister().listProjectTasks(subproject));
        aggregateModel.add(subprojectTaskModel);
    }

    aggregateModel.build();

    DefaultGroupTaskReportModel model = new DefaultGroupTaskReportModel();
    model.build(aggregateModel);

    for (String group : model.getGroups()) {
        renderer.startTaskGroup(group);
        for (TaskDetails task : model.getTasksForGroup(group)) {
            renderer.addTask(task);
            for (TaskDetails child : task.getChildren()) {
                renderer.addChildTask(child);
            }
        }
    }
    renderer.completeTasks();

    for (Rule rule : project.getTasks().getRules()) {
        renderer.addRule(rule);
    }
}
项目:Pushjet-Android    文件:TaskReportRenderer.java   
/**
 * Writes a rule for the current project.
 *
 * @param rule The rule
 */
public void addRule(Rule rule) {
    if (!currentProjectHasRules) {
        addSubheading("Rules");
    }
    getTextOutput().println(GUtil.elvis(rule.getDescription(), ""));
    currentProjectHasRules = true;
}
项目:Reer    文件:ReportContainer.java   
@Override
@Internal
List<Rule> getRules();
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public Rule addRule(Rule rule) {
    rules.add(rule);
    return rule;
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public Rule addRule(final String description, final Closure ruleAction) {
    return addRule(description, ClosureBackedAction.<String>of(ruleAction));
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public List<Rule> getRules() {
    return Collections.unmodifiableList(rules);
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
public Rule addRule(String description, Closure ruleAction) {
    return delegate.addRule(description, ruleAction);
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
@Override
public Rule addRule(String description, Action<String> ruleAction) {
    return delegate.addRule(description, ruleAction);
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
public Rule addRule(Rule rule) {
    return delegate.addRule(rule);
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
public List<Rule> getRules() {
    return delegate.getRules();
}
项目:Pushjet-Android    文件:TaskReportTask.java   
public void generate(Project project) throws IOException {
    renderer.showDetail(isDetail());
    renderer.addDefaultTasks(project.getDefaultTasks());

    AggregateMultiProjectTaskReportModel aggregateModel = new AggregateMultiProjectTaskReportModel(!isDetail());
    TaskDetailsFactory taskDetailsFactory = new TaskDetailsFactory(project);

    SingleProjectTaskReportModel projectTaskModel = new SingleProjectTaskReportModel(taskDetailsFactory);
    ProjectInternal projectInternal = (ProjectInternal) project;
    TaskContainerInternal tasks = projectInternal.getTasks();
    tasks.actualize();
    projectTaskModel.build(Sets.union(tasks, projectInternal.getImplicitTasks()));
    aggregateModel.add(projectTaskModel);

    for (Project subproject : project.getSubprojects()) {
        SingleProjectTaskReportModel subprojectTaskModel = new SingleProjectTaskReportModel(taskDetailsFactory);
        ProjectInternal subprojectInternal = (ProjectInternal) subproject;
        TaskContainerInternal subprojectTasks = subprojectInternal.getTasks();
        subprojectTasks.actualize();
        subprojectTaskModel.build(subprojectTasks);
        aggregateModel.add(subprojectTaskModel);
    }

    aggregateModel.build();

    DefaultGroupTaskReportModel model = new DefaultGroupTaskReportModel();
    model.build(aggregateModel);

    for (String group : model.getGroups()) {
        renderer.startTaskGroup(group);
        for (TaskDetails task : model.getTasksForGroup(group)) {
            renderer.addTask(task);
            for (TaskDetails child : task.getChildren()) {
                renderer.addChildTask(child);
            }
        }
    }
    renderer.completeTasks();

    for (Rule rule : project.getTasks().getRules()) {
        renderer.addRule(rule);
    }
}