-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
174 lines (163 loc) · 5.62 KB
/
build.gradle
File metadata and controls
174 lines (163 loc) · 5.62 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
plugins {
id 'maven-publish'
id 'java'
id 'java-library'
id 'groovy'
id 'signing'
}
ext."signing.keyId" = System.getenv("SIGNING_KEY_ID")
ext."signing.password" = System.getenv("SIGNING_KEY_PASSWORD")
ext."signing.secretKeyRingFile" = System.getenv("SIGNING_KEY_PATH")
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDir file('src/main/java')
}
}
test {
groovy {
srcDir file('src/test/groovy')
}
}
testIntegration {
groovy {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
srcDir file('src/test-integration/groovy')
}
}
}
configurations {
testIntegrationCompile.extendsFrom testCompile
testIntegrationRuntime.extendsFrom testRuntime
}
task testIntegration(type: Test) {
testClassesDirs = project.sourceSets.testIntegration.output.classesDirs.filter {
include '**/*.class'
}
classpath = project.sourceSets.testIntegration.runtimeClasspath
}
task artifactVersion {
doFirst {
def releaseType = System.getenv("RELEASE_TYPE")
if (releaseType == 'SNAPSHOT') {
project.version += '-SNAPSHOT'
}
}
}
task publishArtifact {
dependsOn 'clean'
dependsOn 'artifactVersion'
dependsOn 'build'
dependsOn 'publish'
tasks.findByName('artifactVersion').mustRunAfter 'clean'
tasks.findByName('build').mustRunAfter 'artifactVersion'
tasks.findByName('publish').mustRunAfter 'build'
}
task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}
publishing {
publications {
"${project.name}"(MavenPublication) {
from project.components.java
artifact sourceJar
artifact javadocJar
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
groupId = project.group
artifactId = project.artifactId
name = project.name
description = project.description
url = project.url
organization {
name = organisationName
url = organisationUrl
}
issueManagement {
system = issueMgmtSystem
url = issueMgmtSystemUrl
}
licenses {
license {
name = license
url = licenseUrl
distribution = licenseDistribution
}
}
scm {
url = scmUrl
connection = scmConnection
developerConnection = scmDevConnection
}
developers {
developer {
name = developer
}
}
}
}
}
repositories {
def releaseType = System.getenv("RELEASE_TYPE")
if (releaseType == "SNAPSHOT") {
maven {
name 'OSS_Sonatype_Snapshot'
url 'https://oss.sonatype.org/content/repositories/snapshots'
credentials {
username System.getenv('SONATYPE_USERNAME')
password System.getenv('SONATYPE_PASSWORD')
}
}
}
if (releaseType == "RELEASE") {
maven {
name 'OSS_Sonatype_Staging'
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
credentials {
username System.getenv('SONATYPE_USERNAME')
password System.getenv('SONATYPE_PASSWORD')
}
}
}
def localRepo = System.getenv('MVN_LOCAL_REPO')
if (localRepo != null) {
maven {
url 'file://' + localRepo
}
}
}
}
signing {
sign publishing.publications."${project.name}"
}
dependencies {
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: okHttpVersion
compile group: 'com.squareup.retrofit2', name: 'retrofit', version: retrofitVersion
compile group: 'com.squareup.retrofit2', name: 'converter-jackson', version: retrofitVersion
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: jacksonVersion
compile group: 'org.apache.commons', name: 'commons-lang3', version: commonsLang3Version
compile group: 'commons-codec', name: 'commons-codec', version: commonsCodecVersion
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
compile group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
testCompile group: 'org.spockframework', name: 'spock-core', version: spockVersion
testCompile group: 'net.bytebuddy', name: 'byte-buddy', version: byteBuddyVersion
testCompile group: 'org.objenesis', name: 'objenesis', version: objenesisVersion
}