forked from stagemonitor/stagemonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·215 lines (183 loc) · 5.83 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
* RELEASING A NEW VERSION
* - set the following properties in ~/.gradle/gradle.properties
* - nexusUsername=<username>
* - nexusPassword=<pwd>
* - signing.secretKeyRingFile=<file>
* - signing.password=<passphrase>
* - Execute ./release.sh. This is what will happen:
* - all tests are executed locally
* - you will be asked for the version number of the release and the next development (SNAPSHOT) version
* - the gradle release plugin will then tag and push the release tag to github
* - checks out the just created release tag e.g. '0.11.0'
* - executes 'gradle uploadArchives'
* - Release the deployment at https://oss.sonatype.org/#welcome
* more information is available under http://central.sonatype.org/pages/releasing-the-deployment.html
*
*/
import groovy.json.StringEscapeUtils
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.3.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0'
}
}
plugins {
id 'net.researchgate.release' version '2.3.5'
}
repositories {
mavenCentral()
}
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'java'
if (!System.getProperty("java.version").startsWith("1.6.")) {
apply plugin: 'cobertura'
apply plugin: 'com.github.kt3k.coveralls'
}
ext {
metricsVersion = '3.2.4'
slf4jVersion = '1.7.25'
jacksonVersion = '2.9.0'
esVersion = '6.1.1'
byteBuddyVersion = '1.7.9'
opentracingVersion = '0.31.0-RC1'
jaegerVersion = '0.22.0-RC1'
jettyVersion = '9.3.13.v20161014'
getProjectsToRelease = this.&getProjectsToRelease
}
subprojects {
group = "org.stagemonitor"
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'
if (!System.getProperty("java.version").startsWith("1.6.")) {
apply plugin: 'cobertura'
}
if (projectsToRelease.contains(project)) {
apply plugin: 'osgi'
apply from: "$rootDir/gradle/publish-maven.gradle"
jar {
manifest {
attributes("Implementation-Version": version)
instruction 'Bundle-Vendor', 'iSYS Software GmbH'
instruction 'Bundle-Description', 'Open source performance monitoring'
instruction 'Bundle-DocURL', 'http://www.stagemonitor.org'
}
}
}
configurations {
provided
compile.extendsFrom provided
optional
compile.extendsFrom optional
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.10.0'
testCompile 'ch.qos.logback:logback-classic:1.1.7'
testCompile 'org.apache.logging.log4j:log4j-core:2.9.1'
testCompile 'commons-io:commons-io:2.5'
testCompile 'org.assertj:assertj-core:3.8.0'
}
test.testLogging.exceptionFormat = 'full'
compileJava {
sourceCompatibility = 1.6
targetCompatibility = 1.6
options.debug = true
options.debugOptions.debugLevel = "source,lines,vars"
options.incremental = true
}
compileTestJava {
options.debugOptions.debugLevel = "source,lines,vars"
options.incremental = true
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.incremental = true
}
cobertura {
coverageFormats = []
coverageIgnoreTrivial = true
coverageExcludes = ['.*org.stagemonitor.web.servlet.util.AntPathMatcher.*',
'.*org.stagemonitor.core.util.InetAddresses.*',
'.*org.stagemonitor.core.util.Ints.*',
'.*org.stagemonitor.core.util.Assert.*',
'.*org.stagemonitor.core.instrument.WeakConcurrentMap.*']
}
processResources {
doLast {
sourceSets.main.output.resourcesDir.mkdirs()
def versionFile = new File(sourceSets.main.output.resourcesDir, "version.properties")
versionFile.text = "version=$version"
}
eachFile { resource ->
def filePath = resource.file.canonicalPath
def isGrafanaDashboard = filePath.endsWith(".json") && filePath.contains("grafana/") && filePath.contains("Elasticsearch") && !resource.path.contains("Grafana1")
if (isGrafanaDashboard) {
def documentationPath = filePath.replace(".json", "Documentation.md")
def documentationFile = new File(documentationPath)
if (documentationFile.exists()) {
def documentationContent = """$documentationFile.text
---
[Edit this page](https://github.com/stagemonitor/stagemonitor/edit/master/${rootProject.relativePath(documentationFile)})
"""
filter { line ->
line.replace('$documentation', StringEscapeUtils.escapeJavaScript(documentationContent))
}
}
}
}
}
task copyToLib( type: Copy ) {
into "$buildDir/libs/lib"
from configurations.runtime - configurations.provided
}
}
release {
preTagCommitMessage = 'release '
tagCommitMessage = 'release '
newVersionCommitMessage = 'next development version '
git {
requireBranch = null
}
}
def getProjectsToRelease() {
subprojects.findAll { !(it.toString() =~ "benchmark|byte-buddy|grafana-elasticsearch|tracing-zipkin") }
}
test.dependsOn << projectsToRelease*.tasks*.withType(Test).flatten()
if (!System.getProperty("java.version").startsWith("1.6.")) {
cobertura {
coverageMergeDatafiles = projectsToRelease.collect { file("${it.buildDir.path}/cobertura/cobertura.ser") }
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = true
coverageSourceDirs = [projectsToRelease.sourceSets.main.java.srcDirs.flatten() ]
coverageExcludes = ['.*org.stagemonitor.web.servlet.util.AntPathMatcher.*',
'.*org.stagemonitor.core.util.InetAddresses.*',
'.*org.stagemonitor.core.util.Ints.*',
'.*org.stagemonitor.core.util.Assert.*',
'.*org.stagemonitor.core.instrument.WeakConcurrentMap.*']
}
}
task wrapper(type: Wrapper) {
gradleVersion = "4.2"
distributionType = "all"
}
task printProjectsToTest() {
doLast {
println getProjectsToRelease()
}
}
task install
install.dependsOn subprojects.compileJava