Search in sources :

Example 1 with GetInputPropertiesVisitor

use of org.gradle.api.internal.tasks.properties.GetInputPropertiesVisitor in project gradle by gradle.

the class DefaultTaskProperties method resolve.

public static TaskProperties resolve(PropertyWalker propertyWalker, PathToFileResolver resolver, TaskInternal task) {
    String beanName = task.toString();
    GetInputFilesVisitor inputFilesVisitor = new GetInputFilesVisitor();
    GetOutputFilesVisitor outputFilesVisitor = new GetOutputFilesVisitor();
    GetInputPropertiesVisitor inputPropertiesVisitor = new GetInputPropertiesVisitor(beanName);
    GetLocalStateVisitor localStateVisitor = new GetLocalStateVisitor(beanName, resolver);
    GetDestroyablesVisitor destroyablesVisitor = new GetDestroyablesVisitor(beanName, resolver);
    ValidationVisitor validationVisitor = new ValidationVisitor();
    try {
        TaskPropertyUtils.visitProperties(propertyWalker, task, new CompositePropertyVisitor(inputPropertiesVisitor, inputFilesVisitor, outputFilesVisitor, validationVisitor, destroyablesVisitor, localStateVisitor));
    } catch (Exception e) {
        throw new TaskExecutionException(task, e);
    }
    return new DefaultTaskProperties(task.toString(), inputPropertiesVisitor.getPropertyValuesFactory(), inputFilesVisitor.getFileProperties(), outputFilesVisitor.getFileProperties(), outputFilesVisitor.hasDeclaredOutputs(), localStateVisitor.getFiles(), destroyablesVisitor.getFiles(), validationVisitor.getTaskPropertySpecs());
}
Also used : GetInputFilesVisitor(org.gradle.api.internal.tasks.properties.GetInputFilesVisitor) TaskExecutionException(org.gradle.api.tasks.TaskExecutionException) GetInputPropertiesVisitor(org.gradle.api.internal.tasks.properties.GetInputPropertiesVisitor) GetOutputFilesVisitor(org.gradle.api.internal.tasks.properties.GetOutputFilesVisitor) TaskExecutionException(org.gradle.api.tasks.TaskExecutionException) CompositePropertyVisitor(org.gradle.api.internal.tasks.properties.CompositePropertyVisitor)

Example 2 with GetInputPropertiesVisitor

use of org.gradle.api.internal.tasks.properties.GetInputPropertiesVisitor in project gradle by gradle.

the class DefaultTaskInputs method getProperties.

@Override
public Map<String, Object> getProperties() {
    GetInputPropertiesVisitor visitor = new GetInputPropertiesVisitor();
    TaskPropertyUtils.visitProperties(propertyWalker, task, visitor);
    Map<String, Object> result = new HashMap<>();
    for (InputPropertySpec inputProperty : visitor.getProperties()) {
        result.put(inputProperty.getPropertyName(), InputParameterUtils.prepareInputParameterValue(inputProperty, task));
    }
    return Collections.unmodifiableMap(result);
}
Also used : InputPropertySpec(org.gradle.api.internal.tasks.properties.InputPropertySpec) GetInputPropertiesVisitor(org.gradle.api.internal.tasks.properties.GetInputPropertiesVisitor) HashMap(java.util.HashMap)

Aggregations

GetInputPropertiesVisitor (org.gradle.api.internal.tasks.properties.GetInputPropertiesVisitor)2 HashMap (java.util.HashMap)1 CompositePropertyVisitor (org.gradle.api.internal.tasks.properties.CompositePropertyVisitor)1 GetInputFilesVisitor (org.gradle.api.internal.tasks.properties.GetInputFilesVisitor)1 GetOutputFilesVisitor (org.gradle.api.internal.tasks.properties.GetOutputFilesVisitor)1 InputPropertySpec (org.gradle.api.internal.tasks.properties.InputPropertySpec)1 TaskExecutionException (org.gradle.api.tasks.TaskExecutionException)1