Java Code Examples for org.gradle.api.tasks.TaskDependency

The following examples show how to use org.gradle.api.tasks.TaskDependency. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void getNodeValues(Object node, Collection<? super Task> values, Collection<? super Object> connectedNodes) {
    if (node instanceof TaskDependencyInternal) {
        TaskDependencyInternal taskDependency = (TaskDependencyInternal) node;
        queue.clear();
        taskDependency.resolve(CachingTaskDependencyResolveContext.this);
        connectedNodes.addAll(queue);
    } else if (node instanceof Buildable) {
        Buildable buildable = (Buildable) node;
        connectedNodes.add(buildable.getBuildDependencies());
    } else if (node instanceof TaskDependency) {
        TaskDependency dependency = (TaskDependency) node;
        values.addAll(dependency.getDependencies(task));
    } else if (node instanceof Task) {
        values.add((Task) node);
    } else {
        throw new IllegalArgumentException(String.format("Cannot resolve object of unknown type %s to a Task.",
                node.getClass().getSimpleName()));
    }
}
 
Example 2
public void getNodeValues(Object node, Collection<? super Task> values, Collection<? super Object> connectedNodes) {
    if (node instanceof TaskDependencyInternal) {
        TaskDependencyInternal taskDependency = (TaskDependencyInternal) node;
        queue.clear();
        taskDependency.resolve(CachingTaskDependencyResolveContext.this);
        connectedNodes.addAll(queue);
    } else if (node instanceof Buildable) {
        Buildable buildable = (Buildable) node;
        connectedNodes.add(buildable.getBuildDependencies());
    } else if (node instanceof TaskDependency) {
        TaskDependency dependency = (TaskDependency) node;
        values.addAll(dependency.getDependencies(task));
    } else if (node instanceof Task) {
        values.add((Task) node);
    } else {
        throw new IllegalArgumentException(String.format("Cannot resolve object of unknown type %s to a Task.",
                node.getClass().getSimpleName()));
    }
}
 
Example 3
public void convertInto(Object element, Collection<? super FileCollection> result, FileResolver fileResolver) {
    if (element instanceof DefaultFileCollectionResolveContext) {
        DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
        result.addAll(nestedContext.resolveAsFileCollections());
    } else if (element instanceof FileCollection) {
        FileCollection fileCollection = (FileCollection) element;
        result.add(fileCollection);
    } else if (element instanceof MinimalFileTree) {
        MinimalFileTree fileTree = (MinimalFileTree) element;
        result.add(new FileTreeAdapter(fileTree));
    } else if (element instanceof MinimalFileSet) {
        MinimalFileSet fileSet = (MinimalFileSet) element;
        result.add(new FileCollectionAdapter(fileSet));
    } else if (element instanceof MinimalFileCollection) {
        throw new UnsupportedOperationException(String.format("Cannot convert instance of %s to FileTree", element.getClass().getSimpleName()));
    } else if (element instanceof TaskDependency) {
        // Ignore
        return;
    } else {
        result.add(new FileCollectionAdapter(new ListBackedFileSet(fileResolver.resolve(element))));
    }
}
 
Example 4
public FileCollectionBackedArchiveTextResource(final FileOperations fileOperations,
                                               final TemporaryFileProvider tempFileProvider,
                                               final FileCollection fileCollection,
                                               final String path, Charset charset) {
    super(tempFileProvider, new LazilyInitializedFileTree() {
        @Override
        public FileTree createDelegate() {
            File archiveFile = fileCollection.getSingleFile();
            String fileExtension = Files.getFileExtension(archiveFile.getName());
            FileTree archiveContents = fileExtension.equals("jar") || fileExtension.equals("zip")
                    ? fileOperations.zipTree(archiveFile) : fileOperations.tarTree(archiveFile);
            PatternSet patternSet = new PatternSet();
            patternSet.include(path);
            return archiveContents.matching(patternSet);
        }
        public TaskDependency getBuildDependencies() {
            return fileCollection.getBuildDependencies();
        }
    }, charset);
}
 
Example 5
public FileCollection minus(final FileCollection collection) {
    return new AbstractFileCollection() {
        @Override
        public String getDisplayName() {
            return AbstractFileCollection.this.getDisplayName();
        }

        @Override
        public TaskDependency getBuildDependencies() {
            return AbstractFileCollection.this.getBuildDependencies();
        }

        public Set<File> getFiles() {
            Set<File> files = new LinkedHashSet<File>(AbstractFileCollection.this.getFiles());
            files.removeAll(collection.getFiles());
            return files;
        }
    };
}
 
Example 6
public FileCollection getIncludeRoots() {
    return new AbstractFileCollection() {
        @Override
        public String getDisplayName() {
            return "Include roots of " + sourceSet.getName();
        }

        public Set<File> getFiles() {
            return sourceSet.getExportedHeaders().getSrcDirs();
        }

        @Override
        public TaskDependency getBuildDependencies() {
            return sourceSet.getBuildDependencies();
        }
    };
}
 
Example 7
public void convertInto(Object element, Collection<? super FileCollection> result, FileResolver fileResolver) {
    if (element instanceof DefaultFileCollectionResolveContext) {
        DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
        result.addAll(nestedContext.resolveAsFileCollections());
    } else if (element instanceof FileCollection) {
        FileCollection fileCollection = (FileCollection) element;
        result.add(fileCollection);
    } else if (element instanceof MinimalFileTree) {
        MinimalFileTree fileTree = (MinimalFileTree) element;
        result.add(new FileTreeAdapter(fileTree));
    } else if (element instanceof MinimalFileSet) {
        MinimalFileSet fileSet = (MinimalFileSet) element;
        result.add(new FileCollectionAdapter(fileSet));
    } else if (element instanceof MinimalFileCollection) {
        throw new UnsupportedOperationException(String.format("Cannot convert instance of %s to FileTree", element.getClass().getSimpleName()));
    } else if (element instanceof TaskDependency) {
        // Ignore
        return;
    } else {
        result.add(new FileCollectionAdapter(new ListBackedFileSet(fileResolver.resolve(element))));
    }
}
 
Example 8
public void convertInto(Object element, Collection<? super MinimalFileCollection> result, FileResolver resolver) {
    if (element instanceof DefaultFileCollectionResolveContext) {
        DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
        result.addAll(nestedContext.resolveAsMinimalFileCollections());
    } else if (element instanceof MinimalFileCollection) {
        MinimalFileCollection collection = (MinimalFileCollection) element;
        result.add(collection);
    } else if (element instanceof FileCollection) {
        throw new UnsupportedOperationException(String.format("Cannot convert instance of %s to MinimalFileCollection", element.getClass().getSimpleName()));
    } else if (element instanceof TaskDependency) {
        // Ignore
        return;
    } else {
        result.add(new ListBackedFileSet(resolver.resolve(element)));
    }
}
 
Example 9
@Override
public FileCollection filter(final Spec<? super File> filterSpec) {
    return new CompositeFileCollection() {
        @Override
        public void resolve(FileCollectionResolveContext context) {
            for (FileCollection collection : CompositeFileCollection.this.getSourceCollections()) {
                context.add(collection.filter(filterSpec));
            }
        }

        @Override
        public String getDisplayName() {
            return CompositeFileCollection.this.getDisplayName();
        }

        @Override
        public TaskDependency getBuildDependencies() {
            return CompositeFileCollection.this.getBuildDependencies();
        }
    };
}
 
Example 10
public FileCollection getIncludeRoots() {
    return new AbstractFileCollection() {
        @Override
        public String getDisplayName() {
            return "Include roots of " + sourceSet.getName();
        }

        public Set<File> getFiles() {
            return sourceSet.getExportedHeaders().getSrcDirs();
        }

        @Override
        public TaskDependency getBuildDependencies() {
            return sourceSet.getBuildDependencies();
        }
    };
}
 
Example 11
@Override
public FileCollection filter(final Spec<? super File> filterSpec) {
    return new CompositeFileCollection() {
        @Override
        public void resolve(FileCollectionResolveContext context) {
            for (FileCollection collection : CompositeFileCollection.this.getSourceCollections()) {
                context.add(collection.filter(filterSpec));
            }
        }

        @Override
        public String getDisplayName() {
            return CompositeFileCollection.this.getDisplayName();
        }

        @Override
        public TaskDependency getBuildDependencies() {
            return CompositeFileCollection.this.getBuildDependencies();
        }
    };
}
 
Example 12
public void getNodeValues(Object node, Collection<? super Task> values, Collection<? super Object> connectedNodes) {
    if (node instanceof TaskDependencyInternal) {
        TaskDependencyInternal taskDependency = (TaskDependencyInternal) node;
        queue.clear();
        taskDependency.resolve(CachingTaskDependencyResolveContext.this);
        connectedNodes.addAll(queue);
    } else if (node instanceof Buildable) {
        Buildable buildable = (Buildable) node;
        connectedNodes.add(buildable.getBuildDependencies());
    } else if (node instanceof TaskDependency) {
        TaskDependency dependency = (TaskDependency) node;
        values.addAll(dependency.getDependencies(task));
    } else if (node instanceof Task) {
        values.add((Task) node);
    } else {
        throw new IllegalArgumentException(String.format("Cannot resolve object of unknown type %s to a Task.",
                node.getClass().getSimpleName()));
    }
}
 
Example 13
public void convertInto(Object element, Collection<? super FileTree> result, FileResolver resolver) {
    if (element instanceof DefaultFileCollectionResolveContext) {
        DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
        result.addAll(nestedContext.resolveAsFileTrees());
    } else if (element instanceof Buildable) {
        Buildable buildable = (Buildable) element;
        result.add(new FileTreeAdapter(new EmptyFileTree(buildable.getBuildDependencies())));
    } else if (element instanceof TaskDependency) {
        TaskDependency dependency = (TaskDependency) element;
        result.add(new FileTreeAdapter(new EmptyFileTree(dependency)));
    }
}
 
Example 14
public void convertInto(Object element, Collection<? super FileTree> result, FileResolver resolver) {
    if (element instanceof DefaultFileCollectionResolveContext) {
        DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
        result.addAll(nestedContext.resolveAsFileTrees());
    } else if (element instanceof Buildable) {
        Buildable buildable = (Buildable) element;
        result.add(new FileTreeAdapter(new EmptyFileTree(buildable.getBuildDependencies())));
    } else if (element instanceof TaskDependency) {
        TaskDependency dependency = (TaskDependency) element;
        result.add(new FileTreeAdapter(new EmptyFileTree(dependency)));
    }
}
 
Example 15
public TaskDependency getBuildDependencies() {
    return new TaskDependency() {
        public Set<? extends Task> getDependencies(Task other) {
            if (lifecycleTask == null) {
                return buildDependencies.getDependencies(other);
            }
            return Collections.singleton(lifecycleTask);
        }
    };
}
 
Example 16
public TaskDependency getBuildDependencies() {
    return new TaskDependency() {
        public Set<? extends Task> getDependencies(Task task) {
            Set<Task> dependencies = new HashSet<Task>();
            dependencies.addAll(compileClasspath.getBuildDependencies().getDependencies(task));
            dependencies.addAll(getSource().getBuildDependencies().getDependencies(task));
            return dependencies;
        }
    };
}
 
Example 17
/**
 * {@inheritDoc}
 */
public TaskDependency getTaskDependencyFromProjectDependency(final boolean useDependedOn, final String taskName) {
    if (useDependedOn) {
        return new TasksFromProjectDependencies(taskName, getAllDependencies());
    } else {
        return new TasksFromDependentProjects(taskName, getName());
    }
}
 
Example 18
public TaskDependency getBuildDependencies() {
    return new TaskDependency() {
        public Set<? extends Task> getDependencies(Task other) {
            if (lifecycleTask == null) {
                return buildDependencies.getDependencies(other);
            }
            return Collections.singleton(lifecycleTask);
        }
    };
}
 
Example 19
@Override
public TaskDependency getBuildDependencies() {
    if (fileCollection instanceof Buildable) {
        Buildable buildable = (Buildable) fileCollection;
        return buildable.getBuildDependencies();
    }
    return super.getBuildDependencies();
}
 
Example 20
public boolean dependsOnTaskDidWork() {
    TaskDependency dependency = getTaskDependencies();
    for (Task depTask : dependency.getDependencies(this)) {
        if (depTask.getDidWork()) {
            return true;
        }
    }
    return false;
}
 
Example 21
@Override
public TaskDependency getBuildDependencies() {
    if (fileCollection instanceof Buildable) {
        Buildable buildable = (Buildable) fileCollection;
        return buildable.getBuildDependencies();
    }
    return super.getBuildDependencies();
}
 
Example 22
public TaskDependency getBuildDependencies() {
    return new TaskDependency() {
        public Set<? extends Task> getDependencies(Task task) {
            Set<Task> dependencies = new HashSet<Task>();
            dependencies.addAll(compileClasspath.getBuildDependencies().getDependencies(task));
            dependencies.addAll(getSource().getBuildDependencies().getDependencies(task));
            return dependencies;
        }
    };
}
 
Example 23
Source Project: pushfish-android   Source File: AntTarget.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public AntTarget() {
    dependsOn(new TaskDependency() {
        public Set<? extends Task> getDependencies(Task task) {
            return getAntTargetDependencies();
        }
    });
}
 
Example 24
@Override
public TaskDependency getBuildDependencies() {
    if (fileCollection instanceof Buildable) {
        Buildable buildable = (Buildable) fileCollection;
        return buildable.getBuildDependencies();
    }
    return super.getBuildDependencies();
}
 
Example 25
public void convertInto(Object element, Collection<? super FileTree> result, FileResolver resolver) {
    if (element instanceof DefaultFileCollectionResolveContext) {
        DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element;
        result.addAll(nestedContext.resolveAsFileTrees());
    } else if (element instanceof Buildable) {
        Buildable buildable = (Buildable) element;
        result.add(new FileTreeAdapter(new EmptyFileTree(buildable.getBuildDependencies())));
    } else if (element instanceof TaskDependency) {
        TaskDependency dependency = (TaskDependency) element;
        result.add(new FileTreeAdapter(new EmptyFileTree(dependency)));
    }
}
 
Example 26
public TaskDependency getBuildDependencies() {
    return files.getBuildDependencies();
}
 
Example 27
public TaskDependency getBuildDependencies() {
    return builtBy;
}
 
Example 28
public TaskDependency getBuildDependencies() {
    return buildDependencies;
}
 
Example 29
@Override
public TaskDependency getBuildDependencies() {
    return builtBy;
}
 
Example 30
public TaskDependency getShouldRunAfter() {
    return shouldRunAfter;
}