forked from concordion/concordion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle
264 lines (233 loc) · 8.55 KB
/
publish.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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
plugins {
id 'net.researchgate.release' version '2.3.0'
id 'org.ajoberstar.git-publish' version '1.0.0'
id "com.jfrog.bintray" version "1.6"
id 'org.kordamp.gradle.clirr' version '0.2.3'
id 'net.nemerosa.versioning' version '2.7.1'
}
apply from: 'build.gradle'
apply plugin: 'maven-publish'
apply plugin: 'java-library-distribution'
ext {
githubUrl = "https://github.com/concordion/${project.name}"
issuesUrl = "${githubUrl}/issues"
vcsUrl = "${githubUrl}.git"
vcsConnection = "scm:git:git://github.com/concordion/${project.name}.git"
if (!project.hasProperty("bintrayUsername")) {
bintrayUsername = ''
}
if (!project.hasProperty("bintrayApiKey")) {
bintrayApiKey = ''
}
if (!project.hasProperty("bintrayPassphrase")) {
bintrayPassphrase = ''
}
if (!project.hasProperty("sonatypeUsername")) {
sonatypeUsername = ''
}
if (!project.hasProperty("sonatypePassword")) {
sonatypePassword = ''
}
}
group='org.concordion'
distributions {
// version = version - "-SNAPSHOT"
main {
contents {
from ('.') { include '*.txt','build.gradle','src/**' }
into ('lib') {
from 'licenses'
}
}
}
}
jar {
manifest {
attributes 'Specification-Title' : project.name,
'Implementation-Title' : project.name,
'Specification-Version' : version.substring(0, version.lastIndexOf(".")),
'Implementation-Version': version,
'Implementation-Vendor' : 'concordion.org',
'Specification-Vendor' : 'concordion.org',
'Created-By' : System.getProperty('java.version') + ' (' + System.getProperty('java.vendor') + ')',
'Built-With' : "gradle-${project.getGradle().getGradleVersion()}, groovy-${GroovySystem.getVersion()}",
'Build-Time' : String.format("%tFT%<tRZ", Calendar.getInstance(TimeZone.getTimeZone("Z"))),
'Build-Revision' : versioning.info.commit,
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
}
}
// 'gradle release' will also upload release to Bintray
createReleaseTag.dependsOn bintrayUpload
gitPublishCopy.dependsOn test
gitPublishCopy.dependsOn javadoc
task publishDocs(dependsOn: ['gitPublishPush'])
task publishSnapshot(dependsOn: ['test', 'publishMainPublicationToMavenRepository'])
task publishRelease(dependsOn: ['clean', 'test', 'javadoc', 'sourcesJar', 'javadocJar', 'publishDocs', 'release'])
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
from (sourceSets.test.allSource) {
include 'test/**'
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task testJar(type: Jar, dependsOn: testClasses) {
classifier = 'tests'
from sourceSets.test.output
include 'test/**'
}
publishing {
repositories {
maven {
if (project.version.endsWith('-SNAPSHOT')) {
url "http://oss.jfrog.org/artifactory/simple/oss-snapshot-local/"
credentials {
username bintrayUsername
password bintrayApiKey
}
}
}
}
}
publishing {
publications {
main(MavenPublication) {
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
artifact testJar {
classifier "tests"
}
from components.java
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name project.name
description project.description
url 'http://www.concordion.org'
packaging 'jar'
inceptionYear '2008'
scm {
url vcsUrl
connection vcsConnection
developerConnection vcsConnection
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.html'
distribution 'repo'
}
}
issueManagement{
system 'GitHub Issues'
url issuesUrl
}
developers {
developer {
id 'peterson3'
name 'David Peterson'
roles { role 'Project Creator' }
}
developer {
id 'nigel.charman.nz'
name 'Nigel Charman'
roles { role 'Project Lead' }
}
developer {
id 'drtimwright'
name 'Tim Wright'
roles { role 'Developer' }
}
developer {
id 'jose.m.beas'
name 'Jose M Beas'
roles { role 'Developer' }
}
developer {
id 'gmandnepr'
name 'Ievgen Degtiarenko'
roles { role 'Developer' }
}
developer {
id 'habuma'
roles { role 'Developer' }
}
developer {
id 'pinfieldharm'
roles { role 'Developer' }
}
developer {
id 'wangyizhuo'
roles { role 'Developer' }
}
}
}
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
}
}
}
}
gitPublish {
repoUri = '[email protected]:concordion/concordion.git'
branch = 'gh-pages'
contents {
from 'ghpages'
into ('latest') {
from ('build/reports/spec/concordion') {
into 'spec'
}
from ('build/docs/javadoc/') {
into 'javadoc'
}
}
}
}
bintray {
user = bintrayUsername // set this in your ~/.gradle/gradle.properties file
key = bintrayApiKey // set this in your ~/.gradle/gradle.properties file
publications = ['main'] // see publications closure
// dryRun = true
publish = true
pkg {
repo = 'maven'
userOrg = 'concordion'
name = project.name
desc = project.description
licenses = ['Apache-2.0']
issueTrackerUrl = issuesUrl
vcsUrl = vcsUrl
websiteUrl = 'https://concordion.org'
version {
name = project.version
released = new Date()
vcsTag = project.version
gpg {
sign = true
passphrase = bintrayPassphrase // set this in your ~/.gradle/gradle.properties file
}
mavenCentralSync {
sync = true
user = sonatypeUsername // set this in your ~/.gradle/gradle.properties file
password = sonatypePassword // OSS user password// set this in your ~/.gradle/gradle.properties file
close = '1'
}
}
}
}
clirr {
failOnErrors = false
// baseline = 'org.concordion:concordion:2.0.0'
}