This repository has been archived by the owner on May 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbuild.gradle
41 lines (36 loc) · 1.45 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
// This is a utility build.gradle that allows to run certain tasks on every
// example project and quickly update libs versions. This is NOT the Gradle root
// of all test projects: they are autonomous.
// Copies (overrides) gradle.properties file to all project directories.
task updateVersion << {
file(".").listFiles().findAll { it.isDirectory() && it.name != '.gradle'}
.each { directory -> copy {
from "gradle.properties"
into directory
}
}
}
// Invokes `cleanEclipse` and `eclipse` Gradle tasks in every project directory.
task eclipseAll << {
file(".").listFiles().findAll { it.isDirectory() && it.name != '.gradle' }
.each { runProcess(it, "gradle", "cleanEclipse", "eclipse") }
}
// Invokes `desktop:run` Gradle task in every project directory. Note that some
// projects require server application and will fail to run.
task runAll << {
file(".").listFiles().findAll { it.isDirectory() && it.name != '.gradle' }
.each { runProcess(it, "gradle", "desktop:run") }
}
// Cleans all projects.
task cleanAll << {
file(".").listFiles().findAll { it.isDirectory() && it.name != '.gradle' }
.each { runProcess(it, "gradle", "clean") }
}
// Utility method. Runs a selected system command in the chosen directory.
def runProcess(dir, String... commands) {
println "Running `${commands.join(' ')}` in ${dir.name}:"
def builder = new ProcessBuilder(commands)
builder.inheritIO()
builder.directory(dir)
builder.start().waitFor()
}