use of org.gradle.api.tasks.util.PatternFilterable in project gradle by gradle.
the class CompositeFileTreeTest method matchingWithActionReturnsUnionOfFilteredSets.
@Test
public void matchingWithActionReturnsUnionOfFilteredSets() {
final Action<PatternFilterable> action = Actions.doNothing();
final FileTreeInternal filtered1 = context.mock(FileTreeInternal.class);
final FileTreeInternal filtered2 = context.mock(FileTreeInternal.class);
context.checking(new Expectations() {
{
oneOf(source1).matching(action);
will(returnValue(filtered1));
oneOf(source2).matching(action);
will(returnValue(filtered2));
}
});
FileTree filtered = tree.matching(action);
assertThat(filtered, instanceOf(CompositeFileTree.class));
CompositeFileTree filteredCompositeSet = (CompositeFileTree) filtered;
assertThat(toList(filteredCompositeSet.getSourceCollections()), equalTo(toList(filtered1, filtered2)));
}
use of org.gradle.api.tasks.util.PatternFilterable in project gradle by gradle.
the class FilteredFileTree method visitChildren.
@Override
protected void visitChildren(Consumer<FileCollectionInternal> visitor) {
// For backwards compatibility, need to calculate the patterns on each query
PatternFilterable patterns = getPatterns();
tree.visitContentsAsFileTrees(child -> visitor.accept(child.matching(patterns)));
}
use of org.gradle.api.tasks.util.PatternFilterable in project gradle by gradle.
the class DefaultScalaJavaJointCompiler method execute.
public WorkResult execute(ScalaJavaJointCompileSpec spec) {
scalaCompiler.execute(spec);
PatternFilterable patternSet = new PatternSet();
patternSet.include("**/*.java");
FileTree javaSource = spec.getSource().getAsFileTree().matching(patternSet);
if (!javaSource.isEmpty()) {
spec.setSource(javaSource);
javaCompiler.execute(spec);
}
return new WorkResult() {
public boolean getDidWork() {
return true;
}
};
}
Aggregations