Search in sources :

Example 1 with InputPropertySpec

use of org.gradle.api.internal.tasks.properties.InputPropertySpec 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)

Example 2 with InputPropertySpec

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

the class TaskExecution method visitRegularInputs.

@Override
public void visitRegularInputs(InputFingerprinter.InputVisitor visitor) {
    TaskProperties taskProperties = context.getTaskProperties();
    ImmutableSortedSet<InputPropertySpec> inputProperties = taskProperties.getInputProperties();
    ImmutableSortedSet<InputFilePropertySpec> inputFileProperties = taskProperties.getInputFileProperties();
    for (InputPropertySpec inputProperty : inputProperties) {
        visitor.visitInputProperty(inputProperty.getPropertyName(), () -> InputParameterUtils.prepareInputParameterValue(inputProperty, task));
    }
    for (InputFilePropertySpec inputFileProperty : inputFileProperties) {
        Object value = inputFileProperty.getValue();
        // SkipWhenEmpty implies incremental.
        // If this file property is empty, then we clean up the previously generated outputs.
        // That means that there is a very close relation between the file property and the output.
        InputFingerprinter.InputPropertyType type = inputFileProperty.isSkipWhenEmpty() ? InputFingerprinter.InputPropertyType.PRIMARY : inputFileProperty.isIncremental() ? InputFingerprinter.InputPropertyType.INCREMENTAL : InputFingerprinter.InputPropertyType.NON_INCREMENTAL;
        String propertyName = inputFileProperty.getPropertyName();
        visitor.visitInputFileProperty(propertyName, type, new InputFingerprinter.FileValueSupplier(value, inputFileProperty.getNormalizer(), inputFileProperty.getDirectorySensitivity(), inputFileProperty.getLineEndingNormalization(), inputFileProperty::getPropertyFiles));
    }
}
Also used : InputPropertySpec(org.gradle.api.internal.tasks.properties.InputPropertySpec) InputFingerprinter(org.gradle.internal.execution.fingerprint.InputFingerprinter) TaskProperties(org.gradle.api.internal.tasks.properties.TaskProperties) InputFilePropertySpec(org.gradle.api.internal.tasks.properties.InputFilePropertySpec)

Aggregations

InputPropertySpec (org.gradle.api.internal.tasks.properties.InputPropertySpec)2 HashMap (java.util.HashMap)1 GetInputPropertiesVisitor (org.gradle.api.internal.tasks.properties.GetInputPropertiesVisitor)1 InputFilePropertySpec (org.gradle.api.internal.tasks.properties.InputFilePropertySpec)1 TaskProperties (org.gradle.api.internal.tasks.properties.TaskProperties)1 InputFingerprinter (org.gradle.internal.execution.fingerprint.InputFingerprinter)1