Adam
Adam

Reputation: 10036

Difference between SourceSet and SourceDirectorySet, Gradle

Just like the question title says. I found the following example in the Gradle docs:

apply plugin: 'java'

sourceSets {
   main {
      java {
         exclude 'some/unwanted/package/**'
      }
   }
}

The docs say that main is a SourceSet and java is a SourceDirectorySet. The distinction still isn't that clear to me, though. Is a SourceSet just a container for SourceDirectorySets? What else can a SourceSet contain?

Upvotes: 2

Views: 1465

Answers (1)

Opal
Opal

Reputation: 84844

It seems that the answer can be found in the docs:

A SourceSet represents a logical group of Java source and resources.

while,

A SourceDirectorySet represents a set of source files composed from a set of source directories, along with associated include and exclude patterns.

What it means is that SourceSet is just a logical unit that groups SourceDirectorySets.

Upvotes: 2

Related Questions