-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Expand file tree
/
Copy pathbuild.gradle
More file actions
269 lines (215 loc) · 7.93 KB
/
build.gradle
File metadata and controls
269 lines (215 loc) · 7.93 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
plugins {
id("java-library")
id("checkstyle")
id("eclipse")
id("jacoco")
id("maven-publish")
id("me.champeau.jmh") version "0.7.3"
id("com.github.hierynomus.license") version "0.16.1"
id("biz.aQute.bnd.builder") version "7.2.1"
id("com.vanniktech.maven.publish") version "0.36.0"
id("org.beryx.jar") version "2.0.0"
id("signing")
}
ext {
reactiveStreamsVersion = "1.0.4"
junitVersion = "4.13.2"
testNgVersion = "7.12.0"
mockitoVersion = "4.11.0"
jmhLibVersion = "1.37"
guavaVersion = "33.5.0-jre"
jupiterVersion = "5.11.3"
jupiterLauncherVersion = "1.11.3"
}
def releaseTag = System.getenv("BUILD_TAG")
if (releaseTag != null && !releaseTag.isEmpty()) {
if (releaseTag.startsWith("v")) {
releaseTag = releaseTag.substring(1)
}
project.version = releaseTag
logger.lifecycle("Releasing with version: " + project.version)
}
repositories {
mavenCentral()
}
dependencies {
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.reactivestreams:reactive-streams-tck:$reactiveStreamsVersion"
testImplementation "org.testng:testng:$testNgVersion"
testImplementation "com.google.guava:guava:$guavaVersion"
testImplementation "org.reactivestreams:reactive-streams-tck-flow:$reactiveStreamsVersion"
testImplementation "org.junit.jupiter:junit-jupiter:$jupiterVersion"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$jupiterVersion"
// The missing piece – required by Gradle 9+
testRuntimeOnly "org.junit.platform:junit-platform-launcher:$jupiterLauncherVersion" // match your JUnit version family
}
java {
toolchain {
vendor = JvmVendorSpec.ADOPTIUM
languageVersion = JavaLanguageVersion.of(25) // Temurin 26 is not out yet
}
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-parameters"
}
apply from: file("gradle/javadoc_cleanup.gradle")
javadoc {
source = sourceSets.main.allJava.matching {
include 'io/reactivex/rxjava4/**'
exclude '**/internal/**'
exclude '**/test/**'
exclude '**/perf/**'
exclude '**/jmh/**'
exclude 'module-info.java'
}
// Explicitly disable modularity inference (prevents Gradle adding module flags)
modularity.inferModulePath = false
classpath = sourceSets.main.runtimeClasspath + sourceSets.main.output
options {
windowTitle = "RxJava Javadoc ${project.version}"
}
// Clear the following options to make the docs consistent with the old format
options.addStringOption("top").value = ""
options.addStringOption("doctitle").value = ""
options.addStringOption("header").value = ""
options.stylesheetFile = project.file("gradle/stylesheet.css")
options.addBooleanOption('Xdoclint:none', true) // disables all doclint checks (modern JDKs)
failOnError = false
options.links(
"https://docs.oracle.com/en/java/javase/25/docs/api/",
"https://reactivex.io/RxJava/org.reactivestreams.javadoc/${reactiveStreamsVersion}/"
)
// modularity.inferModulePath = true // let Gradle handle deps on --module-path
finalizedBy javadocCleanup
}
moduleConfig {
moduleInfoPath = 'src/main/module/module-info.java'
multiReleaseVersion = 9
version = project.version
}
import aQute.bnd.gradle.Bundle // ← important import
tasks.register('bundle', Bundle) {
archiveBaseName.set('rxjava') // or archiveFileName = "rxjava-${version}.jar"
archiveVersion.set(project.version)
archiveClassifier.set('') // empty → no classifier
from sourceSets.main.output // your classes
from('.') {
include 'LICENSE'
include 'COPYRIGHT'
into 'META-INF/'
}
// Exclude module-info.class from root (you already had this)
exclude 'module-info.class'
// All your Bnd instructions go here
bundle {
bnd('-fixupmessages': '^Classes found in the wrong directory: \\{META-INF/versions/9/module-info\\.class=module-info\\}$')
bnd('Bundle-Name': 'rxjava')
bnd('Bundle-Vendor': 'RxJava Contributors')
bnd('Bundle-Description': 'Reactive Extensions for the JVM - a library for composing asynchronous and event-based programs using observable sequences for the Java VM.')
bnd('Import-Package': '!org.junit,!junit.framework,!org.mockito.*,!org.testng.*,*')
bnd('Bundle-DocURL': 'https://github.com/ReactiveX/RxJava')
bnd('Eclipse-ExtensibleAPI': 'true')
bnd('Export-Package': '!io.reactivex.rxjava4.internal.*,io.reactivex.rxjava4.*')
bnd('Bundle-SymbolicName': 'io.reactivex.rxjava4.rxjava')
bnd('Multi-Release': 'true')
}
}
license {
header project.file("config/license/HEADER")
ext.year = Calendar.getInstance().get(Calendar.YEAR)
skipExistingHeaders true
ignoreFailures true
excludes(["**/*.md", "**/*.txt"])
}
jmh {
jmhVersion = jmhLibVersion
humanOutputFile = null
includeTests = false
jvmArgs = ["-Djmh.ignoreLock=true"]
jvmArgsAppend = ["-Djmh.separateClasspathJAR=true"]
if (project.hasProperty("jmh")) {
includes = [".*" + project.jmh + ".*"]
logger.info("JMH: {}", includes)
}
}
test {
maxHeapSize = "1200m"
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
useJUnitPlatform()
}
tasks.register('testNG', Test) {
description = 'Runs TestNG tests'
group = 'verification'
// Important: point to the same compiled test classes
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
// Tell it to use TestNG explicitly
useTestNG()
maxParallelForks = 1
// Optional: fine-tune includes/excludes
// include '**/*NgTest.class', '**/*TestNG.class'
// exclude '**/*JUnitTest.class'
// Optional: reports, listeners, etc.
testLogging {
events = ["skipped", "failed"]
exceptionFormat = "full"
debug.events = ["skipped", "failed"]
debug.exceptionFormat = "full"
info.events = ["failed", "skipped"]
info.exceptionFormat = "full"
warn.events = ["failed", "skipped"]
warn.exceptionFormat = "full"
}
reports.html.required = true
reports.junitXml.required = true // if you want JUnit-compatible XML too
}
check.dependsOn testNG
tasks.withType(Test) {
testLogging {
events = ["skipped", "failed"]
exceptionFormat = "full"
debug.events = ["skipped", "failed"]
debug.exceptionFormat = "full"
info.events = ["failed", "skipped"]
info.exceptionFormat = "full"
warn.events = ["failed", "skipped"]
warn.exceptionFormat = "full"
}
}
jacocoTestReport {
dependsOn test
dependsOn testNG
reports {
xml.required.set(true)
csv.required.set(false)
html.required.set(true)
}
}
check.dependsOn jacocoTestReport
checkstyle {
configFile = project.file("config/checkstyle/checkstyle.xml")
configProperties = [
"checkstyle.suppressions.file": project.file("config/checkstyle/suppressions.xml"),
"checkstyle.header.file" : project.file("config/license/HEADER_JAVA")
]
checkstyleMain.exclude '**/module-info.java'
}
if (project.hasProperty("releaseMode")) {
logger.lifecycle("ReleaseMode: {}", project.releaseMode)
if ("full" == project.releaseMode) {
signing {
if (project.hasProperty("SIGNING_PRIVATE_KEY") && project.hasProperty("SIGNING_PASSWORD")) {
useInMemoryPgpKeys(project.getProperty("SIGNING_PRIVATE_KEY"), project.getProperty("SIGNING_PASSWORD"))
sign(publishing.publications)
}
}
}
mavenPublishing {
// or when publishing to https://central.sonatype.com/
publishToMavenCentral(true)
// signAllPublications()
}
}