forked from mikemccand/luceneutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
33 lines (31 loc) · 1.26 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
def hasDefaults = rootProject.file("gradle.properties").exists()
configure(rootProject) {
task localSettings() {
doFirst {
// If we don't have the defaults yet, create them.
if (hasDefaults) {
logger.lifecycle("Local settings already exist, skipping generation.")
} else {
def parentDir = rootProject.projectDir.toPath()
.resolve("../lucene_candidate").toAbsolutePath().toString()
rootProject.file("gradle.properties").write("""
# These settings have been generated automatically on the first run.
external.lucene.repo=$parentDir
""", "UTF-8")
logger.log(LogLevel.WARN, "\nIMPORTANT. This is the first time you ran the build. " +
"I wrote some sane defaults (for this machine) to 'gradle.properties', " +
"they will be picked up on consecutive gradle invocations (not this one).\n\n")
}
}
}
}
if (hasDefaults == false) {
// Make all tasks depend on local setup to make sure it'll run.
allprojects {
tasks.all { task ->
if (task != rootProject.localSettings) {
task.dependsOn rootProject.localSettings
}
}
}
}