Package org.gradle.api.file

Examples of org.gradle.api.file.FileCollection


                }
            } else if (value instanceof Closure) {
                Closure closure = (Closure) value;
                value = closure.call();
            } else if (value instanceof FileCollection) {
                FileCollection fileCollection = (FileCollection) value;
                return fileCollection.getFiles();
            } else {
                return value;
            }
        }
    }
View Full Code Here


    @Override
    protected void addSourceCollections(Collection<FileCollection> sources) {
        for (Object element : resolveToFilesAndFileCollections()) {
            if (element instanceof FileCollection) {
                FileCollection collection = (FileCollection) element;
                sources.add(collection);
            } else {
                File file = (File) element;
                sources.add(new SingletonFileCollection(file, buildDependency));
            }
View Full Code Here

            }
        }
        if (maxHeapSize != null) {
            args.add(String.format("-Xmx%s", maxHeapSize));
        }
        FileCollection bootstrapClasspath = getBootstrapClasspath();
        if (!bootstrapClasspath.isEmpty()) {
            args.add(String.format("-Xbootclasspath:%s", bootstrapClasspath.getAsPath()));
        }
        if (assertionsEnabled) {
            args.add("-ea");
        }
        if (debug) {
View Full Code Here

    @Test
    public void fileTreeIsLive() {
        final FileTree tree1 = context.mock(FileTree.class, "tree1");
        final FileTree tree2 = context.mock(FileTree.class, "tree2");
        final FileCollection source3 = context.mock(FileCollection.class);
        final FileTree tree3 = context.mock(FileTree.class);

        context.checking(new Expectations() {{
            one(source1).getAsFileTree();
            will(returnValue(tree1));
View Full Code Here

        assertThat(((CompositeFileTree) fileTree).getSourceCollections(), equalTo((Iterable) toList(tree1, tree2, tree3)));
    }

    @Test
    public void filterDelegatesToEachSet() {
        final FileCollection filtered1 = context.mock(FileCollection.class, "filtered1");
        final FileCollection filtered2 = context.mock(FileCollection.class, "filtered2");
        final Spec spec = context.mock(Spec.class);

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

        FileCollection filtered = collection.filter(spec);
        assertThat(filtered, instanceOf(CompositeFileCollection.class));
        assertThat(((CompositeFileCollection) filtered).getSourceCollections(), equalTo((Iterable) toList(filtered1, filtered2)));
    }
View Full Code Here

    public void dependsOnLiveUnionOfAllDependencies() {
        final Task target = context.mock(Task.class, "target");
        final Task task1 = context.mock(Task.class, "task1");
        final Task task2 = context.mock(Task.class, "task2");
        final Task task3 = context.mock(Task.class, "task3");
        final FileCollection source3 = context.mock(FileCollection.class, "source3");

        context.checking(new Expectations(){{
            TaskDependency dependency1 = context.mock(TaskDependency.class, "dep1");
            TaskDependency dependency2 = context.mock(TaskDependency.class, "dep2");
            TaskDependency dependency3 = context.mock(TaskDependency.class, "dep3");
View Full Code Here

    }

    void setUpMocksAndAttributes(GroovyCompile compile, final List groovyClasspath) {
        super.setUpMocksAndAttributes(compile);

        final FileCollection groovyClasspathCollection = context.mock(FileCollection.class);
        context.checking(new Expectations(){{
            allowing(groovyClasspathCollection).getFiles();
            will(returnValue(new LinkedHashSet<File>(groovyClasspath)));
        }});
View Full Code Here

        compile.setSourceCompatibility("1.5");
        compile.setTargetCompatibility("1.5");
        compile.setDestinationDir(destDir);
        compile.setScalaClasspath(context.mock(FileCollection.class));

        final FileCollection configuration = context.mock(FileCollection.class);
        context.checking(new Expectations(){{
            allowing(configuration).iterator();
            will(returnIterator(TEST_DEPENDENCY_MANAGER_CLASSPATH));
        }});
View Full Code Here

    @Test
    public void canUseAFileCollectionToSpecifyTheContentsOfTheCollection() {
        final File file1 = new File("1");
        final File file2 = new File("2");

        final FileCollection src = context.mock(FileCollection.class);

        collection.from(src);

        context.checking(new Expectations() {{
            one(src).getFiles();
View Full Code Here

        assertThat(collection.getSourceCollections().get(0), instanceOf(SingletonFileCollection.class));
    }

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

        collection.from(fileCollectionMock);
        assertThat((Iterable<FileCollection>) collection.getSourceCollections(), hasItem(fileCollectionMock));
    }
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.