forked from inspectIT/inspectIT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinspectit.shared.all.gradle
98 lines (84 loc) · 2.29 KB
/
inspectit.shared.all.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
/**
* Gradle build file for the inspectit.shared.all project.
*
* @author Rene Kugel
* @author Ivan Senic
*/
defaultTasks 'releaseAndAnalyze'
/** used by the eclipse buildship plugin */
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
/** Artifact names */
ext {
distJarName = 'inspectit-shared-all'
pluginName = 'rocks.inspectit.shared.all'
versionFile = new File(buildDir.getAbsolutePath(), 'version/version.log')
}
/** Setting compile configuration as plugin in Eclipse needs it */
configurations {
compile {
extendsFrom configurations.sharedAllProd
}
testCompile {
extendsFrom configurations.sharedAllTest
}
testArchives.extendsFrom (testCompile)
}
/** Compile compatibility to 1.6 for all compile tasks */
tasks.withType(JavaCompile) {
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
options.bootClasspath = configurations.java16rt.asPath
}
/** Task for creating the version file if needed. */
task createVersionFile {
inputs.property(versionInfo, null)
outputs.file versionFile
doLast {
versionFile.getParentFile().mkdirs()
if (!versionFile.exists()) {
versionFile.createNewFile()
}
versionFile.text = versionInfo
}
}
createVersionFile.onlyIf { project.hasProperty('versionInfo') }
/**
* Creates the jar. If needed create version.log on the fly and update the version in the MANIFEST.MF.
*/
jar {
archivesBaseName = distJarName
into('') {
from versionFile
}
manifest {
from ("${mainResources}/META-INF/MANIFEST.MF") {
eachEntry { details ->
if (details.key == 'Bundle-Version' && project.hasProperty('versionInfo')) {
details.value = versionInfo
}
}
}
}
}
jar.dependsOn createVersionFile
task releaseAndAnalyze {
description = "Runs all unit tests, all checks and assembles a jar archive."
group = 'Release'
dependsOn(analyze, jar)
}
/**
* The following task is needed because we want to have our base test classes available in the other sub-projects, too.
*/
task ('jarTest', type:Jar, dependsOn: testClasses, description: 'Assembles a jar archive from the test source set') {
group = BasePlugin.BUILD_GROUP
from project.sourceSets.test.output
include '**/testbase/*'
classifier = 'test'
}
/**
* The artifact definition for this new test jar defined by the jarTest task.
*/
artifacts {
testArchives project.jarTest
}