forked from NASA-AMMOS/aerie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
84 lines (71 loc) · 2.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
plugins {
id 'com.github.ben-manes.versions' version '0.47.0'
}
task archiveDeployment(type: Tar) {
destinationDirectory = file('.')
archiveFileName = 'deployment.tar'
into 'deployment'
from 'deployment'
}
// Set publishing version property globally for this project
configure(subprojects) {
setProperty('publishing.version', {
if (findProperty("version.isRelease").toBoolean()) {
return "${findProperty("version.number")}"
} else {
def hash = 'git rev-parse --short HEAD'.execute().text.trim()
return "${findProperty("version.number")}-SNAPSHOT-$hash"
}
}())
}
// Add `distributeSql` task to all subprojects with `sql/` child directory
configure(subprojects.findAll { it.projectDir.toPath().resolve('sql').toFile().exists() }) { sp ->
task distributeSql(type: Copy) {
into "$rootDir/deployment/postgres-init-db/sql"
from fileTree(dir: "${sp.projectDir}/sql", include: '**/*.sql')
}
// Remove distributed SQL as part of `clean` task
task undoDistributeSql(type: Delete) {
doLast { // Explicity do last to avoid running during configuration step
file("${sp.projectDir}/sql").list().each {
delete "$rootDir/deployment/postgres-init-db/sql/$it"
}
}
}
// For all Java subprojects
sp.plugins.withId('java') {
// Distribute SQL as part of resource processing
processResources.dependsOn distributeSql
// Remove distributed SQL as part of `clean` tasks
clean.dependsOn undoDistributeSql
}
// For all Node subprojects
sp.plugins.withId('com.github.node-gradle.node') {
// For all subprojects without resource processing already defined
if (!tasks.findByName('processResources')) {
// Distribute SQL as part of resource processing
tasks.create('processResources')
tasks.findAll { it.name == 'processResources' }.each { it.dependsOn distributeSql }
// 'clean' is not visible here, make sure to call `undoDistributeSql` as part of each subproject's `clean` task
}
}
// Distribute SQL prior to creating deployment archive
archiveDeployment.dependsOn distributeSql
}
subprojects {
apply plugin: 'com.github.ben-manes.versions'
repositories {
// Search the local filesystem before attempting remote repositories
flatDir { dirs "$rootDir/third-party" }
mavenCentral()
}
group = 'gov.nasa.jpl.aerie'
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
options.addStringOption('Xdoclint:none', '-quiet')
}
}