fix: clear the Gradle 10 deprecation warnings in the build scripts

Every build printed "Deprecated Gradle features were used in this build,
making it incompatible with Gradle 10". With --warning-mode all that was
five distinct Kotlin DSL delegated-property deprecations, all in our own
scripts:

- `val x by extra(...)` / `val x: T by extra` in the root script, for the
  opt-in Sonar gate that buildscript {} publishes and the body reads. Now
  extra.set("x", v) and extra["x"] as T.
- `val x by getting { }` for eight of quartz's KMP source sets. Now
  getByName("x") { }, which is what commons already used. None of those
  vals were referenced, so the local binding goes away with them.
- `val x by tasks.registering { }` and the typed
  `by tasks.registering(T::class) { }`, thirteen tasks across quartz,
  commons, cli, geode, nestsClient and desktopApp. Now
  tasks.register("x") { } and tasks.register<T>("x") { }, which return the
  same TaskProvider, so the dependsOn / finalizedBy references to them are
  unchanged.

`./gradlew --warning-mode all help` is now silent, and all nineteen
converted tasks still register and run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0123kXtseu4X18hL3GMDcdER
This commit is contained in:
Claude
2026-09-12 17:50:14 +00:00
parent d63e14bb36
commit 6e3af61e6a
7 changed files with 30 additions and 30 deletions
+9 -9
View File
@@ -9,18 +9,18 @@ import java.util.Properties
// compiles this buildscript {} section in an earlier stage that can't see the // compiles this buildscript {} section in an earlier stage that can't see the
// file's imports (hence the qualified Properties) or share code with the body, // file's imports (hence the qualified Properties) or share code with the body,
// but it can publish values — the gate is computed once here and read below // but it can publish values — the gate is computed once here and read below
// via `by extra`. // via the project's extra properties.
buildscript { buildscript {
val localProperties = File(rootDir, "local.properties") val localProperties = File(rootDir, "local.properties")
val sonarProperties by extra( val sonarProperties =
java.util.Properties().apply { java.util.Properties().apply {
if (localProperties.exists()) localProperties.inputStream().use { load(it) } if (localProperties.exists()) localProperties.inputStream().use { load(it) }
}, }
) extra.set("sonarProperties", sonarProperties)
val sonarEnabled by extra( val sonarEnabled =
sonarProperties.getProperty("sonar.host.url") != null && sonarProperties.getProperty("sonar.host.url") != null &&
gradle.startParameter.taskNames.any { it.substringAfterLast(":") in setOf("sonar", "sonarqube") }, gradle.startParameter.taskNames.any { it.substringAfterLast(":") in setOf("sonar", "sonarqube") }
) extra.set("sonarEnabled", sonarEnabled)
if (sonarEnabled) { if (sonarEnabled) {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
@@ -110,9 +110,9 @@ subprojects {
// `./gradlew sonar` behaves exactly like passing them via -Dsonar.xxx=... on the // `./gradlew sonar` behaves exactly like passing them via -Dsonar.xxx=... on the
// command line. sonar.projectKey/projectName default to the root project name // command line. sonar.projectKey/projectName default to the root project name
// ("Amethyst") and only need overriding in local.properties if desired. // ("Amethyst") and only need overriding in local.properties if desired.
val sonarEnabled: Boolean by extra val sonarEnabled = extra["sonarEnabled"] as Boolean
if (sonarEnabled) { if (sonarEnabled) {
val sonarProperties: Properties by extra val sonarProperties = extra["sonarProperties"] as Properties
apply(plugin = "org.sonarqube") apply(plugin = "org.sonarqube")
sonarProperties sonarProperties
+1 -1
View File
@@ -110,7 +110,7 @@ application {
// JVM decodes each one as ASCII (every byte > 0x7F → U+FFFD), and amy // JVM decodes each one as ASCII (every byte > 0x7F → U+FFFD), and amy
// then signs a kind:7 whose `content` is four replacement characters. // then signs a kind:7 whose `content` is four replacement characters.
// Whitenoise rejects it with "Invalid reaction content". // Whitenoise rejects it with "Invalid reaction content".
val patchAmyLauncherCharset by tasks.registering { val patchAmyLauncherCharset = tasks.register("patchAmyLauncherCharset") {
val appName = application.applicationName val appName = application.applicationName
val startScriptsTask = tasks.named("startScripts") val startScriptsTask = tasks.named("startScripts")
dependsOn(startScriptsTask) dependsOn(startScriptsTask)
+1 -1
View File
@@ -278,7 +278,7 @@ tasks.withType<Test>().configureEach {
// there. Commons gains this gate once FeedDefinitionSerializer.kt has been // there. Commons gains this gate once FeedDefinitionSerializer.kt has been
// migrated off Jackson; future commonMain code must not reintroduce JVM-only // migrated off Jackson; future commonMain code must not reintroduce JVM-only
// JSON / HTTP deps. // JSON / HTTP deps.
val verifyKmpPurity by tasks.registering { val verifyKmpPurity = tasks.register("verifyKmpPurity") {
group = "verification" group = "verification"
description = "Fails if iOS-targeted source sets import JVM-only deps." description = "Fails if iOS-targeted source sets import JVM-only deps."
val checkedDirs = val checkedDirs =
+3 -3
View File
@@ -254,7 +254,7 @@ compose.desktop {
// The arch is selected at task-execution time from the host JVM's os.arch, so // The arch is selected at task-execution time from the host JVM's os.arch, so
// the same task builds the correct AppImage on both x86_64 and aarch64 hosts. // the same task builds the correct AppImage on both x86_64 and aarch64 hosts.
// BUILDING.md documents local-dev fetch. // BUILDING.md documents local-dev fetch.
val createReleaseAppImage by tasks.registering(Exec::class) { val createReleaseAppImage = tasks.register<Exec>("createReleaseAppImage") {
group = "compose desktop" group = "compose desktop"
description = "Package createReleaseDistributable output into a Linux AppImage via appimagetool." description = "Package createReleaseDistributable output into a Linux AppImage via appimagetool."
dependsOn("createReleaseDistributable") dependsOn("createReleaseDistributable")
@@ -330,7 +330,7 @@ val createReleaseAppImage by tasks.registering(Exec::class) {
// proguarded jkeychain-1.1.0-*.jar with all 117 KB intact), so this task is // proguarded jkeychain-1.1.0-*.jar with all 117 KB intact), so this task is
// a regression guard, not a workaround. It's wired onto every release task so // a regression guard, not a workaround. It's wired onto every release task so
// it fails the build immediately if the .so disappears. // it fails the build immediately if the .so disappears.
val verifyJkeychainNativeSurvivesProguard by tasks.registering { val verifyJkeychainNativeSurvivesProguard = tasks.register("verifyJkeychainNativeSurvivesProguard") {
description = "Fail the release build if osxkeychain.so is stripped from proguarded output (would break macOS Keychain at runtime)" description = "Fail the release build if osxkeychain.so is stripped from proguarded output (would break macOS Keychain at runtime)"
group = "verification" group = "verification"
dependsOn("proguardReleaseJars") dependsOn("proguardReleaseJars")
@@ -395,7 +395,7 @@ listOf(
// into the .app) so the subsequent bundle signing seals already-signed code. // into the .app) so the subsequent bundle signing seals already-signed code.
// Runs only on macOS with the Developer ID identity exported — a no-op on every // Runs only on macOS with the Developer ID identity exported — a no-op on every
// other leg and on unsigned local/PR builds. // other leg and on unsigned local/PR builds.
val signMacJarNatives by tasks.registering { val signMacJarNatives = tasks.register("signMacJarNatives") {
description = "Codesign macOS Mach-O natives embedded in bundled jars before the .app is sealed + notarized" description = "Codesign macOS Mach-O natives embedded in bundled jars before the .app is sealed + notarized"
group = "build" group = "build"
dependsOn("proguardReleaseJars") dependsOn("proguardReleaseJars")
+1 -1
View File
@@ -22,7 +22,7 @@ kotlin {
// Generate a BuildConfig.kt carrying the app version from the catalog so // Generate a BuildConfig.kt carrying the app version from the catalog so
// RelayInfo.VERSION (reported over NIP-11) tracks releases automatically // RelayInfo.VERSION (reported over NIP-11) tracks releases automatically
// instead of being a hand-bumped literal. // instead of being a hand-bumped literal.
val generateVersionFile by tasks.registering { val generateVersionFile = tasks.register("generateVersionFile") {
val versionValue = libs.versions.app.get() val versionValue = libs.versions.app.get()
val outDir = layout.buildDirectory.dir("generated/version/kotlin") val outDir = layout.buildDirectory.dir("generated/version/kotlin")
inputs.property("version", versionValue) inputs.property("version", versionValue)
+6 -6
View File
@@ -154,7 +154,7 @@ val hangInteropCacheDir =
val moqRelayVersion = "0.10.25" val moqRelayVersion = "0.10.25"
val moqTokenCliVersion = "0.5.23" val moqTokenCliVersion = "0.5.23"
val interopInstallMoqRelay by tasks.registering(Exec::class) { val interopInstallMoqRelay = tasks.register<Exec>("interopInstallMoqRelay") {
description = "cargo install moq-relay $moqRelayVersion (interop)" description = "cargo install moq-relay $moqRelayVersion (interop)"
group = "interop" group = "interop"
commandLine( commandLine(
@@ -178,7 +178,7 @@ val interopInstallMoqRelay by tasks.registering(Exec::class) {
doFirst { hangInteropCacheDir.asFile.mkdirs() } doFirst { hangInteropCacheDir.asFile.mkdirs() }
} }
val interopInstallMoqTokenCli by tasks.registering(Exec::class) { val interopInstallMoqTokenCli = tasks.register<Exec>("interopInstallMoqTokenCli") {
description = "cargo install moq-token-cli $moqTokenCliVersion (interop)" description = "cargo install moq-token-cli $moqTokenCliVersion (interop)"
group = "interop" group = "interop"
commandLine( commandLine(
@@ -201,7 +201,7 @@ val interopInstallMoqTokenCli by tasks.registering(Exec::class) {
doFirst { hangInteropCacheDir.asFile.mkdirs() } doFirst { hangInteropCacheDir.asFile.mkdirs() }
} }
val interopBuildSidecars by tasks.registering(Exec::class) { val interopBuildSidecars = tasks.register<Exec>("interopBuildSidecars") {
description = "cargo build --release for nestsClient/tests/hang-interop sidecars" description = "cargo build --release for nestsClient/tests/hang-interop sidecars"
group = "interop" group = "interop"
workingDir = hangInteropDir.asFile workingDir = hangInteropDir.asFile
@@ -226,7 +226,7 @@ val interopBuildSidecars by tasks.registering(Exec::class) {
outputs.dir(hangInteropDir.dir("target/release")) outputs.dir(hangInteropDir.dir("target/release"))
} }
val interopBuildHangSidecars by tasks.registering { val interopBuildHangSidecars = tasks.register("interopBuildHangSidecars") {
description = "Build all hang-interop binaries (sidecars + moq-relay + moq-token)." description = "Build all hang-interop binaries (sidecars + moq-relay + moq-token)."
group = "interop" group = "interop"
dependsOn(interopBuildSidecars, interopInstallMoqRelay, interopInstallMoqTokenCli) dependsOn(interopBuildSidecars, interopInstallMoqRelay, interopInstallMoqTokenCli)
@@ -305,7 +305,7 @@ fun resolveBunBinary(): String {
fun resolveNpxBinary(): String = fun resolveNpxBinary(): String =
System.getenv("NPX_BIN") ?: System.getProperty("npxBin") ?: "npx" System.getenv("NPX_BIN") ?: System.getProperty("npxBin") ?: "npx"
val interopBuildBrowserHarness by tasks.registering(Exec::class) { val interopBuildBrowserHarness = tasks.register<Exec>("interopBuildBrowserHarness") {
description = "bun install && bun build for the browser interop harness" description = "bun install && bun build for the browser interop harness"
group = "interop" group = "interop"
workingDir = browserInteropDir.asFile workingDir = browserInteropDir.asFile
@@ -325,7 +325,7 @@ val interopBuildBrowserHarness by tasks.registering(Exec::class) {
outputs.dir(browserInteropDir.dir("dist")) outputs.dir(browserInteropDir.dir("dist"))
} }
val interopInstallPlaywrightChromium by tasks.registering(Exec::class) { val interopInstallPlaywrightChromium = tasks.register<Exec>("interopInstallPlaywrightChromium") {
description = "Install Playwright Chromium + dependencies for the browser interop harness" description = "Install Playwright Chromium + dependencies for the browser interop harness"
group = "interop" group = "interop"
workingDir = browserInteropDir.asFile workingDir = browserInteropDir.asFile
+9 -9
View File
@@ -304,11 +304,11 @@ kotlin {
dependsOn(appleMain) dependsOn(appleMain)
} }
val iosArm64Main by getting { getByName("iosArm64Main") {
dependsOn(iosMain.get()) dependsOn(iosMain.get())
} }
val iosSimulatorArm64Main by getting { getByName("iosSimulatorArm64Main") {
dependsOn(iosMain.get()) dependsOn(iosMain.get())
} }
@@ -316,11 +316,11 @@ kotlin {
dependsOn(appleTest) dependsOn(appleTest)
} }
val iosArm64Test by getting { getByName("iosArm64Test") {
dependsOn(iosTest.get()) dependsOn(iosTest.get())
} }
val iosSimulatorArm64Test by getting { getByName("iosSimulatorArm64Test") {
dependsOn(iosTest.get()) dependsOn(iosTest.get())
} }
@@ -334,11 +334,11 @@ kotlin {
dependsOn(appleTest) dependsOn(appleTest)
} }
val macosArm64Main by getting { getByName("macosArm64Main") {
dependsOn(macosMain) dependsOn(macosMain)
} }
val macosArm64Test by getting { getByName("macosArm64Test") {
dependsOn(macosTest) dependsOn(macosTest)
} }
@@ -355,11 +355,11 @@ kotlin {
dependsOn(nativeTest) dependsOn(nativeTest)
} }
val linuxX64Main by getting { getByName("linuxX64Main") {
dependsOn(linuxMain) dependsOn(linuxMain)
} }
val linuxX64Test by getting { getByName("linuxX64Test") {
dependsOn(linuxTest) dependsOn(linuxTest)
} }
} }
@@ -383,7 +383,7 @@ dependencies {
// Scope: source sets whose code is compiled for at least one non-JVM // Scope: source sets whose code is compiled for at least one non-JVM
// target. Excludes jvmAndroid, jvmMain, androidMain (and their tests), // target. Excludes jvmAndroid, jvmMain, androidMain (and their tests),
// where Jackson and OkHttp are legitimately used. // where Jackson and OkHttp are legitimately used.
val verifyKmpPurity by tasks.registering { val verifyKmpPurity = tasks.register("verifyKmpPurity") {
group = "verification" group = "verification"
description = "Fails if iOS-targeted source sets import JVM-only deps." description = "Fails if iOS-targeted source sets import JVM-only deps."
val checkedDirs = val checkedDirs =