Klasse SourceTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.SourceTask
Alle implementierten Schnittstellen:
Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, Named, ExtensionAware, Task, PatternFilterable, Configurable<Task>
Bekannte direkte Unterklassen:
AbstractCodeQualityTask, AbstractCompile, AntlrTask, Groovydoc, Javadoc, ScalaDoc

@NonNullApi @DisableCachingByDefault(because="Super-class, not to be instantiated directly") public abstract class SourceTask extends org.gradle.api.internal.ConventionTask implements PatternFilterable
A SourceTask performs some operation on source files.
  • Konstruktordetails

    • SourceTask

      public SourceTask()
  • Methodendetails

    • getPatternSetFactory

      @Inject protected org.gradle.api.tasks.util.internal.PatternSetFactory getPatternSetFactory()
    • getPatternSet

      @Internal protected PatternFilterable getPatternSet()
    • getSource

      Returns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.

      The PathSensitivity for the sources is configured to be PathSensitivity.ABSOLUTE. If your sources are less strict, please change it accordingly by overriding this method in your subclass.

      Gibt zurück:
      The source.
    • setSource

      public void setSource(FileTree source)
      Sets the source for this task.
      Parameter:
      source - The source.
      Seit:
      4.0
    • setSource

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

      public SourceTask source(Object... sources)
      Adds some source to this task. The given source objects will be evaluated as per Project.files(Object...).
      Parameter:
      sources - The source to add
      Gibt zurück:
      this
    • include

      public SourceTask include(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.
      Angegeben von:
      include in Schnittstelle PatternFilterable
      Parameter:
      includes - a vararg list of include patterns
      Gibt zurück:
      this
      Siehe auch:
    • include

      public SourceTask include(Iterable<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.
      Angegeben von:
      include in Schnittstelle PatternFilterable
      Parameter:
      includes - a Iterable providing more include patterns
      Gibt zurück:
      this
      Siehe auch:
    • 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.
      Angegeben von:
      include in Schnittstelle PatternFilterable
      Parameter:
      includeSpec - the spec to add
      Gibt zurück:
      this
      Siehe auch:
    • 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.
      Angegeben von:
      include in Schnittstelle PatternFilterable
      Parameter:
      includeSpec - the spec to add
      Gibt zurück:
      this
      Siehe auch:
    • exclude

      public SourceTask exclude(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.
      Angegeben von:
      exclude in Schnittstelle PatternFilterable
      Parameter:
      excludes - a vararg list of exclude patterns
      Gibt zurück:
      this
      Siehe auch:
    • exclude

      public SourceTask exclude(Iterable<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.
      Angegeben von:
      exclude in Schnittstelle PatternFilterable
      Parameter:
      excludes - a Iterable providing new exclude patterns
      Gibt zurück:
      this
      Siehe auch:
    • 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.
      Angegeben von:
      exclude in Schnittstelle PatternFilterable
      Parameter:
      excludeSpec - the spec to add
      Gibt zurück:
      this
      Siehe auch:
    • 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.
      Angegeben von:
      exclude in Schnittstelle PatternFilterable
      Parameter:
      excludeSpec - the spec to add
      Gibt zurück:
      this
      Siehe auch:
    • getIncludes

      @Internal public Set<String> getIncludes()
      Returns the set of include patterns.
      Angegeben von:
      getIncludes in Schnittstelle PatternFilterable
      Gibt zurück:
      The include patterns. Returns an empty set when there are no include patterns.
    • setIncludes

      public SourceTask setIncludes(Iterable<String> includes)
      Set the allowable include patterns. Note that unlike PatternFilterable.include(Iterable) this replaces any previously defined includes.
      Angegeben von:
      setIncludes in Schnittstelle PatternFilterable
      Parameter:
      includes - an Iterable providing new include patterns
      Gibt zurück:
      this
      Siehe auch:
    • getExcludes

      @Internal public Set<String> getExcludes()
      Returns the set of exclude patterns.
      Angegeben von:
      getExcludes in Schnittstelle PatternFilterable
      Gibt zurück:
      The exclude patterns. Returns an empty set when there are no exclude patterns.
    • setExcludes

      public SourceTask setExcludes(Iterable<String> excludes)
      Set the allowable exclude patterns. Note that unlike PatternFilterable.exclude(Iterable) this replaces any previously defined excludes.
      Angegeben von:
      setExcludes in Schnittstelle PatternFilterable
      Parameter:
      excludes - an Iterable providing new exclude patterns
      Gibt zurück:
      this
      Siehe auch: