forked from azkaban/azkaban
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
176 lines (153 loc) · 5.04 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
buildscript {
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.cinnober.gradle:semver-git:2.2.1'
classpath 'com.linkedin:gradle-dustjs-plugin:1.0.0'
classpath 'de.obqo.gradle:gradle-lesscss-plugin:1.0-1.3.3'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
}
}
apply plugin: 'com.cinnober.gradle.semver-git'
apply plugin: 'idea'
apply plugin: 'distribution'
allprojects {
repositories {
mavenCentral()
mavenLocal()
}
}
/**
* Helper that calls a command and returns the output.
*/
def cmdCaller = { commandln ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine commandln
standardOutput = stdout
}
return stdout.toString().trim()
}
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'net.ltgt.errorprone'
// Set the same version for all sub-projects to root project version
version = rootProject.version
configurations.errorprone {
resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.5'
}
/**
* Gets the version name from the latest Git tag
*/
task createVersionFile() << {
String gitCommitHash = cmdCaller(['git', 'rev-parse', 'HEAD']);
String gitRepo = cmdCaller(['git', 'config', '--get', 'remote.origin.url']);
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd hh:mm zzz')
String versionStr = version + '\n' +
gitCommitHash + '\n' +
gitRepo + '\n' +
formattedDate + '\n'
File versionFile = file('build/package/azkaban.version')
versionFile.parentFile.mkdirs()
versionFile.write(versionStr)
}
/*
* Print test execution summary when informational logging is enabled.
*/
test {
testLogging {
afterSuite { desc, result ->
if (desc.getParent()) {
logger.info desc.getName()
} else {
logger.info "Overall"
}
logger.info " ${result.resultType} (" +
"${result.testCount} tests, " +
"${result.successfulTestCount} passed, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped)"
}
}
}
}
distributions {
migration {
baseName = 'azkaban-migration'
contents {
from { project(':azkaban-migration').file('build/package') }
}
}
webserver {
baseName = 'azkaban-web-server'
contents {
from { project(':azkaban-webserver').file('build/package') }
}
}
execserver {
baseName = 'azkaban-exec-server'
contents {
from { project(':azkaban-execserver').file('build/package') }
}
}
soloserver {
baseName = 'azkaban-solo-server'
contents {
from { project(':azkaban-soloserver').files('build/package') }
}
}
sql {
baseName = 'azkaban-sql'
contents {
from { project(':azkaban-sql').file('src/sql') }
from { project(':azkaban-sql').file('build/sql') }
}
}
}
// Set up dependencies for distribution tasks.
//
// N.B. The extension for the Tar tasks is set since the Gradle Distribution
// plugin uses the .tar file extension for GZipped Tar files by default.
//
// N.B. When the distribution tasks are run, azkaban-execserver,
// azkaban-webserver, azkaban-migration, and azkaban-soloserver only
// have a dependency on the azkaban-common build artifacts. As a result,
// the full :azkaban-common:build task is not run, meaning that the
// tests are skipped. Thus, the dependency on :azkaban-common:build
// is set here so that the azkaban-common unit tests are run when running
// the dist tasks.
migrationDistTar.dependsOn ':azkaban-common:build', ':azkaban-migration:copy'
migrationDistTar.compression = Compression.GZIP
migrationDistTar.extension = 'tar.gz'
migrationDistZip.dependsOn ':azkaban-common:build', ':azkaban-migration:copy'
webserverDistTar.dependsOn ':azkaban-common:build', ':azkaban-webserver:copy'
webserverDistTar.compression = Compression.GZIP
webserverDistTar.extension = 'tar.gz'
webserverDistZip.dependsOn ':azkaban-common:build', ':azkaban-webserver:copy'
execserverDistTar.dependsOn ':azkaban-common:build', ':azkaban-execserver:copy'
execserverDistTar.compression = Compression.GZIP
execserverDistTar.extension = 'tar.gz'
execserverDistZip.dependsOn ':azkaban-common:build', ':azkaban-execserver:copy'
soloserverDistTar.dependsOn ':azkaban-common:build', ':azkaban-soloserver:copy'
soloserverDistTar.compression = Compression.GZIP
soloserverDistTar.extension = 'tar.gz'
soloserverDistZip.dependsOn ':azkaban-common:build', ':azkaban-soloserver:copy'
sqlDistTar.dependsOn ':azkaban-sql:concat'
sqlDistTar.compression = Compression.GZIP
sqlDistTar.extension = 'tar.gz'
sqlDistZip.dependsOn ':azkaban-sql:concat'
distTar.dependsOn migrationDistTar, webserverDistTar, execserverDistTar, soloserverDistTar, sqlDistTar
distZip.dependsOn migrationDistZip, webserverDistZip, execserverDistZip, soloserverDistZip, sqlDistZip
/**
* Gradle wrapper task.
*/
task wrapper(type: Wrapper) {
gradleVersion = '2.7'
}