-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
228 lines (203 loc) · 7.26 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
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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.github.ben-manes.versions' version '0.42.0'
// TODO: Warning for Gradle 9 by https://github.com/researchgate/gradle-release/issues/379
id 'net.researchgate.release' version '3.0.2'
}
ext {
// Project constants
github_org = 'Discord4J'
project_name = 'stores'
artifact_group = 'com.discord4j'
project_version = "$version".toString()
project_description = 'Java interface for the Discord API'
project_jdk = '1.8'
jdk = JavaVersion.current().majorVersion
jdk_javadoc = "https://docs.oracle.com/javase/$jdk/docs/api/".toString()
if (JavaVersion.current().isJava11Compatible()) {
jdk_javadoc = "https://docs.oracle.com/en/java/javase/$jdk/docs/api/".toString()
}
// Dependencies
reactor_bom_version = '2023.0.8'
servicer_version = '1.0.3'
junit_version = '5.7.1'
logback_version = '1.3.14'
caffeine_version = '2.9.3' // TODO: Version 3.x require JDK 11
lettuce_version = '6.3.2.RELEASE'
jackson_version = '2.17.2'
commons_lang_version = '3.15.0'
testcontainers_version = '1.20.0'
assertj_version = '3.26.3'
isJitpack = "true" == System.getenv("JITPACK")
isRelease = !version.toString().endsWith('-SNAPSHOT')
}
allprojects {
apply plugin: 'java-library'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'maven-publish'
if (!isJitpack && isRelease) {
apply plugin: 'signing'
}
group = artifact_group
version = project_version
description = project_description
java {
sourceCompatibility = project_jdk
targetCompatibility = project_jdk
}
dependencies {
api platform("io.projectreactor:reactor-bom:$reactor_bom_version")
compileOnly "com.google.code.findbugs:jsr305:3.0.1"
testCompileOnly "com.google.code.findbugs:jsr305:3.0.1"
}
repositories {
mavenLocal()
mavenCentral()
if (!isRelease || isJitpack) {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://oss.sonatype.org/content/repositories/staging' }
}
maven { url 'https://jitpack.io' }
maven { url 'https://repo.spring.io/milestone' }
}
javadoc {
options {
encoding = 'UTF-8'
tags = ["apiNote:a:API Note:",
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:"]
addStringOption 'Xdoclint:none', '-quiet'
addStringOption 'encoding', 'UTF-8'
links = [
jdk_javadoc,
"https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/",
"https://projectreactor.io/docs/core/release/api/",
]
}
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.incremental = true
}
tasks.register('downloadDependencies') {
description 'Download all dependencies to the Gradle cache'
doLast {
configurations.findAll { it.canBeResolved }.files
}
}
java {
withJavadocJar()
withSourcesJar()
}
}
subprojects {
base {
archivesName = 'stores-' + project.name
}
tasks.withType(Javadoc).configureEach {
title = "${base.archivesName.get()} ${version} API"
options.windowTitle = "${base.archivesName.get()} ($version)"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
afterEvaluate {
artifactId = jar.archiveBaseName.get()
}
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'Stores'
description = 'A set of pre-made store implementations for Discord4J'
url = 'https://github.com/Discord4J/Stores'
organization {
name = 'Discord4J'
url = 'https://discord4j.com'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/Discord4J/Stores/issues'
}
licenses {
license {
name = 'LGPL-3.0'
url = 'https://github.com/Discord4J/Stores/LICENSE.txt'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/Discord4J/Stores'
connection = 'scm:git:git://github.com/Discord4J/Stores.git'
developerConnection = 'scm:git:ssh://[email protected]:Discord4J/Stores.git'
}
developers {
developer {
name = 'The Discord4J Team'
}
}
}
}
}
if (!isJitpack) {
repositories {
maven {
if (isRelease) {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
} else {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
def sonatypeUsername = findProperty('sonatypeUsername')
def sonatypePassword = findProperty('sonatypePassword')
if (sonatypeUsername != null && sonatypePassword != null) {
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
}
}
if (!isJitpack && isRelease) {
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(new String(signingKey.decodeBase64()), signingPassword as String)
}
sign publishing.publications.mavenJava
}
}
}
release {
preTagCommitMessage = 'Release version'
tagCommitMessage = 'Release version'
newVersionCommitMessage = 'Next development version'
git {
requireBranch.set('')
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
def buildDocsUrl(String project) {
if (isJitpack) {
def docVersion = System.getenv('GIT_COMMIT')
return "https://javadoc.jitpack.io/com/discord4j/stores/$project/$docVersion/javadoc/" as String
} else {
def docVersion = isRelease ? "$version" : "3.0"
return "https://www.javadoc.io/page/com.discord4j/$project/$docVersion/" as String
}
}