Package org.gradle.api.file

Examples of org.gradle.api.file.FileCollection


        assertThat(collection.getBuildDependencies().getDependencies(null), equalTo((Set) toSet(task)));
    }

    @Test
    public void taskDependenciesContainsUnionOfDependenciesOfNestedFileCollectionsPlusOwnDependencies() {
        final FileCollection fileCollectionMock = context.mock(FileCollection.class);

        collection.from(fileCollectionMock);
        collection.from("f");
        collection.builtBy('b');
View Full Code Here


                                SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                    }
                });
                task.classpath(new Object[] {new Callable() {
                    public Object call() throws Exception {
                        FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
                                .getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                        Configuration providedRuntime = project.getConfigurations().getByName(
                                PROVIDED_RUNTIME_CONFIGURATION_NAME);
                        return runtimeClasspath.minus(providedRuntime);
                    }
                }});
            }
        });
       
View Full Code Here

        assertThat(task.getInputs().getFiles().getFiles(), isEmpty());
    }

    @Test
    public void skipsTaskWhenInputFileCollectionIsEmpty() {
        final FileCollection inputFiles = context.mock(FileCollection.class);
        context.checking(new Expectations() {{
            one(inputFiles).stopExecutionIfEmpty();
            will(throwException(new StopExecutionException()));
        }});
View Full Code Here

    }

    private class DependencyGraph implements DirectedGraph<Object, FileCollection> {
        public void getNodeValues(Object node, Collection<FileCollection> values, Collection<Object> connectedNodes) {
            if (node instanceof FileCollection) {
                FileCollection fileCollection = (FileCollection) node;
                values.add(fileCollection);
            }
            else if (node instanceof DependencyInternal) {
                DependencyInternal dependencyInternal = (DependencyInternal) node;
                queue.clear();
View Full Code Here

        File file2 = new File("f2");
        File file3 = new File("f3");

        TestFileCollection collection1 = new TestFileCollection(file1, file2);
        TestFileCollection collection2 = new TestFileCollection(file2, file3);
        FileCollection sum = collection1.plus(collection2);
        assertThat(sum, instanceOf(UnionFileCollection.class));
        assertThat(sum.getFiles(), equalTo(toLinkedSet(file1, file2, file3)));
    }
View Full Code Here

        File file2 = new File("f2");
        File file3 = new File("f3");

        TestFileCollection collection1 = new TestFileCollection(file1, file2);
        TestFileCollection collection2 = new TestFileCollection(file2, file3);
        FileCollection sum = collection1.minus(collection2);
        assertThat(sum.getFiles(), equalTo(toLinkedSet(file1)));
    }
View Full Code Here

    public void canFilterContentsOfCollectionUsingSpec() {
        File file1 = new File("f1");
        File file2 = new File("f2");

        TestFileCollection collection = new TestFileCollection(file1, file2);
        FileCollection filtered = collection.filter(new Spec<File>() {
            public boolean isSatisfiedBy(File element) {
                return element.getName().equals("f1");
            }
        });
        assertThat(filtered.getFiles(), equalTo(toSet(file1)));
    }
View Full Code Here

    public void canFilterContentsOfCollectionUsingClosure() {
        File file1 = new File("f1");
        File file2 = new File("f2");

        TestFileCollection collection = new TestFileCollection(file1, file2);
        FileCollection filtered = collection.filter(HelperUtil.toClosure("{f -> f.name == 'f1'}"));
        assertThat(filtered.getFiles(), equalTo(toSet(file1)));
    }
View Full Code Here

        File file1 = new File("f1");
        File file2 = new File("f2");
        File file3 = new File("dir/f1");

        TestFileCollection collection = new TestFileCollection(file1, file2);
        FileCollection filtered = collection.filter(HelperUtil.toClosure("{f -> f.name == 'f1'}"));
        assertThat(filtered.getFiles(), equalTo(toSet(file1)));

        collection.files.add(file3);
        assertThat(filtered.getFiles(), equalTo(toSet(file1, file3)));
    }
View Full Code Here

            throws IllegalDependencyNotation {
        if (!(userDependencyDescription instanceof FileCollection)) {
            throw new IllegalDependencyNotation();
        }

        FileCollection fileCollection = (FileCollection) userDependencyDescription;
        return type.cast(classGenerator.newInstance(DefaultSelfResolvingDependency.class, fileCollection));
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.file.FileCollection

Copyright © 2018 www.massapicom. 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.