mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-09-14 00:55:08 +00:00
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:
+9
-9
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -278,7 +278,7 @@ tasks.withType<Test>().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 =
|
||||
|
||||
@@ -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<Exec>("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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Exec>("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<Exec>("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<Exec>("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<Exec>("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<Exec>("interopInstallPlaywrightChromium") {
|
||||
description = "Install Playwright Chromium + dependencies for the browser interop harness"
|
||||
group = "interop"
|
||||
workingDir = browserInteropDir.asFile
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user