Search in sources :

Example 1 with RegularFileProperty

use of org.gradle.api.file.RegularFileProperty in project gradle by gradle.

the class BuildDependenciesOnlyFileCollectionResolveContext method add.

@Override
public FileCollectionResolveContext add(Object element) {
    // TODO - need to sync with DefaultFileCollectionResolveContext
    if (element instanceof Buildable) {
        taskContext.add(element);
    } else if (element instanceof Task) {
        taskContext.add(element);
    } else if (element instanceof TaskOutputs) {
        TaskOutputs outputs = (TaskOutputs) element;
        taskContext.add(outputs.getFiles());
    } else if (element instanceof RegularFileProperty || element instanceof DirectoryProperty) {
        taskContext.add(element);
    } else if (element instanceof Closure) {
        Closure closure = (Closure) element;
        Object closureResult = closure.call();
        if (closureResult != null) {
            add(closureResult);
        }
    } else if (element instanceof Callable) {
        Callable callable = (Callable) element;
        Object callableResult = uncheckedCall(callable);
        if (callableResult != null) {
            add(callableResult);
        }
    } else if (element instanceof Iterable && !(element instanceof Path)) {
        // Ignore Path
        Iterable<?> iterable = (Iterable) element;
        for (Object value : iterable) {
            add(value);
        }
    } else if (element instanceof Object[]) {
        Object[] array = (Object[]) element;
        for (Object value : array) {
            add(value);
        }
    }
    // Everything else assume has no dependencies
    return this;
}
Also used : Path(java.nio.file.Path) Task(org.gradle.api.Task) DirectoryProperty(org.gradle.api.file.DirectoryProperty) Closure(groovy.lang.Closure) RegularFileProperty(org.gradle.api.file.RegularFileProperty) TaskOutputs(org.gradle.api.tasks.TaskOutputs) Buildable(org.gradle.api.Buildable) Callable(java.util.concurrent.Callable)

Aggregations

Closure (groovy.lang.Closure)1 Path (java.nio.file.Path)1 Callable (java.util.concurrent.Callable)1 Buildable (org.gradle.api.Buildable)1 Task (org.gradle.api.Task)1 DirectoryProperty (org.gradle.api.file.DirectoryProperty)1 RegularFileProperty (org.gradle.api.file.RegularFileProperty)1 TaskOutputs (org.gradle.api.tasks.TaskOutputs)1