-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
55 lines (46 loc) · 2.06 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
50
51
52
53
54
55
//-------------------------------------------------------------------------------------------------
// ROOT PROJECT.
//-------------------------------------------------------------------------------------------------
rootProject.with { project ->
// provide assemble and clean tasks.
apply(plugin: "base")
// task to add gradle wrapper files.
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: ${project.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.
sourceDirs.each { it.mkdirs() }
}
}
//-------------------------------------------------------------------------------------------------
// SUB PROJECTS.
//-------------------------------------------------------------------------------------------------
subprojects { project ->
repositories {
if (project.hasProperty("useMavenLocal")) {
mavenLocal()
}
jcenter() // Bintray’s JCenter
mavenCentral() // Sonatype’s Maven Central
}
}