Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<JavaCompile> {
options.encoding = "UTF-8"
}
named<JavaCompile>("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.
Expand All @@ -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))
})
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/test-libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
13 changes: 13 additions & 0 deletions release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions robocode.content/src/main/resources/ReadMe.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ <h3 id="history-of-robocode">HISTORY OF ROBOCODE</h3>
<h3 id="system-requirements">SYSTEM REQUIREMENTS</h3>
<p>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.</p>
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.</p>
<p>Also, note that it is important that these environment variables have been set up before running Robocode:</p>
<ul>
<li><p><strong>JAVA_HOME</strong> must be set up to point at the home directory for Java
Expand Down
5 changes: 3 additions & 2 deletions robocode.content/src/main/resources/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 6 additions & 0 deletions robocode.tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ dependencies {

description = "Robocode Tests"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks {
publishMavenJavaPublicationToSonatypeRepository {
enabled = false
Expand Down
Loading