forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
156 lines (135 loc) · 6.07 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
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
subprojects {
apply plugin: 'com.bmuschko.nexus'
extraArchive {
sources = true
javadoc = true
tests = false
}
nexus {
sign = true
repositoryUrl = 'https://repository.apache.org/service/local/staging/deploy/maven2'
snapshotRepositoryUrl = 'https://repository.apache.org/content/repositories/snapshots'
}
modifyPom {
withXml {
def elem = asElement()
def hdr = elem.getOwnerDocument().createComment(
'''
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
''')
elem.insertBefore(hdr, elem.getFirstChild())
//This black magic checks to see if a dependency has the flag ext.optional=true
//set on it, and if so marks the dependency as optional in the maven pom
def depMap = project.configurations.compile.dependencies.collectEntries { [it.name, it] }
asNode().dependencies.dependency.findAll {
def dep = depMap.get(it.artifactId.text())
return dep?.hasProperty('optional') && dep.optional
}.each {
if (it.optional) {
it.optional.value = 'true'
} else {
it.appendNode('optional', 'true')
}
}
}
project {
name 'Apache Geode (incubating)'
description 'Apache Geode (incubating) provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing'
url 'http://geode.incubator.apache.org'
scm {
url 'https://git-wip-us.apache.org/repos/asf?p=incubator-geode.git;a=tree'
connection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
developerConnection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
repositories {
repository {
id 'libs-release'
name 'Spring Maven libs-release Repository'
url 'http://repo.spring.io/libs-release'
}
}
}
}
// The nexus plugin reads authentication from ~/.gradle/gradle.properties but the
// jenkins server stores publishing credentials in ~/.m2/settings.xml (maven).
// We match on the expected snapshot repository id.
afterEvaluate {
if (!isReleaseVersion && System.env.USER == 'jenkins') {
def settingsXml = new File(System.getProperty('user.home'), '.m2/settings.xml')
if (settingsXml.exists()) {
def snapshotCreds = new XmlSlurper().parse(settingsXml).servers.server.find { server ->
server.id.text() == 'apache.snapshots.https'
}
if (snapshotCreds != null) {
tasks.uploadArchives.doFirst {
repositories().withType(MavenDeployer).each { repo ->
repo.snapshotRepository.authentication.userName = snapshotCreds.username.text()
repo.snapshotRepository.authentication.password = snapshotCreds.password.text()
}
}
}
}
}
}
}
//Prompt the user for a password to sign archives or upload artifacts, if requested
gradle.taskGraph.whenReady { taskGraph ->
if (project.hasProperty('askpass')) {
if(taskGraph.allTasks.any {it instanceof Sign}) {
if(!project.hasProperty('signing.keyId') || !project.hasProperty('signing.secretKeyRingFile')) {
println "You must configure your signing.keyId and signing.secretKeyRingFile"
println "in ~/.gradle/gradle.properties in order to sign jars\n"
println "See https://cwiki.apache.org/confluence/display/GEODE/Release+Steps"
throw new GradleException("Signing key/keyring is missing")
}
if(!project.hasProperty('signing.password')) {
def password = PasswordDialog.askPassword("Please enter your password to unlock your gpg keyring for signing artifacts")
subprojects { ext."signing.password" = password }
}
}
if(taskGraph.allTasks.any {it.name == 'uploadArchives'}) {
if(!project.hasProperty('nexusUsername')) {
println "You must configure your nexusUsername in ~/.gradle/gradle.properties in order to uploadArchives\n"
println "See https://cwiki.apache.org/confluence/display/GEODE/Release+Steps"
throw new GradleException("nexusUsername is missing")
}
if(!project.hasProperty('nexusPassword')) {
def password = PasswordDialog.askPassword("Please enter your apache password to uploadArchives to nexus")
subprojects { ext."nexusPassword" = password }
}
}
}
}