Skip to content

Migrate to Gradle 9.5.1#11

Draft
cobexer wants to merge 7 commits into
mainfrom
cobexer/gradle-9-migration
Draft

Migrate to Gradle 9.5.1#11
cobexer wants to merge 7 commits into
mainfrom
cobexer/gradle-9-migration

Conversation

@cobexer
Copy link
Copy Markdown
Member

@cobexer cobexer commented May 27, 2026

Supersedes #10.

Changes

  • Bump Gradle wrapper 7.6.6 → 9.5.1
  • Switch spock-core from 2.4-groovy-3.0 to 2.4-groovy-4.0

Why

Gradle 9.5.1 ships with Groovy 4.0.29. The groovy-3.0 Spock variant is rejected at compile time with:

Spock 2.4.0-groovy-3.0 is not compatible with Groovy 4.0.29

The groovy-4.0 variant of the same Spock 2.4 release is a drop-in replacement.

Test plan

  • build check passes (compileTestGroovy succeeds with Groovy 4)

@cobexer cobexer requested a review from a team as a code owner May 27, 2026 10:07
@cobexer cobexer self-assigned this May 27, 2026
blindpirate
blindpirate previously approved these changes May 28, 2026
Copy link
Copy Markdown
Member

@blindpirate blindpirate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cobexer cobexer marked this pull request as draft May 28, 2026 06:50
@cobexer cobexer force-pushed the cobexer/gradle-9-migration branch from 53f2208 to 69369df Compare May 29, 2026 10:50
@cobexer cobexer requested a review from Copilot May 29, 2026 12:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the project build and test infrastructure to run on Gradle 9.5.1 / Groovy 4 (Spock 2.4 groovy-4.0), updating the build builder’s generated builds and integration tests to reflect Gradle 9+/AGP 8+ conventions and newer toolchains.

Changes:

  • Upgraded Gradle wrapper and refactored build/test setup to use version catalogs, modern repositories, and JUnit Platform-based Spock execution.
  • Updated generators and integration tests for newer Gradle/AGP/Swift/C++ behaviors (AndroidX, maven-publish, Swift XCTest main, HTTP repo publishing workflow).
  • Replaced the CLI implementation (airlift/airline → picocli) and improved test robustness/perf (timeouts, bounded output handling, reduced Swift matrix).

Reviewed changes

Copilot reviewed 49 out of 51 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/test/groovy/org/gradle/builds/SwiftBuildSourceDepsIntegrationTest.groovy Swift test updates (IgnoreIf on macOS, app path casing).
src/test/groovy/org/gradle/builds/SwiftBuildIntegrationTest.groovy Swift test updates (IgnoreIf, XCTestMain.swift expectations, reduced N).
src/test/groovy/org/gradle/builds/SwiftBuildBuildSrcIntegrationTest.groovy Swift buildSrc test now uses Swift-specific base + macOS ignore.
src/test/groovy/org/gradle/builds/KotlinBuildIntegrationTest.groovy Kotlin test assertions made version-agnostic for jar names.
src/test/groovy/org/gradle/builds/JavaBuildIntegrationTest.groovy Adjusted expected generated child build directory casing.
src/test/groovy/org/gradle/builds/JavaBuildHttpRepoIntegrationTest.groovy Switched HTTP repo tests to :publishHttpRepo flow (no external server process).
src/test/groovy/org/gradle/builds/CppBuildHttpRepoIntegrationTest.groovy Same HTTP repo workflow change for C++ builds.
src/test/groovy/org/gradle/builds/CppBuildComplexCompositionIntegrationTest.groovy Same HTTP repo workflow change for complex C++ composition.
src/test/groovy/org/gradle/builds/AndroidBuildSourceDepsIntegrationTest.groovy Adjusted Android source-deps directory casing expectations.
src/test/groovy/org/gradle/builds/AndroidBuildIntegrationTest.groovy AndroidX API expectation update.
src/test/groovy/org/gradle/builds/AndroidBuildHttpRepoIntegrationTest.groovy Same HTTP repo workflow change for Android builds.
src/test/groovy/org/gradle/builds/AbstractSwiftIntegrationTest.groovy New Swift test base with macOS skip rationale.
src/test/groovy/org/gradle/builds/AbstractIntegrationTest.groovy Modernized test infrastructure (TempDir, bounded waits, log redirection, GradleRunner updates).
src/test/groovy/org/gradle/builds/AbstractAndroidIntegrationTest.groovy Removed old Gradle 5.x pin for Android integration tests.
src/main/kotlin/org/gradle/builds/generators/GradlePropertiesGenerator.kt Emits AndroidX/Jetifier flags + heap sizing based on components.
src/main/kotlin/org/gradle/builds/assemblers/KotlinModelAssembler.kt Switched repositories to Maven Central + modern application main class DSL.
src/main/kotlin/org/gradle/builds/assemblers/GradlePluginModelAssembler.kt Migrated repos, dependency config, Java compat cap, capitalization fix.
src/main/java/org/gradle/builds/model/HttpServerImplementation.java HTTP repo implementation now models heap needs and repo dir (no fixed port).
src/main/java/org/gradle/builds/model/HttpRepository.java Removed fixed-port/URI construction; now models just repo root dir.
src/main/java/org/gradle/builds/model/HasCppSource.java Adds heap sizing guidance for C++ builds.
src/main/java/org/gradle/builds/model/DefaultBuildStructureBuilder.java Nullable annotation migrated to JSpecify.
src/main/java/org/gradle/builds/model/BlockWithRepositories.java Repository DSL updated for Maven Central + HTTP repo port indirection.
src/main/java/org/gradle/builds/model/AndroidComponent.java Updated Android heap sizing for AGP 8.x.
src/main/java/org/gradle/builds/Main.java CLI migrated from airline to picocli.
src/main/java/org/gradle/builds/generators/SwiftSourceGenerator.java Generates XCTestMain.swift and Linux allTests for XCTest execution.
src/main/java/org/gradle/builds/generators/SettingsFileGenerator.java Generates settings.gradle with embedded HTTP repo server BuildService.
src/main/java/org/gradle/builds/generators/HttpServerMainGenerator.java Removed standalone HTTP server app generator.
src/main/java/org/gradle/builds/generators/GitRepoGenerator.java Sets explicit author/committer when generating git repos.
src/main/java/org/gradle/builds/generators/AndroidManifestGenerator.java AGP 8 namespace + android:exported updates.
src/main/java/org/gradle/builds/assemblers/SwiftModelAssembler.java Pins Swift language mode to Swift 5 for Swift 6 compatibility.
src/main/java/org/gradle/builds/assemblers/LanguageSpecificProjectConfigurer.kt Kotlin string capitalization updated for Kotlin 2.x.
src/main/java/org/gradle/builds/assemblers/JvmModelAssembler.java Uses Maven Central + centralizes JUnit4 coordinate constant.
src/main/java/org/gradle/builds/assemblers/JavaModelAssembler.java Modern application DSL + maven-publish + modern test configuration.
src/main/java/org/gradle/builds/assemblers/HttpServerModelAssembler.java Reworked HTTP repo publication wiring with publishHttpRepo aggregator task.
src/main/java/org/gradle/builds/assemblers/HttpRepoModelStructureAssembler.java HTTP repo now hosted by main build (no separate repo-server build).
src/main/java/org/gradle/builds/assemblers/CppModelAssembler.java Updated Boost linker config to modern native tasks.
src/main/java/org/gradle/builds/assemblers/AndroidModelAssembler.java Updated to AGP 8 conventions (AndroidX deps, namespace DSL, publish wiring).
src/main/java/org/gradle/builds/assemblers/AndroidBuildProjectInitializer.java Updates Java target level for Android-associated Java libs.
settings.gradle.kts Adds Develocity plugins to the build.
gradlew.bat Wrapper script updated for new Gradle wrapper version.
gradlew Wrapper script updated for new Gradle wrapper version.
gradle/wrapper/gradle-wrapper.properties Wrapper bumped to Gradle 9.5.1 (and wrapper properties updated).
gradle/libs.versions.toml Introduces version catalog (including generator-emitted coordinates).
gradle/gradle-daemon-jvm.properties Configures Gradle daemon toolchain version.
gradle.properties Sets Gradle daemon JVM args for the build itself.
buildSrc/src/main/kotlin/build-builder.generator-versions.gradle.kts New buildSrc plugin to generate GeneratorVersions from catalog entries.
buildSrc/settings.gradle.kts Build logic buildSrc settings.
buildSrc/build.gradle.kts Build logic buildSrc build config.
build.gradle.kts Migrated dependencies/plugins + JvmTestSuite configuration for Spock.
.github/workflows/ci.yml CI updated for Java 25 + Swift/Boost/Android SDK provisioning and test artifacts on failure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +45 to +48
public void run(String... args) throws Exception {
new CommandLine(this)
.setExecutionExceptionHandler((ex, cmd, parseResult) -> { throw ex; })
.execute(args);
Comment on lines +25 to +31
public void maven(HttpRepository repo) {
ScriptBlock block = new ScriptBlock("maven");
block.property("url", repo.getUri().toString());
// The repo is served by an embedded HttpServer started as a Gradle
// BuildService from settings.gradle; the assigned port is exposed via
// gradle.ext.httpRepoPort. Parallel test forks each get their own.
block.property("url", new Scope.Code(
"\"http://localhost:${gradle.httpRepoPort}/\""));
pw.println(" catch (BindException ignored) { return HttpServer.create(new InetSocketAddress(0), 20) }");
pw.println(" }");
pw.println();
pw.println(" @Override void close() { server.stop(0) }");
Comment on lines +7 to +13
/**
* Wires the GradleBuild publish tasks for each external library build into
* the consuming (main) build's root project, and forces the standard entry
* tasks (build/assemble/installDist/etc.) to depend on them so the http-repo
* is populated before the embedded server starts answering resolution
* requests.
*/
@cobexer cobexer force-pushed the cobexer/gradle-9-migration branch 11 times, most recently from a245f5b to 6677d92 Compare June 2, 2026 11:45
cobexer added 2 commits June 2, 2026 21:34
Strip trailing -<version>.jar from lib-dir filenames before comparing,
so dependdency bumps don't require lockstep edits to the assertions.

Signed-off-by: Christoph Obexer <cobexer@gradle.com>
Signed-off-by: Christoph Obexer <cobexer@gradle.com>
@cobexer cobexer force-pushed the cobexer/gradle-9-migration branch 2 times, most recently from bf52082 to 4a88994 Compare June 3, 2026 14:27
cobexer added 5 commits June 3, 2026 16:39
Signed-off-by: Christoph Obexer <cobexer@gradle.com>
…binary

Signed-off-by: Christoph Obexer <cobexer@gradle.com>
Signed-off-by: Christoph Obexer <cobexer@gradle.com>
Signed-off-by: Christoph Obexer <cobexer@gradle.com>
* Add Java 25 toolchain for compilation and Gradle daemon
* buildSrc: cap targetCompatibility at Java 17 in generated plugin builds
  Gradle 9.0 bundles a version of ASM that does not understand class file
  major version 69 (Java 25).

Signed-off-by: Christoph Obexer <cobexer@gradle.com>
@cobexer cobexer force-pushed the cobexer/gradle-9-migration branch from 4a88994 to 15e8964 Compare June 3, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants