forked from lburgazzoli/gradle-karaf-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
228 lines (185 loc) · 6.33 KB
/
build.gradle
File metadata and controls
228 lines (185 loc) · 6.33 KB
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
216
217
218
219
220
221
222
223
224
225
226
227
228
// *****************************************************************************
//
// *****************************************************************************
buildscript {
repositories {
mavenCentral()
mavenLocal()
jcenter()
}
dependencies {
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3'
}
}
// *****************************************************************************
//
// *****************************************************************************
plugins {
id 'java'
id 'groovy'
id 'maven'
id 'signing'
id 'com.gradle.plugin-publish' version '0.9.5'
id 'net.researchgate.release' version '2.4.1'
}
apply plugin: 'io.codearte.nexus-staging'
// *****************************************************************************
//
// *****************************************************************************
group = 'com.github.lburgazzoli'
description = 'A gradle plugin for Karaf'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
ext {
isReleaseVersion = !version.endsWith("SNAPSHOT")
isSnapshotVersion = version.endsWith("SNAPSHOT")
isCI = Boolean.valueOf("$System.env.CI")
gitRoot = "https://github.com/lburgazzoli"
gitProject = "https://github.com/lburgazzoli/gradle-karaf-plugin"
gitURL = "git@github.com:lburgazzoli/gradle-karaf-plugin"
groovyVersion = GroovySystem.version.replaceAll(/\.\d+$/,'')
gradleVersion = '3.0'
gradleScriptDir = "${rootProject.projectDir}/gradle"
gradlePluginId = "com.github.lburgazzoli.karaf"
gradlePluginTags = [ 'karaf' ]
gradleCiTasks = isReleaseVersion ? ['clean', 'test'] : ['clean', 'test', 'uploadArchives']
versions = [
slf4j : '1.7.21',
spock : "1.0-groovy-${groovyVersion}"
]
if (isReleaseVersion) {
nexusUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
} else {
nexusUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
if(!project.hasProperty('nexusUsername') && !project.hasProperty('nexusPassword')) {
nexusUsername = "$System.env.CI_DEPLOY_USERNAME"
nexusPassword = "$System.env.CI_DEPLOY_PASSWORD"
}
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
}
dependencies {
compile gradleApi()
compile localGroovy()
testCompile("org.spockframework:spock-core:$versions.spock") {
exclude(module: 'groovy-all')
}
}
project.tasks.withType(org.gradle.api.tasks.compile.JavaCompile) {
it.sourceCompatibility = project.sourceCompatibility
it.targetCompatibility = project.targetCompatibility
}
project.tasks.withType(org.gradle.api.tasks.compile.GroovyCompile) {
it.sourceCompatibility = project.sourceCompatibility
it.targetCompatibility = project.targetCompatibility
}
jar {
baseName = "${project.name}"
manifest {
attributes['Implementation-Title' ] = "${group}.${project.name}-${project.version}"
attributes['Implementation-Version' ] = project.version
attributes['Implementation-Vendor' ] = 'Luca Burgazzoli'
}
}
test {
testLogging {
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
}
}
// *****************************************************************************
// ARTIFACTS
// *****************************************************************************
task sourcesJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allSource
}
task groovydocJar(type: Jar, dependsOn: groovydoc) {
classifier 'groovydoc'
from groovydoc.destinationDir
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives groovydocJar
archives javadocJar
}
// *****************************************************************************
// Publish to gradle Plugins
// *****************************************************************************
pluginBundle {
website = project.gitProject
vcsUrl = project.gitProject
description = project.name
tags = gradlePluginTags
plugins {
karafPlugin {
id = gradlePluginId
displayName = project.description
}
}
}
// *****************************************************************************
// Publish to Sonatype OSS
// *****************************************************************************
signing {
required {
isReleaseVersion
}
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: project.nexusUrl) {
authentication(
userName: project.nexusUsername,
password: project.nexusPassword
)
}
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
pom.groupId = project.group
pom.artifactId = project.name
pom.version = project.version
pom.project {
name project.name
description project.name
url project.gitProject
scm {
url project.gitProject
connection "scm:${project.gitProject}"
developerConnection "scm:${project.gitURL}"
}
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 'lburgazzoli'
name 'Luca Burgazzoli'
}
}
}
}
}
}
// *****************************************************************************
//
// *****************************************************************************
afterReleaseBuild.dependsOn publishPlugins, uploadArchives
task ci(dependsOn: project.gradleCiTasks) {
}
task close(dependsOn: 'closeAndPromoteRepository') {
}