forked from inspectIT/inspectIT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inspectit.agent.java.gradle
106 lines (93 loc) · 2.66 KB
/
inspectit.agent.java.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
/**
* Gradle build file for the inspectit.agent.java project.
*
* @author Rene Kugel
* @author Ivan Senic
*/
evaluationDependsOn(':inspectit.shared.all')
defaultTasks 'releaseAndAnalyze'
/** used by the eclipse buildship plugin */
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
/** defined to have it included in Eclipse as source */
sourceSets {
externalResources {
resources {
srcDir mainExtResources
}
}
}
/** Some agent specific properties */
ext {
distJarName = 'inspectit-agent'
releaseName = "inspectit-agent-java6-${versionInfo}.zip"
}
/** Setting compile configuration as plugin in Eclipse needs it */
configurations {
compile {
extendsFrom configurations.agentJavaProd
}
testCompile {
extendsFrom configurations.agentJavaTest
extendsFrom configurations.jmhbase
}
}
/** Depend on inspectit.shared.all, testCompile must depend on shared all test sources because of TestBase class */
dependencies {
compile project(':inspectit.shared.all')
compile project(':inspectit.agent.java.sdk')
testCompile project (path: ':inspectit.shared.all', configuration: 'testArchives')
}
/** Compile compatibility to 1.6 for all compile tasks */
tasks.withType(JavaCompile) { t ->
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
options.bootClasspath = configurations.java16rt.asPath
}
/**
* Creates the jar. Excludes libs from the configurations.agentJavaProd that are not Java5 compatible. Uses existing manifest.
*/
jar {
// use jarCheck to make sure all classes in our dependencies are at maximum in version 1.6
doFirst {
def jarCheckOutput = new File("$buildRoot/jarCheck")
jarCheckOutput.mkdirs()
configurations.agentJavaProd.each { file ->
def name = file.name
javaexec {
classpath configurations.jarCheck
main = 'com.mindprod.jarcheck.JarCheck'
args = ["$file", "1.0", "1.6"]
standardOutput = new File(jarCheckOutput, "$name-check.log").newOutputStream()
}
}
}
archivesBaseName = distJarName
into('libs') {
from project(':inspectit.shared.all').jar.outputs
from project(':inspectit.agent.java.sdk').jar.outputs
from configurations.agentJavaProd
}
manifest {
from file("${mainResources}/META-INF/MANIFEST.MF")
}
}
/**
* Creates the release package.
*/
task release (type: Zip, dependsOn: jar) {
description = "Releases the ${releaseName} package."
group = 'Release'
destinationDir = file(buildReleasePackages)
archiveName = releaseName
into('agent') {
from jar.outputs
from file(mainExtResources)
from file(sharedResourcesLicense)
}
}
task releaseAndAnalyze {
description = "Runs all unit tests, all checks and releases the ${releaseName} package."
group = 'Release'
dependsOn(analyze, release)
}