forked from inspectIT/inspectIT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinspectit.agent.java.sdk.gradle
202 lines (168 loc) · 5.26 KB
/
inspectit.agent.java.sdk.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
/**
* Gradle build file for the inspectit.agent.java.sdk project.
*
* @author Ivan Senic
*/
/** Required plugins */
plugins {
id "io.codearte.nexus-staging" version "0.8.0"
}
/** The default task */
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 SDK specific properties */
ext {
distJarName = 'inspectit-agent-java-sdk'
}
/** Setting compile configuration as plugin in Eclipse needs it */
configurations {
compile {
extendsFrom configurations.agentJavaSdkProd
}
testCompile {
extendsFrom configurations.agentJavaSdkTest
}
}
/** Must depend on shared all test sources because of TestBase class */
dependencies {
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.
*/
jar {
archivesBaseName = distJarName
manifest {}
}
task releaseAndAnalyze {
description = "Runs all unit tests, all checks and releases the jar."
group = 'Release'
dependsOn(analyze, jar)
}
/**
* Creates jar with sources.
*/
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
/**
* Creates jar with javadocs.
*/
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
/**
* Pushing to maven centeral.
*/
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'io.codearte.nexus-staging'
/**
* When uploading the archives it has to be done using the full task name:
* > gradle :inspectit.agent.java.sdk:uploadArchives
*/
if (gradle.startParameter.getTaskNames().contains(":inspectit.agent.java.sdk:uploadArchives")) {
// Artifacts to build
artifacts {
archives sourcesJar, javadocJar
}
// Sign the artifacts
signing {
sign configurations.archives
}
group = "rocks.inspectit"
archivesBaseName = "agent-java-sdk"
// Uploads the signed artifacts
uploadArchives {
repositories {
mavenDeployer {
// check if necessary parameter exists
if (!project.hasProperty('sonatype.username') || !project.hasProperty('sonatype.password')) {
throw new GradleException('Credentials for Sonytype are missing.')
}
if (System.getProperty('RELEASE_VERSION') == null) {
throw new GradleException('The version of the SDK has to be specified. (Specified by "RELEASE_VERSION")')
}
// required to map correct configuration (including dependencies)
pom.scopeMappings.with {
mappings.clear()
addMapping(300, configurations.agentJavaSdkProd, 'compile')
}
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: project.property('sonatype.username'), password: project.property('sonatype.password'))
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
authentication(userName: project.property('sonatype.username'), password: project.property('sonatype.password'))
}
version = System.getProperty('RELEASE_VERSION')
pom.project {
name 'inspectIT Java SDK'
packaging 'jar'
description 'Library to enrich the functionality of Java applications which use the inspectIT agent for monitoring and collection of runtime data.'
url 'https://github.com/inspectIT/inspectIT'
scm {
url "https://github.com/inspectIT/inspectIT"
connection "scm:git:https://github.com/inspectIT/inspectIT.git"
developerConnection "scm:git:git@github.com:inspectIT/inspectIT.git"
}
issueManagement {
system 'jira'
url 'https://inspectit-performance.atlassian.net'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'inspectit-team'
name 'The inspectIT Development Team'
organizationUrl 'http://www.inspectit.rocks'
}
}
}
}
}
}
}
/**
* When closing or releasing the staging repository it has to be done using the full task name:
* > gradle :inspectit.agent.java.sdk:<TASK>
*
* Note: Always use the 'closeAndReleaseRepository' in the Jenkins build process.
*/
if (gradle.startParameter.getTaskNames().contains(":inspectit.agent.java.sdk:closeAndReleaseRepository")
|| gradle.startParameter.getTaskNames().contains(":inspectit.agent.java.sdk:closeRepository")
|| gradle.startParameter.getTaskNames().contains(":inspectit.agent.java.sdk:releaseRepository")) {
nexusStaging {
// check if necessary parameter exists
if (!project.hasProperty('sonatype.username') || !project.hasProperty('sonatype.password')) {
throw new GradleException('Credentials for Sonytype are missing.')
}
username = project.property('sonatype.username')
password = project.property('sonatype.password')
packageGroup = "rocks.inspectit"
}
}