use of org.gradle.internal.execution.fingerprint.InputFingerprinter.InputVisitor in project gradle by gradle.
the class ResolveChangesStep method createIncrementalInputProperties.
private static IncrementalInputProperties createIncrementalInputProperties(UnitOfWork work) {
UnitOfWork.InputChangeTrackingStrategy inputChangeTrackingStrategy = work.getInputChangeTrackingStrategy();
switch(inputChangeTrackingStrategy) {
case NONE:
return IncrementalInputProperties.NONE;
// noinspection deprecation
case ALL_PARAMETERS:
// When using IncrementalTaskInputs, keep the old behaviour of all file inputs being incremental
return IncrementalInputProperties.ALL;
case INCREMENTAL_PARAMETERS:
ImmutableBiMap.Builder<String, Object> builder = ImmutableBiMap.builder();
InputVisitor visitor = new InputVisitor() {
@Override
public void visitInputFileProperty(String propertyName, InputPropertyType type, FileValueSupplier valueSupplier) {
if (type.isIncremental()) {
Object value = valueSupplier.getValue();
if (value == null) {
throw new InvalidUserDataException("Must specify a value for incremental input property '" + propertyName + "'.");
}
builder.put(propertyName, value);
}
}
};
work.visitIdentityInputs(visitor);
work.visitRegularInputs(visitor);
return new DefaultIncrementalInputProperties(builder.build());
default:
throw new AssertionError("Unknown InputChangeTrackingStrategy: " + inputChangeTrackingStrategy);
}
}
Aggregations