-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
40 lines (33 loc) · 1.59 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//-------------------------------------------------------------------------------------------------
// ROOT PROJECT.
//-------------------------------------------------------------------------------------------------
rootProject.with { project ->
// provide assemble and clean tasks.
apply(plugin: "base")
task("wrapper", type: Wrapper) {
gradleVersion = project.ext.gradleVersion
distributionUrl = "https://services.gradle.org/distributions/" +
"gradle-${gradleVersion}-all.zip"
}
// task to print gradle and groovy versions.
task("versions", group: "help").doLast {
println "Java version: ${System.properties["java.version"]}"
println "Gradle version: ${gradle.gradleVersion}"
println "Groovy version: ${GroovySystem.version}"
}
}
//-------------------------------------------------------------------------------------------------
// EACH PROJECT.
//-------------------------------------------------------------------------------------------------
allprojects { project ->
// task to create main and test source directories.
task("initSourceDirs", group: "build setup").doLast {
// ignore source directories for projects without source sets.
if (!project.hasProperty("sourceSets")) { return }
// list all source directories.
def sourceSets = project.sourceSets as SourceSetContainer
def sourceDirs = sourceSets*.allSource.srcDirs.flatten() as List<File>
// create source directories, for those who not exists.
for (sourceDir in sourceDirs) { sourceDir.mkdirs() }
}
}