use of org.gradle.api.tasks.PathSensitivity in project gradle by gradle.
the class AbstractInputPropertyAnnotationHandler method visitPropertyValue.
@Override
public void visitPropertyValue(PropertyValue propertyValue, PropertyVisitor visitor, PropertySpecFactory specFactory, BeanPropertyContext context) {
PathSensitive pathSensitive = propertyValue.getAnnotation(PathSensitive.class);
final PathSensitivity pathSensitivity;
if (pathSensitive == null) {
pathSensitivity = PathSensitivity.ABSOLUTE;
} else {
pathSensitivity = pathSensitive.value();
}
DeclaredTaskInputFileProperty fileSpec = createFileSpec(propertyValue, specFactory);
fileSpec.withPropertyName(propertyValue.getPropertyName()).optional(propertyValue.isOptional()).withPathSensitivity(pathSensitivity).skipWhenEmpty(propertyValue.isAnnotationPresent(SkipWhenEmpty.class)).optional(propertyValue.isOptional());
visitor.visitInputFileProperty(fileSpec);
}
use of org.gradle.api.tasks.PathSensitivity in project gradle by gradle.
the class AbstractInputFilePropertyAnnotationHandler method visitPropertyValue.
@Override
public void visitPropertyValue(String propertyName, PropertyValue value, PropertyMetadata propertyMetadata, PropertyVisitor visitor, BeanPropertyContext context) {
Annotation fileNormalization = propertyMetadata.getAnnotationForCategory(NORMALIZATION);
Class<? extends FileNormalizer> fileNormalizer;
if (fileNormalization == null) {
fileNormalizer = null;
} else if (fileNormalization instanceof PathSensitive) {
PathSensitivity pathSensitivity = ((PathSensitive) fileNormalization).value();
fileNormalizer = FileParameterUtils.determineNormalizerForPathSensitivity(pathSensitivity);
} else if (fileNormalization instanceof Classpath) {
fileNormalizer = ClasspathNormalizer.class;
} else if (fileNormalization instanceof CompileClasspath) {
fileNormalizer = CompileClasspathNormalizer.class;
} else {
throw new IllegalStateException("Unknown normalization annotation used: " + fileNormalization);
}
visitor.visitInputFileProperty(propertyName, propertyMetadata.isAnnotationPresent(Optional.class), propertyMetadata.isAnnotationPresent(SkipWhenEmpty.class), determineDirectorySensitivity(propertyMetadata), propertyMetadata.isAnnotationPresent(NormalizeLineEndings.class) ? LineEndingSensitivity.NORMALIZE_LINE_ENDINGS : LineEndingSensitivity.DEFAULT, propertyMetadata.isAnnotationPresent(Incremental.class), fileNormalizer, value, getFilePropertyType());
}
Aggregations