Examples of FileTree


Examples of org.gradle.api.file.FileTree

        final File dir1 = new File("dir1");
        final File dir2 = new File("dir1");
        final File dir3 = new File("dir1");
        final MinimalFileSet source3 = context.mock(MinimalFileSet.class);

        FileTree fileTree = collection.getAsFileTree();
        assertThat(fileTree, instanceOf(CompositeFileTree.class));

        context.checking(new Expectations() {{
            one(source1).getFiles();
            will(returnValue(toSet(dir1)));
View Full Code Here

Examples of org.gradle.api.file.FileTree

    };

    @Test
    public void matchingWithClosureReturnsUnionOfFilteredSets() {
        final Closure closure = TestUtil.TEST_CLOSURE;
        final FileTree filtered1 = context.mock(FileTree.class);
        final FileTree filtered2 = context.mock(FileTree.class);

        context.checking(new Expectations() {{
            one(source1).matching(closure);
            will(returnValue(filtered1));
            one(source2).matching(closure);
            will(returnValue(filtered2));
        }});

        FileTree filtered = tree.matching(closure);
        assertThat(filtered, instanceOf(CompositeFileTree.class));
        CompositeFileTree filteredCompositeSet = (CompositeFileTree) filtered;

        assertThat(toList(filteredCompositeSet.getSourceCollections()), equalTo(toList((FileTree)filtered1, filtered2)));
    }
View Full Code Here

Examples of org.gradle.api.file.FileTree

    }

    @Test
    public void matchingWithPatternSetReturnsUnionOfFilteredSets() {
        final PatternSet patternSet = new PatternSet();
        final FileTree filtered1 = context.mock(FileTree.class);
        final FileTree filtered2 = context.mock(FileTree.class);

        context.checking(new Expectations() {{
            one(source1).matching(patternSet);
            will(returnValue(filtered1));
            one(source2).matching(patternSet);
            will(returnValue(filtered2));
        }});

        FileTree filtered = tree.matching(patternSet);
        assertThat(filtered, instanceOf(CompositeFileTree.class));
        CompositeFileTree filteredCompositeSet = (CompositeFileTree) filtered;

        assertThat(toList(filteredCompositeSet.getSourceCollections()), equalTo(toList((FileTree) filtered1, filtered2)));
    }
View Full Code Here

Examples of org.gradle.api.file.FileTree

        assertThat(toList(filteredCompositeSet.getSourceCollections()), equalTo(toList((FileTree) filtered1, filtered2)));
    }

    @Test
    public void plusReturnsUnionOfThisTreeAndSourceTree() {
        FileTree other = context.mock(FileTree.class);

        FileTree sum = tree.plus(other);
        assertThat(sum, instanceOf(CompositeFileTree.class));
        UnionFileTree sumCompositeTree = (UnionFileTree) sum;
        assertThat(sumCompositeTree.getSourceCollections(), equalTo((Iterable) toList(source1, source2, other)));
    }
View Full Code Here

Examples of org.gradle.api.file.FileTree

    public void toFileTreeReturnsSingletonTreeForEachFileInCollection() {
        File file = testDir.createFile("f1");
        File file2 = testDir.createFile("f2");

        TestFileCollection collection = new TestFileCollection(file, file2);
        FileTree tree = collection.getAsFileTree();
        FileVisitorUtil.assertVisits(tree, GUtil.map("f1", file, "f2", file2));
    }
View Full Code Here

Examples of org.gradle.api.file.FileTree

        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);
View Full Code Here

Examples of org.gradle.api.file.FileTree

    private final JUnit4Mockery context = new JUnit4Mockery();
    private final UnionFileTree set = new UnionFileTree("<display name>");

    @Test
    public void canAddFileTree() {
        FileTree set1 = context.mock(FileTree.class, "set1");

        set.add(set1);
        assertThat(set.getSourceCollections(), equalTo((Iterable) toList((Object) set1)));
    }
View Full Code Here

Examples of org.gradle.api.file.FileTree

    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() {
View Full Code Here

Examples of org.gradle.api.file.FileTree

     * @return The source.
     */
    @InputFiles
    @SkipWhenEmpty
    public FileTree getSource() {
        FileTree src = getProject().files(new ArrayList<Object>(this.source)).getAsFileTree();
        return src == null ? getProject().files().getAsFileTree() : src.matching(patternSet);
    }
View Full Code Here

Examples of org.gradle.api.file.FileTree

        PreprocessingTool rcCompiler = (PreprocessingTool) ((ExtensionAware) binary).getExtensions().getByName("rcCompiler");
        task.setMacros(rcCompiler.getMacros());
        task.setCompilerArgs(rcCompiler.getArgs());

        FileTree resourceOutputs = task.getOutputs().getFiles().getAsFileTree().matching(new PatternSet().include("**/*.res"));
        binary.getTasks().getCreateOrLink().source(resourceOutputs);
        if (binary instanceof StaticLibraryBinarySpecInternal) {
            ((StaticLibraryBinarySpecInternal) binary).additionalLinkFiles(resourceOutputs);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.