From 6e3af61e6a321347d62246e2b9aaaa70f3badeab Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 12 Sep 2026 17:50:14 +0000 Subject: [PATCH] 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("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 Claude-Session: https://claude.ai/code/session_0123kXtseu4X18hL3GMDcdER --- build.gradle.kts | 18 +++++++++--------- cli/build.gradle.kts | 2 +- commons/build.gradle.kts | 2 +- desktopApp/build.gradle.kts | 6 +++--- geode/build.gradle.kts | 2 +- nestsClient/build.gradle.kts | 12 ++++++------ quartz/build.gradle.kts | 18 +++++++++--------- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6b87fbd049..d3ea321ee8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,18 +9,18 @@ import java.util.Properties // 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, // but it can publish values — the gate is computed once here and read below -// via `by extra`. +// via the project's extra properties. buildscript { val localProperties = File(rootDir, "local.properties") - val sonarProperties by extra( + val sonarProperties = java.util.Properties().apply { if (localProperties.exists()) localProperties.inputStream().use { load(it) } - }, - ) - val sonarEnabled by extra( + } + extra.set("sonarProperties", sonarProperties) + val sonarEnabled = 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) { repositories { gradlePluginPortal() @@ -110,9 +110,9 @@ subprojects { // `./gradlew sonar` behaves exactly like passing them via -Dsonar.xxx=... on the // command line. sonar.projectKey/projectName default to the root project name // ("Amethyst") and only need overriding in local.properties if desired. -val sonarEnabled: Boolean by extra +val sonarEnabled = extra["sonarEnabled"] as Boolean if (sonarEnabled) { - val sonarProperties: Properties by extra + val sonarProperties = extra["sonarProperties"] as Properties apply(plugin = "org.sonarqube") sonarProperties diff --git a/cli/build.gradle.kts b/cli/build.gradle.kts index cd33bc9080..52ed74887e 100644 --- a/cli/build.gradle.kts +++ b/cli/build.gradle.kts @@ -110,7 +110,7 @@ application { // JVM decodes each one as ASCII (every byte > 0x7F → U+FFFD), and amy // then signs a kind:7 whose `content` is four replacement characters. // Whitenoise rejects it with "Invalid reaction content". -val patchAmyLauncherCharset by tasks.registering { +val patchAmyLauncherCharset = tasks.register("patchAmyLauncherCharset") { val appName = application.applicationName val startScriptsTask = tasks.named("startScripts") dependsOn(startScriptsTask) diff --git a/commons/build.gradle.kts b/commons/build.gradle.kts index 50437bf088..5e2b80f12b 100644 --- a/commons/build.gradle.kts +++ b/commons/build.gradle.kts @@ -278,7 +278,7 @@ tasks.withType().configureEach { // there. Commons gains this gate once FeedDefinitionSerializer.kt has been // migrated off Jackson; future commonMain code must not reintroduce JVM-only // JSON / HTTP deps. -val verifyKmpPurity by tasks.registering { +val verifyKmpPurity = tasks.register("verifyKmpPurity") { group = "verification" description = "Fails if iOS-targeted source sets import JVM-only deps." val checkedDirs = diff --git a/desktopApp/build.gradle.kts b/desktopApp/build.gradle.kts index 7e3fea51fb..82b40e25b2 100644 --- a/desktopApp/build.gradle.kts +++ b/desktopApp/build.gradle.kts @@ -254,7 +254,7 @@ compose.desktop { // 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. // BUILDING.md documents local-dev fetch. -val createReleaseAppImage by tasks.registering(Exec::class) { +val createReleaseAppImage = tasks.register("createReleaseAppImage") { group = "compose desktop" description = "Package createReleaseDistributable output into a Linux AppImage via appimagetool." 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 // a regression guard, not a workaround. It's wired onto every release task so // 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)" group = "verification" dependsOn("proguardReleaseJars") @@ -395,7 +395,7 @@ listOf( // 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 // 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" group = "build" dependsOn("proguardReleaseJars") diff --git a/geode/build.gradle.kts b/geode/build.gradle.kts index 2c8efa600f..6870826151 100644 --- a/geode/build.gradle.kts +++ b/geode/build.gradle.kts @@ -22,7 +22,7 @@ kotlin { // Generate a BuildConfig.kt carrying the app version from the catalog so // RelayInfo.VERSION (reported over NIP-11) tracks releases automatically // instead of being a hand-bumped literal. -val generateVersionFile by tasks.registering { +val generateVersionFile = tasks.register("generateVersionFile") { val versionValue = libs.versions.app.get() val outDir = layout.buildDirectory.dir("generated/version/kotlin") inputs.property("version", versionValue) diff --git a/nestsClient/build.gradle.kts b/nestsClient/build.gradle.kts index 15e463a301..f14d312308 100644 --- a/nestsClient/build.gradle.kts +++ b/nestsClient/build.gradle.kts @@ -154,7 +154,7 @@ val hangInteropCacheDir = val moqRelayVersion = "0.10.25" val moqTokenCliVersion = "0.5.23" -val interopInstallMoqRelay by tasks.registering(Exec::class) { +val interopInstallMoqRelay = tasks.register("interopInstallMoqRelay") { description = "cargo install moq-relay $moqRelayVersion (interop)" group = "interop" commandLine( @@ -178,7 +178,7 @@ val interopInstallMoqRelay by tasks.registering(Exec::class) { doFirst { hangInteropCacheDir.asFile.mkdirs() } } -val interopInstallMoqTokenCli by tasks.registering(Exec::class) { +val interopInstallMoqTokenCli = tasks.register("interopInstallMoqTokenCli") { description = "cargo install moq-token-cli $moqTokenCliVersion (interop)" group = "interop" commandLine( @@ -201,7 +201,7 @@ val interopInstallMoqTokenCli by tasks.registering(Exec::class) { doFirst { hangInteropCacheDir.asFile.mkdirs() } } -val interopBuildSidecars by tasks.registering(Exec::class) { +val interopBuildSidecars = tasks.register("interopBuildSidecars") { description = "cargo build --release for nestsClient/tests/hang-interop sidecars" group = "interop" workingDir = hangInteropDir.asFile @@ -226,7 +226,7 @@ val interopBuildSidecars by tasks.registering(Exec::class) { 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)." group = "interop" dependsOn(interopBuildSidecars, interopInstallMoqRelay, interopInstallMoqTokenCli) @@ -305,7 +305,7 @@ fun resolveBunBinary(): String { fun resolveNpxBinary(): String = System.getenv("NPX_BIN") ?: System.getProperty("npxBin") ?: "npx" -val interopBuildBrowserHarness by tasks.registering(Exec::class) { +val interopBuildBrowserHarness = tasks.register("interopBuildBrowserHarness") { description = "bun install && bun build for the browser interop harness" group = "interop" workingDir = browserInteropDir.asFile @@ -325,7 +325,7 @@ val interopBuildBrowserHarness by tasks.registering(Exec::class) { outputs.dir(browserInteropDir.dir("dist")) } -val interopInstallPlaywrightChromium by tasks.registering(Exec::class) { +val interopInstallPlaywrightChromium = tasks.register("interopInstallPlaywrightChromium") { description = "Install Playwright Chromium + dependencies for the browser interop harness" group = "interop" workingDir = browserInteropDir.asFile diff --git a/quartz/build.gradle.kts b/quartz/build.gradle.kts index 9253f2c607..e3f46e609b 100644 --- a/quartz/build.gradle.kts +++ b/quartz/build.gradle.kts @@ -304,11 +304,11 @@ kotlin { dependsOn(appleMain) } - val iosArm64Main by getting { + getByName("iosArm64Main") { dependsOn(iosMain.get()) } - val iosSimulatorArm64Main by getting { + getByName("iosSimulatorArm64Main") { dependsOn(iosMain.get()) } @@ -316,11 +316,11 @@ kotlin { dependsOn(appleTest) } - val iosArm64Test by getting { + getByName("iosArm64Test") { dependsOn(iosTest.get()) } - val iosSimulatorArm64Test by getting { + getByName("iosSimulatorArm64Test") { dependsOn(iosTest.get()) } @@ -334,11 +334,11 @@ kotlin { dependsOn(appleTest) } - val macosArm64Main by getting { + getByName("macosArm64Main") { dependsOn(macosMain) } - val macosArm64Test by getting { + getByName("macosArm64Test") { dependsOn(macosTest) } @@ -355,11 +355,11 @@ kotlin { dependsOn(nativeTest) } - val linuxX64Main by getting { + getByName("linuxX64Main") { dependsOn(linuxMain) } - val linuxX64Test by getting { + getByName("linuxX64Test") { dependsOn(linuxTest) } } @@ -383,7 +383,7 @@ dependencies { // Scope: source sets whose code is compiled for at least one non-JVM // target. Excludes jvmAndroid, jvmMain, androidMain (and their tests), // where Jackson and OkHttp are legitimately used. -val verifyKmpPurity by tasks.registering { +val verifyKmpPurity = tasks.register("verifyKmpPurity") { group = "verification" description = "Fails if iOS-targeted source sets import JVM-only deps." val checkedDirs =