use of org.gradle.api.internal.tasks.DefaultTaskValidationContext in project gradle by gradle.
the class ValidatingTaskExecuter method execute.
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
List<String> messages = Lists.newArrayList();
FileResolver resolver = ((ProjectInternal) task.getProject()).getFileResolver();
final TaskValidationContext validationContext = new DefaultTaskValidationContext(resolver, messages);
try {
context.getTaskProperties().validate(validationContext);
} catch (Exception ex) {
throw new TaskExecutionException(task, ex);
}
if (!messages.isEmpty()) {
List<String> firstMessages = messages.subList(0, Math.min(5, messages.size()));
if (!validationContext.getHighestSeverity().report(task, firstMessages, state)) {
return;
}
}
executer.execute(task, state, context);
}
use of org.gradle.api.internal.tasks.DefaultTaskValidationContext in project gradle by gradle.
the class TaskExecution method validate.
@Override
public void validate(WorkValidationContext validationContext) {
Class<?> taskType = GeneratedSubclasses.unpackType(task);
// TODO This should probably use the task class info store
boolean cacheable = taskType.isAnnotationPresent(CacheableTask.class);
TypeValidationContext typeValidationContext = validationContext.forType(taskType, cacheable);
context.getTaskProperties().validateType(typeValidationContext);
context.getTaskProperties().validate(new DefaultTaskValidationContext(fileOperations, reservedFileSystemLocationRegistry, typeValidationContext));
context.getValidationAction().validate(context.getTaskExecutionMode().isTaskHistoryMaintained(), typeValidationContext);
}
Aggregations