Skip to content

Commit 79e8198

Browse files
committed
upgrade to support java 25 and gradle 9.2.1
1 parent b496edf commit 79e8198

File tree

1 file changed

+29
-40
lines changed

1 file changed

+29
-40
lines changed

build.gradle

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ plugins {
1616
scmVersion {
1717
versionCreator('versionWithBranch')
1818
tag {
19-
// Property<String> in newer versions
2019
prefix.set('')
2120
}
2221
}
@@ -28,11 +27,7 @@ repositories {
2827
mavenCentral()
2928
}
3029

31-
// Dynamically resolve Java major version from:
32-
// 1) env BUILD_JAVA_VERSION (if set), else
33-
// 2) the JVM running Gradle (JavaVersion.current().majorVersion)
34-
//
35-
// Accepts values like: "24", "24.0.1", "24-ea", "24.0.2-tem", etc.
30+
// --- Java Version Resolution ---
3631
static int resolveBuildJavaVersion() {
3732
String v = System.getenv('BUILD_JAVA_VERSION') ?: JavaVersion.current().majorVersion
3833

@@ -54,10 +49,8 @@ static int resolveBuildJavaVersion() {
5449
}
5550
}
5651

57-
// Usage
5852
def buildJavaVersion = resolveBuildJavaVersion()
5953

60-
// recommended build java version is 25
6154
if (buildJavaVersion < 24) {
6255
throw new GradleException(
6356
"This build requires Java 24+.\n" +
@@ -96,6 +89,7 @@ dependencies {
9689
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVersion
9790
}
9891

92+
// --- Test Data Preparation ---
9993
def testdataParent = layout.projectDirectory.dir("testdata")
10094
def repoDir = testdataParent.dir("parse-number-fxx-test-data")
10195

@@ -129,53 +123,49 @@ tasks.register('downloadTestData', Exec) {
129123
}
130124
}
131125

126+
// Configuration common to ALL Test tasks (including 'test', 'test256', 'test512')
132127
tasks.withType(Test).configureEach {
133128
dependsOn tasks.named('downloadTestData')
134-
}
135-
136-
tasks.register('test256', Test) {
137-
// IMPORTANT: run the normal test task first (no cycles)
138-
dependsOn tasks.named('test')
139-
140-
useJUnitPlatform()
141-
jvmArgs += [
142-
'--add-modules', 'jdk.incubator.vector',
143-
'-Xmx2g',
144-
'-Dorg.simdjson.species=256'
145-
]
146-
testLogging {
147-
events 'PASSED', 'SKIPPED', 'FAILED', 'STANDARD_OUT', 'STANDARD_ERROR'
148-
}
149-
}
150129

151-
tasks.register('test512', Test) {
152-
// IMPORTANT: run the normal test task first (no cycles)
153-
dependsOn tasks.named('test')
154-
155-
useJUnitPlatform()
156-
jvmArgs += [
157-
'--add-modules', 'jdk.incubator.vector',
158-
'-Xmx2g',
159-
'-Dorg.simdjson.species=512'
160-
]
130+
// Fix: Ensure logging is visible in the console
161131
testLogging {
132+
showStandardStreams = true
162133
events 'PASSED', 'SKIPPED', 'FAILED', 'STANDARD_OUT', 'STANDARD_ERROR'
134+
exceptionFormat = 'full'
135+
showExceptions = true
136+
showCauses = true
137+
showStackTraces = true
163138
}
164139
}
165140

141+
// --- Test Variants (256/512) ---
166142
test {
167-
// run JUnit 5 tests
168143
useJUnitPlatform()
169-
170144
jvmArgs += [
171145
'--add-modules', 'jdk.incubator.vector', '-Xmx2g'
172146
]
173-
174-
// Don't blow up if this particular task finds nothing
175147
failOnNoDiscoveredTests = false
176148
}
177149

178-
// Recommended: `./gradlew check` runs all test variants
150+
// Generate test tasks for specific species (256, 512)
151+
[256, 512].each { species ->
152+
tasks.register("test${species}", Test) {
153+
group = 'verification'
154+
description = "Runs tests with org.simdjson.species=${species}"
155+
156+
// Fix: Removed 'dependsOn test'. This allows test256 to run independently.
157+
// We use mustRunAfter so they don't interleave output if run together via 'check'.
158+
dependsOn tasks.named('test')
159+
160+
useJUnitPlatform()
161+
jvmArgs += [
162+
'--add-modules', 'jdk.incubator.vector',
163+
'-Xmx2g',
164+
"-Dorg.simdjson.species=${species}"
165+
]
166+
}
167+
}
168+
179169
tasks.named('check') {
180170
dependsOn tasks.named('test256')
181171
dependsOn tasks.named('test512')
@@ -190,7 +180,6 @@ tasks.withType(JavaCompile).configureEach {
190180
}
191181

192182
tasks.compileJmhScala.classpath = sourceSets.main.compileClasspath
193-
194183
tasks.compileJmhJava.classpath += files(sourceSets.jmh.scala.classesDirectory)
195184

196185
compileTestJava {

0 commit comments

Comments
 (0)