-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
172 lines (156 loc) · 5.57 KB
/
build.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
plugins {
id 'checkstyle'
id 'maven-publish'
id 'java'
id 'java-library'
id 'groovy'
id 'signing'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
repositories {
mavenLocal()
mavenCentral()
}
test {
useJUnitPlatform()
}
tasks.withType(Checkstyle) {
reports {
xml {
enabled false
}
html {
enabled false
}
}
configFile new File("checkstyle.xml")
}
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
}
def releaseType = System.getenv("RELEASE_TYPE")
configurePublishing(releaseType)
def configurePublishing(releaseType) {
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 {
mavenLocal()
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')
}
}
}
}
}
}
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")
required { releaseType == "RELEASE"}
sign publishing.publications."${project.name}"
}
dependencies {
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: okHttpVersion
implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: retrofitVersion
implementation group: 'com.squareup.retrofit2', name: 'converter-jackson', version: retrofitVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: jacksonVersion
implementation group: 'com.auth0', name: 'java-jwt', version: javaJwtVersion
implementation group: 'org.apache.commons', name: 'commons-lang3', version: commonsLang3Version
implementation group: 'commons-codec', name: 'commons-codec', version: commonsCodecVersion
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
testImplementation group: 'org.codehaus.groovy', name: 'groovy', version: groovyVersion
testImplementation group: 'org.spockframework', name: 'spock-core', version: spockVersion
testImplementation group: 'net.bytebuddy', name: 'byte-buddy', version: byteBuddyVersion
testImplementation group: 'org.objenesis', name: 'objenesis', version: objenesisVersion
}