Examples of FileCollection


Examples of org.gradle.api.file.FileCollection

    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

Examples of org.gradle.api.file.FileCollection

        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

Examples of org.gradle.api.file.FileCollection

            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

Examples of org.gradle.api.file.FileCollection

    public <T extends Dependency> T createDependency(Class<T> type, Object userDependencyDescription)
            throws IllegalDependencyNotation {
        if (userDependencyDescription instanceof DependencyFactory.ClassPathNotation) {
            DependencyFactory.ClassPathNotation classPathNotation
                    = (DependencyFactory.ClassPathNotation) userDependencyDescription;
            FileCollection files = fileResolver.resolveFiles(classPathRegistry.getClassPathFiles(classPathNotation.name()));
            return type.cast(classGenerator.newInstance(DefaultSelfResolvingDependency.class, files));
        }
       
        throw new IllegalDependencyNotation();
    }
View Full Code Here

Examples of org.gradle.api.file.FileCollection

        expectTaskStateCreated();

        TaskArtifactState state = repository.getStateFor(task);
        assertNotNull(state);

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

        context.checking(new Expectations() {{
            one(taskArtifactState).getOutputFiles();
            will(returnValue(outputFiles));
            one(taskArtifactState).update();
View Full Code Here

Examples of org.gradle.api.file.FileCollection

    @Test public void testDeclaresConfigurationArtifactsAsInputFiles() {
        assertThat(upload.getArtifacts(), nullValue());

        upload.setConfiguration(configurationMock);

        final FileCollection files = context.mock(FileCollection.class);
        context.checking(new Expectations(){{
            one(configurationMock).getAllArtifactFiles();
            will(returnValue(files));
        }});
View Full Code Here

Examples of org.gradle.api.file.FileCollection

    private final JUnit4Mockery context = new JUnit4Mockery();
    private final SelfResolvingDependencyFactory factory = new SelfResolvingDependencyFactory(new AsmBackedClassGenerator());

    @Test
    public void createsADependencyFromAFileCollectionNotation() {
        FileCollection collection = context.mock(FileCollection.class);

        Dependency dependency = factory.createDependency(Dependency.class, collection);
        assertThat(dependency, instanceOf(DefaultSelfResolvingDependency.class));
        DefaultSelfResolvingDependency selfResolvingDependency = (DefaultSelfResolvingDependency) dependency;
        assertThat(selfResolvingDependency.getSource(), sameInstance(collection));
View Full Code Here

Examples of org.gradle.api.file.FileCollection

        osgiManifest.setVersion(null);
        osgiManifest.getEffectiveManifest();
    }

    private void setUpOsgiManifest() throws IOException {
        final FileCollection fileCollection = context.mock(FileCollection.class);
        context.checking(new Expectations() {{
            allowing(fileCollection).getFiles();
            will(returnValue(WrapUtil.toSet(new File("someFile"))));
        }});
        osgiManifest.setSymbolicName("symbolic");
View Full Code Here

Examples of org.gradle.api.file.FileCollection

        }});

        configuration.addArtifact(artifact);
        configuration.setExtendsFrom(toSet(otherConfiguration));

        FileCollection files = configuration.getAllArtifactFiles();
        assertThat(files.getFiles(), equalTo(toSet(artifactFile1, artifactFile2)));
        assertThat(files.getBuildDependencies().getDependencies(null), equalTo((Set) toSet(otherConfTaskMock, artifactTaskMock)));
    }
View Full Code Here

Examples of org.gradle.api.file.FileCollection

    @Test
    public void addsDependencyOnInputFiles() {
        final TaskInternal task = context.mock(TaskInternal.class);
        final ProjectInternal project = context.mock(ProjectInternal.class);
        final TaskInputs taskInputs = context.mock(TaskInputs.class);
        final FileCollection inputFiles = context.mock(FileCollection.class);

        context.checking(new Expectations() {{
            one(delegate).createTask(project, map());
            will(returnValue(task));
            allowing(task).getInputs();
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.