Skip to content

Commit 9bf5b76

Browse files
pbouilletIvan Senic
authored and
Ivan Senic
committed
INSPECTIT-2158, INSPECTIT-2076: optimized gradle build and replaced cobertura with jacoco
1 parent 7201df1 commit 9bf5b76

File tree

7 files changed

+31
-49
lines changed

7 files changed

+31
-49
lines changed

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip

inspectit.agent.java/inspectit.agent.java.gradle

-6
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ tasks.withType(JavaCompile) { t ->
5151
options.bootClasspath = configurations.java16rt.asPath
5252
}
5353

54-
55-
/** This is not working when specified in the subprojects{ } part, thus each project must do it */
56-
cobertura {
57-
coverageDirs += project(':inspectit.shared.all').sourceSets.main.output.classesDir.path
58-
}
59-
6054
/**
6155
* Creates the jar. Excludes libs from the configurations.agentJavaProd that are not Java5 compatible. Uses existing manifest.
6256
*/

inspectit.root.gradle

+10-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ buildscript {
1212
jcenter()
1313
}
1414
dependencies {
15-
classpath "net.saliman:gradle-cobertura-plugin:2.3.1"
1615
classpath "gradle.plugin.me.champeau.gradle:jmh-gradle-plugin:0.3.0"
1716
classpath "org.standardout:bnd-platform:1.4.0"
1817
}
@@ -250,8 +249,8 @@ subprojects {
250249
apply plugin: 'pmd'
251250
apply plugin: 'checkstyle'
252251
apply plugin: 'findbugs'
253-
apply plugin: 'net.saliman.cobertura'
254252
apply plugin: 'me.champeau.gradle.jmh'
253+
apply plugin: 'jacoco'
255254

256255
/** all compile, test and runtime configurations to transitive = false */
257256
configurations.compile.transitive = false
@@ -292,21 +291,12 @@ subprojects {
292291
task analyze {
293292
description = 'Runs all unit tests and all checks.'
294293
group = 'Verification'
295-
dependsOn(project.tasks.cobertura, check)
294+
dependsOn(check)
296295
}
297296

298297
/**
299298
* Tasks for the TestNG and Cobertura.
300299
*/
301-
cobertura {
302-
// ignore getters and setters, new options from Cobertura
303-
// can not be used for now due to the https://github.com/cobertura/cobertura/issues/200
304-
//coverageIgnoreTrivial = true
305-
306-
//reporting
307-
coverageReportDir = file(buildQATestCoveragedata)
308-
coverageFormats = ['xml', 'html']
309-
}
310300

311301
/**
312302
* Definition of the test properties.
@@ -399,5 +389,12 @@ subprojects {
399389
humanOutputFile = file("${buildQAPerfTest}/jmh/human.txt")
400390
resultsFile = file("${buildQAPerfTest}/jmh/results.txt")
401391
}
402-
392+
393+
/**
394+
* Configures the jacoco plugin.
395+
*/
396+
jacoco {
397+
reportsDir = file(buildQATestCoveragedata)
398+
}
399+
403400
}

inspectit.server/inspectit.server.gradle

+1-7
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ classes.finalizedBy ciSchemaCheck
138138
*/
139139
def schemagen(sourceDir, outputDir, fileName, excludes) {
140140
return tasks.create(name: "schemagen-${outputDir}/${fileName}", dependsOn: compileJava) {
141-
inputs.sourceDir(sourceDir)
141+
inputs.files(fileTree(sourceDir))
142142
outputs.file file("${outputDir}/${fileName}")
143143

144144
doLast {
@@ -166,12 +166,6 @@ test {
166166
jvmArgs += serverJavaOptsForTests
167167
}
168168

169-
/** Include shared.all & shared.cs also for the coverage */
170-
cobertura {
171-
coverageDirs += project(':inspectit.shared.all').sourceSets.main.output.classesDir.path
172-
coverageDirs += project(':inspectit.shared.cs').sourceSets.main.output.classesDir.path
173-
}
174-
175169
/**
176170
* Creates the jar. Manifest 'Class-Path' is constructed from the configurations.serverProd and jars from the depending projects.
177171
*/

inspectit.shared.all/inspectit.shared.all.gradle

+19-10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ targetCompatibility = '1.6'
1414
ext {
1515
distJarName = 'inspectit-shared-all'
1616
pluginName = 'rocks.inspectit.shared.all'
17+
versionFile = new File(buildDir.getAbsolutePath(), 'version/version.log')
1718
}
1819

1920
/** Setting compile configuration as plugin in Eclipse needs it */
@@ -35,22 +36,29 @@ tasks.withType(JavaCompile) {
3536
options.bootClasspath = configurations.java16rt.asPath
3637
}
3738

39+
/** Task for creating the version file if needed. */
40+
task createVersionFile {
41+
inputs.property(versionInfo, null)
42+
outputs.file versionFile
43+
44+
doLast {
45+
versionFile.getParentFile().mkdirs()
46+
if (!versionFile.exists()) {
47+
versionFile.createNewFile()
48+
}
49+
versionFile.text = versionInfo
50+
}
51+
}
52+
createVersionFile.onlyIf { project.hasProperty('versionInfo') }
53+
3854
/**
3955
* Creates the jar. If needed create version.log on the fly and update the version in the MANIFEST.MF.
4056
*/
4157
jar {
4258
archivesBaseName = distJarName
4359

44-
// add version.log only to shared.all
45-
if (project.hasProperty('versionInfo')) {
46-
def tempFile = File.createTempFile('version', '.log')
47-
tempFile.text = versionInfo
48-
tempFile.deleteOnExit()
49-
50-
into('') {
51-
from tempFile
52-
rename tempFile.getName(), 'version.log'
53-
}
60+
into('') {
61+
from versionFile
5462
}
5563

5664
manifest {
@@ -63,6 +71,7 @@ jar {
6371
}
6472
}
6573
}
74+
jar.dependsOn createVersionFile
6675

6776
task releaseAndAnalyze {
6877
description = "Runs all unit tests, all checks and assembles a jar archive."

inspectit.shared.cs/inspectit.shared.cs.gradle

-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ tasks.withType(JavaCompile) {
3939
targetCompatibility = '1.7'
4040
}
4141

42-
/** Include shared.all also for the coverage */
43-
cobertura {
44-
coverageDirs += project(':inspectit.shared.all').sourceSets.main.output.classesDir.path
45-
}
46-
4742
/**
4843
* Creates the jar. If needed update the version in the MANIFEST.MF.
4944
*/

inspectit.ui.rcp/inspectit.ui.rcp.gradle

-7
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ tasks.withType(JavaCompile) {
4545
targetCompatibility = '1.7'
4646
}
4747

48-
/** Include shared.all & shared.cs also for the coverage Extend auxiliaryClasspath so that corbertura can find eclipse-base jars. */
49-
cobertura {
50-
coverageDirs += project(':inspectit.shared.all').sourceSets.main.output.classesDir.path
51-
coverageDirs += project(':inspectit.shared.cs').sourceSets.main.output.classesDir.path
52-
auxiliaryClasspath += fileTree(include: '**/*.jar', dir: eclipsePlugins)
53-
}
54-
5548
/**
5649
* Cleans the PDE build 'plugins/rocks.inspectit.ui.rcp' folder.
5750
*/

0 commit comments

Comments
 (0)