Class SourceTask

    • Constructor Detail

      • SourceTask

        public SourceTask()
    • Method Detail

      • getPatternSetFactory

        @Inject
        protected org.gradle.internal.Factory<PatternSet> getPatternSetFactory()
      • setSource

        public void setSource​(FileTree source)
        Sets the source for this task.
        Parameters:
        source - The source.
        Since:
        4.0
      • setSource

        public void setSource​(java.lang.Object source)
        Sets the source for this task. The given source object is evaluated as per Project.files(Object...).
        Parameters:
        source - The source.
      • source

        public SourceTask source​(java.lang.Object... sources)
        Adds some source to this task. The given source objects will be evaluated as per Project.files(Object...).
        Parameters:
        sources - The source to add
        Returns:
        this
      • include

        public SourceTask include​(java.lang.String... includes)
        Adds an ANT style include pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns to be processed.
        Specified by:
        include in interface PatternFilterable
        Parameters:
        includes - a vararg list of include patterns
        Returns:
        this
        See Also:
        Pattern Format
      • include

        public SourceTask include​(java.lang.Iterable<java.lang.String> includes)
        Adds an ANT style include pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns to be processed.
        Specified by:
        include in interface PatternFilterable
        Parameters:
        includes - a Iterable providing more include patterns
        Returns:
        this
        See Also:
        Pattern Format
      • include

        public SourceTask include​(Spec<FileTreeElement> includeSpec)
        Adds an include spec. This method may be called multiple times to append new specs. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns or specs to be included.
        Specified by:
        include in interface PatternFilterable
        Parameters:
        includeSpec - the spec to add
        Returns:
        this
        See Also:
        Pattern Format
      • include

        public SourceTask include​(Closure includeSpec)
        Adds an include spec. This method may be called multiple times to append new specs. The given closure is passed a FileTreeElement as its parameter. If includes are not provided, then all files in this container will be included. If includes are provided, then a file must match at least one of the include patterns or specs to be included.
        Specified by:
        include in interface PatternFilterable
        Parameters:
        includeSpec - the spec to add
        Returns:
        this
        See Also:
        Pattern Format
      • exclude

        public SourceTask exclude​(java.lang.String... excludes)
        Adds an ANT style exclude pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
        Specified by:
        exclude in interface PatternFilterable
        Parameters:
        excludes - a vararg list of exclude patterns
        Returns:
        this
        See Also:
        Pattern Format
      • exclude

        public SourceTask exclude​(java.lang.Iterable<java.lang.String> excludes)
        Adds an ANT style exclude pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
        Specified by:
        exclude in interface PatternFilterable
        Parameters:
        excludes - a Iterable providing new exclude patterns
        Returns:
        this
        See Also:
        Pattern Format
      • exclude

        public SourceTask exclude​(Spec<FileTreeElement> excludeSpec)
        Adds an exclude spec. This method may be called multiple times to append new specs. If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
        Specified by:
        exclude in interface PatternFilterable
        Parameters:
        excludeSpec - the spec to add
        Returns:
        this
        See Also:
        Pattern Format
      • exclude

        public SourceTask exclude​(Closure excludeSpec)
        Adds an exclude spec. This method may be called multiple times to append new specs.The given closure is passed a FileTreeElement as its parameter. The closure should return true or false. Example:
         copySpec {
           from 'source'
           into 'destination'
           //an example of excluding files from certain configuration:
           exclude { it.file in configurations.someConf.files }
         }
         
        If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match any exclude pattern to be processed.
        Specified by:
        exclude in interface PatternFilterable
        Parameters:
        excludeSpec - the spec to add
        Returns:
        this
        See Also:
        FileTreeElement
      • getIncludes

        @Internal
        public java.util.Set<java.lang.String> getIncludes()
        Returns the set of include patterns.
        Specified by:
        getIncludes in interface PatternFilterable
        Returns:
        The include patterns. Returns an empty set when there are no include patterns.
      • getExcludes

        @Internal
        public java.util.Set<java.lang.String> getExcludes()
        Returns the set of exclude patterns.
        Specified by:
        getExcludes in interface PatternFilterable
        Returns:
        The exclude patterns. Returns an empty set when there are no exclude patterns.