-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
49 lines (40 loc) · 1.74 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
41
42
43
44
45
46
47
48
49
//-------------------------------------------------------------------------------------------------
// ROOT PROJECT.
//-------------------------------------------------------------------------------------------------
// provide assemble and clean tasks.
apply plugin: "base"
// task to add gradle wrapper files.
task("wrapper", type: Wrapper) {
gradleVersion = project.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 ->
// provide java configurations and tasks.
apply plugin: "java"
// 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.
sourceDirs.each { it.mkdirs() }
}
// maven repositories for dependencies.
repositories {
if (project.hasProperty("useMavenLocal")) {
mavenLocal()
}
}
}