-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
210 lines (189 loc) · 6.97 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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.gorylenko.gradle-git-properties' version '2.2.4' apply false
id 'com.github.ben-manes.versions' version '0.38.0'
id 'net.researchgate.release' version '2.8.1'
}
ext {
// Project constants
github_org = 'Discord4J'
project_name = 'connect'
artifact_group = 'com.discord4j'
project_version = "$version".toString()
project_description = 'Distributed Bot Components for Discord4J'
repository_url = 'https://github.com/Discord4J/connect'
project_url = 'https://discord4j.com'
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()
}
discord4j_core_version = '3.2.3'
stores_redis_version = '3.2.2'
rsocket_version = '1.1.2'
rabbitmq_version = '1.5.5'
jsr305_version = '3.0.2'
junit_version = '4.13'
logback_version = '1.2.10'
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
sourceCompatibility = project_jdk
targetCompatibility = project_jdk
repositories {
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://oss.jfrog.org/artifactory/oss-snapshot-local' }
}
maven { url 'https://jitpack.io' }
maven { url 'https://repo.spring.io/milestone' }
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 60, 'seconds'
}
tasks.withType(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'
// adding links to javadocs for filling specific classes when not existing inside current javadoc
links = [
jdk_javadoc,
"https://fasterxml.github.io/jackson-databind/javadoc/2.10/",
"http://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/",
"https://projectreactor.io/docs/core/release/api/",
"https://projectreactor.io/docs/netty/release/api/",
"https://projectreactor.io/docs/extra/release/api/",
"https://netty.io/4.1/api/"
]
}
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.incremental = true
}
task downloadDependencies() {
description 'Download all dependencies to the Gradle cache'
doLast {
configurations.findAll { it.canBeResolved }.files
}
}
java {
withJavadocJar()
withSourcesJar()
}
}
subprojects {
archivesBaseName = "connect-$project.name"
tasks.withType(Javadoc) {
title = "$archivesBaseName ${version} API"
options.windowTitle = "$archivesBaseName ($version)"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId archivesBaseName
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = "$project.name"
description = 'Distributed Bot Components for Discord4J'
url = 'https://github.com/Discord4J/connect'
organization {
name = 'Discord4J'
url = 'https://discord4j.com'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/Discord4J/connect/issues'
}
licenses {
license {
name = 'LGPL-3.0'
url = 'https://github.com/Discord4J/connect/LICENSE.txt'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/Discord4J/connect'
connection = 'scm:git:git://github.com/Discord4J/connect.git'
developerConnection = 'scm:git:ssh://git@github.com:Discord4J/connect.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 = ''
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}