use of org.gradle.api.internal.TaskInternal in project gradle by gradle.
the class ClientForwardingTestOperationListener method started.
@Override
public void started(BuildOperationInternal buildOperation, OperationStartEvent startEvent) {
if (!(buildOperation.getOperationDescriptor() instanceof TaskOperationDescriptor)) {
return;
}
TaskInternal task = ((TaskOperationDescriptor) buildOperation.getOperationDescriptor()).getTask();
if (!(task instanceof Test)) {
return;
}
runningTasks.put(buildOperation.getId(), task.getPath());
}
use of org.gradle.api.internal.TaskInternal in project gradle by gradle.
the class TestExecutionResultEvaluator method started.
@Override
public void started(BuildOperationInternal buildOperation, OperationStartEvent startEvent) {
if (!(buildOperation.getOperationDescriptor() instanceof TaskOperationDescriptor)) {
return;
}
TaskInternal task = ((TaskOperationDescriptor) buildOperation.getOperationDescriptor()).getTask();
runningTasks.put(buildOperation.getId(), task.getPath());
}
use of org.gradle.api.internal.TaskInternal in project gradle by gradle.
the class DefaultTaskExecutionPlan method addToTaskGraph.
public void addToTaskGraph(Collection<? extends Task> tasks) {
List<TaskInfo> queue = new ArrayList<TaskInfo>();
List<Task> sortedTasks = new ArrayList<Task>(tasks);
Collections.sort(sortedTasks);
for (Task task : sortedTasks) {
TaskInfo node = nodeFactory.createNode(task);
if (node.isMustNotRun()) {
requireWithDependencies(node);
} else if (filter.isSatisfiedBy(task)) {
node.require();
}
entryTasks.add(node);
queue.add(node);
}
Set<TaskInfo> visiting = new HashSet<TaskInfo>();
CachingTaskDependencyResolveContext context = new CachingTaskDependencyResolveContext();
while (!queue.isEmpty()) {
TaskInfo node = queue.get(0);
if (node.getDependenciesProcessed()) {
// Have already visited this task - skip it
queue.remove(0);
continue;
}
TaskInternal task = node.getTask();
boolean filtered = !filter.isSatisfiedBy(task);
if (filtered) {
// Task is not required - skip it
queue.remove(0);
node.dependenciesProcessed();
node.doNotRequire();
filteredTasks.add(task);
continue;
}
if (visiting.add(node)) {
// Have not seen this task before - add its dependencies to the head of the queue and leave this
// task in the queue
// Make sure it has been configured
((TaskContainerInternal) task.getProject().getTasks()).prepareForExecution(task);
Set<? extends Task> dependsOnTasks = context.getDependencies(task, task.getTaskDependencies());
for (Task dependsOnTask : dependsOnTasks) {
TaskInfo targetNode = nodeFactory.createNode(dependsOnTask);
node.addDependencySuccessor(targetNode);
if (!visiting.contains(targetNode)) {
queue.add(0, targetNode);
}
}
for (Task finalizerTask : context.getDependencies(task, task.getFinalizedBy())) {
TaskInfo targetNode = nodeFactory.createNode(finalizerTask);
addFinalizerNode(node, targetNode);
if (!visiting.contains(targetNode)) {
queue.add(0, targetNode);
}
}
for (Task mustRunAfter : context.getDependencies(task, task.getMustRunAfter())) {
TaskInfo targetNode = nodeFactory.createNode(mustRunAfter);
node.addMustSuccessor(targetNode);
}
for (Task shouldRunAfter : context.getDependencies(task, task.getShouldRunAfter())) {
TaskInfo targetNode = nodeFactory.createNode(shouldRunAfter);
node.addShouldSuccessor(targetNode);
}
if (node.isRequired()) {
for (TaskInfo successor : node.getDependencySuccessors()) {
if (filter.isSatisfiedBy(successor.getTask())) {
successor.require();
}
}
} else {
tasksInUnknownState.add(node);
}
} else {
// Have visited this task's dependencies - add it to the graph
queue.remove(0);
visiting.remove(node);
node.dependenciesProcessed();
}
}
resolveTasksInUnknownState();
}
Aggregations