forked from hunglin/concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
218 lines (195 loc) · 7.81 KB
/
build.gradle
File metadata and controls
218 lines (195 loc) · 7.81 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
/*
* Copyright (c) 2013-2017 Cinchapi Inc.
*
* Licensed 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.
*/
// To upgrade:
// 1. Take a backup of gradlew because there is custom logic there that must
// be preserved
// 2. Change gradleVersion here
// 3. Change the distributionUrl in gradle/wrapper/gradle-wrapper.properties
// 4. Run ./gradlew wrapper
task wrapper(type: Wrapper) {
gradleVersion = '3.0'
}
// The project version is controlled externally by the "version.sh" script.
def getVersion = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'bash', 'version.sh'
standardOutput = stdout
}
return stdout.toString().trim()
}
def validateVersion = { version ->
def matcher = version =~/^(\d+\.)?(\d+\.)?(\d+\.)?(\d+)(-SNAPSHOT){0,1}$/
return matcher.matches()
}
ext.globalVersion = getVersion()
ext.isWindows = System.getProperty("os.name").toLowerCase().contains("windows")
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.nisgits.gradle:gradle-executable-jar-plugin:1.7.0'
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'idea'
repositories {
mavenCentral()
mavenLocal()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'http://cinchapi.bintray.com/maven'
}
maven {
url 'http://cinchapi.bintray.com/maven-snapshots'
}
}
configurations {
all*.exclude group: 'org.cinchapi', module: 'concourse'
all*.exclude group: 'com.google.code.findbugs', module: 'annotations'
}
dependencies {
compile 'com.google.guava:guava:19.0'
compile 'org.mockito:mockito-all:1.9.5'
compile 'commons-codec:commons-codec:1.8'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'ch.qos.logback:logback-classic:1.0.13'
compile 'joda-time:joda-time:2.2'
compile 'org.apache.thrift:libthrift:0.9.3'
compile 'commons-configuration:commons-configuration:1.9'
compile (group: 'com.cinchapi', name: 'accent4j', version: '1.0.0-SNAPSHOT', changing:true) {
exclude group: 'com.google.guava', module: 'guava'
}
testCompile 'junit:junit:4.11'
}
test {
testLogging {
events 'standard_error'
}
}
group = 'com.cinchapi'
version = globalVersion
// Drop the build component from version number and use that for
// publishing
ext.mavenVersion = version.split('\\.')
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+-", "-")
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+", "").trim()
ext.mavenVersion = ext.mavenVersion.join(".").replace(".-", "-").replaceAll('\\.$', "")
jar {
manifest {
attributes("Specificiation-Title": "Concourse", "Specificiation-Version": version, "Implementation-Version": version)
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
exclude "**/thrift/**"
options.windowTitle 'Concourse Java API'
options.noQualifiers 'all'
options.links 'https://docs.oracle.com/javase/8/docs/api/'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
test {
exclude '**/*Suite.class'
}
// THESE PROPERTIES SHOULD BE OVERRIDDEN BY EACH SUBPROJECT!
ext.uploadEnabled = false // Controls if artifacts are uploaded to Maven
ext.title = "Concourse" // The project's vanity title
ext.description = "Default" // A short description about the project
afterEvaluate { project ->
if(ext.uploadEnabled && validateVersion(project.version)) { // Configure subprojects that should be uploaded
// to Maven
def mavenTitle = ext.title
def mavenDescription = ext.description
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
pom.version = mavenVersion
pom.project {
name mavenTitle
description mavenDescription
url 'https://github.com/cinchapi/concourse'
packaging 'jar'
scm {
url 'git@github.com:cinchapi/concourse.git'
connection 'git@github.com:cinchapi/concourse.git'
developerConnection 'git@github.com:cinchapi/concourse.git'
}
licenses {
license {
name 'The Apache License'
url 'http://opensource.org/licenses/Apache-2.0'
distribution 'repo'
}
}
developers {
developer {
id 'jnelson'
name 'Jeff Nelson'
}
}
}
// Edit the generated POM to set the dependency version
// for any Cinchapi projects to be the version that is
// configured in the project's POM (X.Y.Z[-SNAPSHOT])
// instead of the fully qualified version used when
// labeling the jar distributed with the server
// (X.Y.Z.B[-SNAPSHOT]).
pom.withXml {
asNode().dependencies.first().each {
def groupId = it.get("groupId").first().value().first()
def artifactId = it.get("artifactId").first().value().first()
if(groupId.equals("com.cinchapi") && artifactId.startsWith("concourse") && !artifactId.equals("concourse-plugin-bundle-generator")) {
it.get("version").first().value = pom.version
}
}
}
def mavenUrl = pom.version.matches('^[0-9]+\\.[0-9]+\\.[0-9]+(-rc[0-9]+){0,1}$') ? 'https://oss.sonatype.org/service/local/staging/deploy/maven2' : 'https://oss.sonatype.org/content/repositories/snapshots'
repository(url: mavenUrl) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
}
}
}
}
}