ExtensionAware
public interface SourceSet extends ExtensionAware
SourceSet
represents a logical group of Java source and resource files. They
are covered in more detail in the
user manual.
The following example shows how you can configure the 'main' source set, which in this
case involves excluding classes whose package begins 'some.unwatned.package' from
compilation of the source files in the 'java' SourceDirectorySet
:
apply plugin: 'java' sourceSets { main { java { exclude 'some/unwanted/package/**' } } }
Modifier and Type | Field | Description |
---|---|---|
static String |
MAIN_SOURCE_SET_NAME |
The name of the main source set.
|
static String |
TEST_SOURCE_SET_NAME |
The name of the test source set.
|
Modifier and Type | Method | Description |
---|---|---|
SourceSet |
compiledBy(Object... taskPaths) |
Registers a set of tasks which are responsible for compiling this source set into the classes directory.
|
SourceDirectorySet |
getAllJava() |
All Java source files for this source set.
|
SourceDirectorySet |
getAllSource() |
All source files for this source set.
|
String |
getAnnotationProcessorConfigurationName() |
Returns the name of the configuration containing annotation processors and their
dependencies needed to compile this source set.
|
FileCollection |
getAnnotationProcessorPath() |
Returns the classpath used to load annotation processors when compiling this source set.
|
String |
getApiConfigurationName() |
Returns the name of the API configuration for this source set.
|
String |
getApiElementsConfigurationName() |
Returns the name of the configuration that should be used when compiling against the API
of this component.
|
String |
getClassesTaskName() |
Returns the name of the classes task for this source set.
|
FileCollection |
getCompileClasspath() |
Returns the classpath used to compile this source.
|
String |
getCompileClasspathConfigurationName() |
Returns the name of the compile classpath configuration for this source set.
|
String |
getCompileConfigurationName() |
Returns the name of the compile configuration for this source set.
|
String |
getCompileJavaTaskName() |
Returns the name of the compile Java task for this source set.
|
String |
getCompileOnlyConfigurationName() |
Returns the name of the compile only configuration for this source set.
|
String |
getCompileTaskName(String language) |
Returns the name of a compile task for this source set.
|
String |
getImplementationConfigurationName() |
Returns the name of the implementation configuration for this source set.
|
String |
getJarTaskName() |
Returns the name of the Jar task for this source set.
|
SourceDirectorySet |
getJava() |
Returns the Java source which is to be compiled by the Java compiler into the class output directory.
|
String |
getName() |
Returns the name of this source set.
|
SourceSetOutput |
getOutput() |
SourceSetOutput is a FileCollection of all output directories (compiled classes, processed resources, etc.)
and it provides means to configure the default output dirs and register additional output dirs. |
String |
getProcessResourcesTaskName() |
Returns the name of the resource process task for this source set.
|
SourceDirectorySet |
getResources() |
Returns the non-Java resources which are to be copied into the resources output directory.
|
FileCollection |
getRuntimeClasspath() |
Returns the classpath used to execute this source.
|
String |
getRuntimeClasspathConfigurationName() |
Returns the name of the runtime classpath configuration of this component: the runtime
classpath contains elements of the implementation, as well as runtime only elements.
|
String |
getRuntimeConfigurationName() |
Returns the name of the runtime configuration for this source set.
|
String |
getRuntimeElementsConfigurationName() |
Returns the name of the configuration containing elements that are strictly required
at runtime.
|
String |
getRuntimeOnlyConfigurationName() |
Returns the name of the configuration that contains dependencies that are only required
at runtime of the component.
|
String |
getTaskName(String verb,
String target) |
Returns the name of a task for this source set.
|
SourceSet |
java(Closure configureClosure) |
Configures the Java source for this set.
|
SourceSet |
java(Action<? super SourceDirectorySet> configureAction) |
Configures the Java source for this set.
|
SourceSet |
resources(Closure configureClosure) |
Configures the non-Java resources for this set.
|
SourceSet |
resources(Action<? super SourceDirectorySet> configureAction) |
Configures the non-Java resources for this set.
|
void |
setAnnotationProcessorPath(FileCollection annotationProcessorPath) |
Set the classpath to use to load annotation processors when compiling this source set.
|
void |
setCompileClasspath(FileCollection classpath) |
Sets the classpath used to compile this source.
|
void |
setRuntimeClasspath(FileCollection classpath) |
Sets the classpath used to execute this source.
|
getExtensions
static final String MAIN_SOURCE_SET_NAME
static final String TEST_SOURCE_SET_NAME
String getName()
FileCollection getCompileClasspath()
void setCompileClasspath(FileCollection classpath)
classpath
- The classpath. Should not be null.@Incubating FileCollection getAnnotationProcessorPath()
-proc:none
as a compiler argument.@Incubating void setAnnotationProcessorPath(FileCollection annotationProcessorPath)
-proc:none
as a compiler argument.annotationProcessorPath
- The annotation processor path. Should not be null.FileCollection getRuntimeClasspath()
void setRuntimeClasspath(FileCollection classpath)
classpath
- The classpath. Should not be null.SourceSetOutput getOutput()
SourceSetOutput
is a FileCollection
of all output directories (compiled classes, processed resources, etc.)
and it provides means to configure the default output dirs and register additional output dirs. See examples in SourceSetOutput
SourceSetOutput
.SourceSet compiledBy(Object... taskPaths)
Task.dependsOn(Object...)
.taskPaths
- The tasks which compile this source set.SourceDirectorySet getResources()
SourceSet resources(@Nullable Closure configureClosure)
The given closure is used to configure the SourceDirectorySet
which contains the resources.
configureClosure
- The closure to use to configure the resources.SourceSet resources(Action<? super SourceDirectorySet> configureAction)
The given action is used to configure the SourceDirectorySet
which contains the resources.
configureAction
- The action to use to configure the resources.SourceDirectorySet getJava()
SourceSet java(@Nullable Closure configureClosure)
The given closure is used to configure the SourceDirectorySet
which contains the Java source.
configureClosure
- The closure to use to configure the Java source.SourceSet java(Action<? super SourceDirectorySet> configureAction)
The given action is used to configure the SourceDirectorySet
which contains the Java source.
configureAction
- The action to use to configure the Java source.SourceDirectorySet getAllJava()
SourceDirectorySet getAllSource()
String getClassesTaskName()
String getProcessResourcesTaskName()
String getCompileJavaTaskName()
String getCompileTaskName(String language)
language
- The language to be compiled.String getJarTaskName()
String getTaskName(@Nullable String verb, @Nullable String target)
verb
- The action, may be null.target
- The target, may be nullString getCompileConfigurationName()
String getRuntimeConfigurationName()
String getCompileOnlyConfigurationName()
String getCompileClasspathConfigurationName()
@Incubating String getAnnotationProcessorConfigurationName()
String getApiConfigurationName()
String getImplementationConfigurationName()
String getApiElementsConfigurationName()
String getRuntimeOnlyConfigurationName()
String getRuntimeClasspathConfigurationName()
String getRuntimeElementsConfigurationName()