Package org.gradle.api.tasks.util

Examples of org.gradle.api.tasks.util.PatternSet


    public String getDisplayName() {
        return String.format("file set '%s'", dir);
    }

    public FileTree matching(PatternFilterable patterns) {
        PatternSet patternSet = this.patternSet.intersect();
        patternSet.copyFrom(patterns);
        DefaultConfigurableFileTree filtered = new DefaultConfigurableFileTree(getDir(), resolver, taskResolver);
        filtered.setPatternSet(patternSet);
        return filtered;
    }
View Full Code Here


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

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

        context.checking(new Expectations() {{
            one(source1).matching(patternSet);
View Full Code Here

     * @return The candidate class files.
     */
    @InputFiles
    @Input // Also marked as input to force tests to run when the set of candidate class files changes
    public FileTree getCandidateClassFiles() {
        PatternSet patterns = new PatternSet();
        patterns.copyFrom(patternSet);
        if (!isScanForTestClasses()) {
            if (patterns.getIncludes().isEmpty()) {
                patterns.include("**/*Tests.class", "**/*Test.class");
            }
            if (patterns.getExcludes().isEmpty()) {
                patterns.exclude("**/Abstract*.class");
            }
        }
        return getProject().fileTree(getTestClassesDir()).matching(patterns);
    }
View Full Code Here

    }

    public WorkResult execute() {
        scalaCompiler.execute();

        PatternFilterable patternSet = new PatternSet();
        patternSet.include("**/*.java");
        FileTree javaSource = source.getAsFileTree().matching(patternSet);
        if (!javaSource.isEmpty()) {
            javaCompiler.setSource(javaSource);
            javaCompiler.execute();
        }
View Full Code Here

        walker.start(root.getMock());
    }

    @Test public void testUsesSpecFromPatternSetToMatchFilesAndDirs() {
        final PatternSet patternSet = context.mock(PatternSet.class);
        final Spec spec = context.mock(Spec.class);

        context.checking(new Expectations(){{
            one(patternSet).getAsSpec();
            will(returnValue(spec));
View Full Code Here

        });
        return !found.get();
    }

    public FileTree matching(Closure filterConfigClosure) {
        PatternSet patternSet = new PatternSet();
        ConfigureUtil.configure(filterConfigClosure, patternSet);
        return matching(patternSet);
    }
View Full Code Here

        ConfigureUtil.configure(filterConfigClosure, patternSet);
        return matching(patternSet);
    }

    public FileTree matching(PatternFilterable patterns) {
        PatternSet patternSet = new PatternSet();
        patternSet.copyFrom(patterns);
        return new FilteredFileTree(this, patternSet.getAsSpec());
    }
View Full Code Here

    private CopySpecImpl(FileResolver resolver, CopySpecImpl parentSpec) {
        this.parentSpec = parentSpec;
        this.resolver = resolver;
        sourcePaths = new LinkedHashSet<Object>();
        childSpecs = new ArrayList<ReadableCopySpec>();
        patternSet = new PatternSet();
    }
View Full Code Here

        return RelativePath.parse(false, parentPath, path);
    }

    public PatternSet getPatternSet() {
        PatternSet patterns = new PatternSet();
        patterns.setCaseSensitive(isCaseSensitive());
        patterns.include(getAllIncludes());
        patterns.includeSpecs(getAllIncludeSpecs());
        patterns.exclude(getAllExcludes());
        patterns.excludeSpecs(getAllExcludeSpecs());
        return patterns;
    }
View Full Code Here

    {
        getLogger().info("INPUTS >> " + source);
        getLogger().info("OUTPUTS >> " + getOutput());

        // get the include/exclude patterns from the source (this is different than what's returned by getFilter)
        PatternSet patterns = new PatternSet();
        patterns.setIncludes(source.getIncludes());
        patterns.setExcludes(source.getExcludes());

        // get output
        File out = getOutput();
        if (out.exists())
            deleteDir(out);
View Full Code Here

TOP

Related Classes of org.gradle.api.tasks.util.PatternSet

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.