From 1eb33361d70df01b71c711164ea1576ab031592d Mon Sep 17 00:00:00 2001 From: "Flemming N. Larsen" Date: Sun, 1 Nov 2026 20:11:24 +0100 Subject: [PATCH 1/4] Update the tests to JUnit 6, compiled and run with Java 17, while Robocode itself stays on the Java 8 toolchain --- ...et.sf.robocode.java-conventions.gradle.kts | 23 ++++++++++++++----- gradle/test-libs.versions.toml | 4 ++-- robocode.tests/build.gradle.kts | 6 +++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/kotlin/net.sf.robocode.java-conventions.gradle.kts b/buildSrc/src/main/kotlin/net.sf.robocode.java-conventions.gradle.kts index 7696bf62d..f7fbb04fc 100644 --- a/buildSrc/src/main/kotlin/net.sf.robocode.java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/net.sf.robocode.java-conventions.gradle.kts @@ -23,10 +23,22 @@ java { } } +// The product runs on Java 8, but JUnit 6 needs Java 17, so only the tests are compiled and run with Java 17 or newer +val testJavaLanguageVersion = 17 + +configurations.matching { it.name == "testCompileClasspath" || it.name == "testRuntimeClasspath" }.configureEach { + attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, testJavaLanguageVersion) +} + tasks { withType { options.encoding = "UTF-8" } + named("compileTestJava") { + javaCompiler.set(javaToolchains.compilerFor { + languageVersion.set(JavaLanguageVersion.of(testJavaLanguageVersion)) + }) + } // Robot battle tests are timing-sensitive and can intermittently report transient // engine errors (e.g. "Unable to stop thread") on slow/loaded CI machines. // Retry failed tests a few times so such flakiness does not fail the build. @@ -37,13 +49,12 @@ tasks { maxFailures.set(20) failOnPassedAfterRetry.set(false) } - // Run tests on another Java version than the Java 8 toolchain, e.g. -PtestJavaVersion=25, + // Run tests on another Java version than Java 17, e.g. -PtestJavaVersion=25, // as robot security works differently on Java 24+ where the SecurityManager is removed. - providers.gradleProperty("testJavaVersion").orNull?.let { version -> - javaLauncher.set(javaToolchains.launcherFor { - languageVersion.set(JavaLanguageVersion.of(version)) - }) - } + val version = providers.gradleProperty("testJavaVersion").orNull ?: testJavaLanguageVersion.toString() + javaLauncher.set(javaToolchains.launcherFor { + languageVersion.set(JavaLanguageVersion.of(version)) + }) } } diff --git a/gradle/test-libs.versions.toml b/gradle/test-libs.versions.toml index aefb3fcc8..e5fc3272a 100644 --- a/gradle/test-libs.versions.toml +++ b/gradle/test-libs.versions.toml @@ -1,7 +1,7 @@ [versions] -junit = "5.14.4" -junit-platform = "1.14.4" +junit = "6.1.3" +junit-platform = "6.1.3" hamcrest = "3.0" [libraries] diff --git a/robocode.tests/build.gradle.kts b/robocode.tests/build.gradle.kts index 21ed3c860..36e1d2a79 100644 --- a/robocode.tests/build.gradle.kts +++ b/robocode.tests/build.gradle.kts @@ -17,6 +17,12 @@ dependencies { description = "Robocode Tests" +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + tasks { publishMavenJavaPublicationToSonatypeRepository { enabled = false From 86194105ca4ed2c906ebaf0d8b390fbad89c6ff9 Mon Sep 17 00:00:00 2001 From: "Flemming N. Larsen" Date: Sun, 1 Nov 2026 20:11:24 +0100 Subject: [PATCH 2/4] Always try the built Robocode on Java 8 and the newest Java before publishing a release --- AGENTS.md | 2 ++ release.md | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index aef708e4e..a3560a114 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,6 +5,8 @@ Before preparing or publishing a release, read [`release.md`](release.md) completely. It is the authoritative release procedure and credential guide. - Run Gradle on Java 17 or newer. The modules are compiled with a Java 8 toolchain, so the setup JAR runs on Java 8 and newer. Do not run Gradle itself on Java 8. +- The tests are compiled and run with Java 17 or newer, as JUnit 6 needs it, so no automated test runs on Java 8. +- Always try the built Robocode on Java 8 and on the newest Java before publishing, as described in Step 4 of `release.md`. `./gradlew release` publishes right after building, so do it before running that task. - `./gradlew release` performs the local release flow: pre-flight checks, build, Maven Central publishing, Chocolatey publishing on Windows, GitHub Release creation, SourceForge publishing (setup JAR, README.md, default download, and `version.html`), and the blog post HTML. A failing step does not stop the independent steps, and a summary at the end lists the results and the manual steps (posting on Blogger and SourceForge news). - With the local release, push `main` but not the version tag. `gh release create` makes the tag on GitHub; pushing the tag first starts the release workflow, which publishes too. - Docker publishing is deliberately separate from the release task. Publish the RoboRumble image (`zamboch/roborumble`) with `./gradlew dockerPush` only when it is explicitly required. diff --git a/release.md b/release.md index 4293b5ab7..26ba06f8b 100644 --- a/release.md +++ b/release.md @@ -23,6 +23,9 @@ Docker push is not included — run `./gradlew dockerPush` separately if needed. LiteRumble must be told about the new version separately (see [Step 1](#step-1--bump-the-version)). +Always build and try Robocode before running `./gradlew release`, which publishes right after building +(see [Step 4](#step-4--build-all-artifacts)). + --- **Option B — fully automated** @@ -214,6 +217,16 @@ newer. A JDK 8 must be installed, so Gradle can detect it; check with `./gradlew `versions.md` is included in the setup JAR, so set the release date in `versions.md` before building the release. +**Always try the build before publishing anything.** The automated tests cannot run on Java 8, as JUnit 6 needs Java 17, +and they do not show whether the application itself works. Unpack the setup JAR in an empty folder, e.g. with +`jar xf robocode-{version}-setup.jar`, and start `robocode.bat` or `robocode.sh`, both on Java 8 and on the newest Java: + +1. Run a battle until the results are shown. +2. Compile a new robot in the Robot Editor, and run it in a battle. On Java 8, this needs the JDK. +3. Check the console window for errors. + +Do not publish if any of this fails. + ### Step 5 — Publish to Maven Central Stage and release in one step: From 133d8e6abd51f6250136c9e3538c346dda1ec63c Mon Sep 17 00:00:00 2001 From: "Flemming N. Larsen" Date: Sun, 1 Nov 2026 20:11:25 +0100 Subject: [PATCH 3/4] Say in the ReadMe that the built-in compiler needs Java 17, so compiling robots with older versions needs the JDK --- robocode.content/src/main/resources/ReadMe.html | 5 +++-- robocode.content/src/main/resources/ReadMe.md | 5 +++-- versions.md | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/robocode.content/src/main/resources/ReadMe.html b/robocode.content/src/main/resources/ReadMe.html index 6c73b94ec..cad4ee3b9 100644 --- a/robocode.content/src/main/resources/ReadMe.html +++ b/robocode.content/src/main/resources/ReadMe.html @@ -91,8 +91,9 @@

HISTORY OF ROBOCODE

SYSTEM REQUIREMENTS

To run Robocode, Java 8 or a newer version must be installed on your system. Both the Java Runtime Environment (JRE) and the Java Developer Kit (JDK) can be used. Note that the JRE does not include the standard Java compiler (javac) which - comes with the JDK. However, Robocode comes with a built-in compiler ECJ (Eclipse Compiler for Java). - Hence, it is sufficient to run Robocode with the JRE only.

+ comes with the JDK. However, Robocode comes with a built-in compiler ECJ (Eclipse Compiler for Java), which needs + Java 17 or newer. Hence, the JRE is enough to run Robocode, and with Java 17 or newer also to compile robots in the Robot + Editor. To compile robots with an older version of Java, use the JDK.

Also, note that it is important that these environment variables have been set up before running Robocode:

  • JAVA_HOME must be set up to point at the home directory for Java diff --git a/robocode.content/src/main/resources/ReadMe.md b/robocode.content/src/main/resources/ReadMe.md index b416f2dbc..f115cd4a7 100644 --- a/robocode.content/src/main/resources/ReadMe.md +++ b/robocode.content/src/main/resources/ReadMe.md @@ -110,8 +110,9 @@ plugin, and the documentation files for it had got some serious issues that made To run Robocode, Java 8 or a newer version must be installed on your system. Both the Java Runtime Environment (JRE) and the Java Developer Kit (JDK) can be used. Note that the JRE does not include the standard Java compiler (javac) which -comes with the JDK. However, Robocode comes with a built-in compiler ECJ (Eclipse Compiler for Java). -Hence, it is sufficient to run Robocode with the JRE only. +comes with the JDK. However, Robocode comes with a built-in compiler ECJ (Eclipse Compiler for Java), which needs +Java 17 or newer. Hence, the JRE is enough to run Robocode, and with Java 17 or newer also to compile robots in the Robot +Editor. To compile robots with an older version of Java, use the JDK. Also, note that it is important that these environment variables have been set up before running Robocode: diff --git a/versions.md b/versions.md index 44d157fca..2ceac3a39 100644 --- a/versions.md +++ b/versions.md @@ -22,6 +22,9 @@ Data in a robot's jar is not lost. If the data cannot be deleted, even after a garbage collection in case a robot left a file open for reading, the client logs which file it was, waits a minute, and skips the battle. - Both settings default to `NOT` and must match the rumble on the server. The official LiteRumble rumbles need `NOT`. +- The ReadMe now says that the built-in compiler needs Java 17 or newer, so compiling robots with an older version of + Java needs the JDK. +- The tests now use JUnit 6, and run on Java 17 and 25 instead of Java 8 and 25. Robocode itself still runs on Java 8. ## Version 1.11.2 (31-Oct-2026) From cec2fd5455265f2c44ce034db6906e0248eea2df Mon Sep 17 00:00:00 2001 From: "Flemming N. Larsen" Date: Sun, 1 Nov 2026 20:14:21 +0100 Subject: [PATCH 4/4] Leave internal changes out of versions.md, which is for Robocoders --- versions.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/versions.md b/versions.md index 2ceac3a39..44d157fca 100644 --- a/versions.md +++ b/versions.md @@ -22,9 +22,6 @@ Data in a robot's jar is not lost. If the data cannot be deleted, even after a garbage collection in case a robot left a file open for reading, the client logs which file it was, waits a minute, and skips the battle. - Both settings default to `NOT` and must match the rumble on the server. The official LiteRumble rumbles need `NOT`. -- The ReadMe now says that the built-in compiler needs Java 17 or newer, so compiling robots with an older version of - Java needs the JDK. -- The tests now use JUnit 6, and run on Java 17 and 25 instead of Java 8 and 25. Robocode itself still runs on Java 8. ## Version 1.11.2 (31-Oct-2026)