Skip to content

Commit 028c00a

Browse files
vlsiclaude
andcommitted
build: replace deprecated Kotlin DSL property delegates
Gradle 9.6 deprecates all Kotlin DSL delegated-property extensions (`by creating`, `by registering`, `by project`); they are scheduled for removal in Gradle 10. Replace them with the explicit container API (`create(name)`, `register(name)`) and `findProperty` across the build scripts, the precompiled sign-base plugin, the examples, the sandbox, and the plugin smoke test. Closes #1207. Note for reviewers: building the project on Gradle 9.6 still emits one `by creating` warning, but it originates from the published `dev.sigstore:sigstore-gradle-sign-plugin:2.2.0` used to self-sign the build (build-logic/publishing/build.gradle.kts). It clears once that bootstrap dependency is bumped to a release containing this fix. The remaining `afterSuite`/`afterTest` warnings are pre-existing and unrelated to this change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
1 parent babafd9 commit 028c00a

11 files changed

Lines changed: 19 additions & 21 deletions

File tree

build-logic/jvm/src/main/kotlin/build-logic.build-info.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
java
55
}
66

7-
val generateBuildInfo by tasks.registering(BuildInfoTask::class) {
7+
val generateBuildInfo = tasks.register("generateBuildInfo", BuildInfoTask::class) {
88
version.set(project.version.toString())
99
genDir.set(project.layout.buildDirectory.dir("generated/buildinfo"))
1010
}

build-logic/jvm/src/main/kotlin/build-logic.dokka-javadoc.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ java {
1111
}
1212
}
1313

14-
val dokkaJar by tasks.registering(Jar::class) {
14+
val dokkaJar = tasks.register("dokkaJar", Jar::class) {
1515
group = LifecycleBasePlugin.BUILD_GROUP
1616
description = "Assembles a jar archive containing javadoc"
1717
from(tasks.dokkaGeneratePublicationJavadoc)

build-logic/publishing/src/main/kotlin/build-logic.depends-on-local-sigstore-java-repo.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ plugins {
77
java
88
}
99

10-
val sigstoreJavaRuntime by configurations.creating {
10+
val sigstoreJavaRuntime = configurations.create("sigstoreJavaRuntime") {
1111
description = "declares dependencies that will be useful for testing purposes"
1212
isCanBeConsumed = false
1313
isCanBeResolved = false
1414
}
1515

16-
val sigstoreJavaTestClasspath by configurations.creating {
16+
val sigstoreJavaTestClasspath = configurations.create("sigstoreJavaTestClasspath") {
1717
description = "sigstore-java in local repository for testing purposes"
1818
isCanBeConsumed = false
1919
isCanBeResolved = true

build-logic/publishing/src/main/kotlin/build-logic.depends-on-local-sigstore-maven-plugin-repo.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ plugins {
77
java
88
}
99

10-
val sigstoreMavenPluginRuntime by configurations.creating {
10+
val sigstoreMavenPluginRuntime = configurations.create("sigstoreMavenPluginRuntime") {
1111
description = "declares dependencies that will be useful for testing purposes"
1212
isCanBeConsumed = false
1313
isCanBeResolved = false
1414
}
1515

16-
val sigstoreMavenPluginTestClasspath by configurations.creating {
16+
val sigstoreMavenPluginTestClasspath = configurations.create("sigstoreMavenPluginTestClasspath") {
1717
description = "sigstore-maven-plugin in local repository for testing purposes"
1818
isCanBeConsumed = false
1919
isCanBeResolved = true

build-logic/publishing/src/main/kotlin/build-logic.publish-to-tmp-maven-repo.gradle.kts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import org.gradle.kotlin.dsl.registering
2-
31
plugins {
42
id("java-library")
53
id("maven-publish")
64
}
75

8-
val localRepoElements by configurations.creating {
6+
val localRepoElements = configurations.create("localRepoElements") {
97
isCanBeConsumed = true
108
isCanBeResolved = false
119
description =
@@ -31,7 +29,7 @@ localRepoElements.outgoing.artifact(localRepoDir) {
3129
builtBy(tasks.named("publishAllPublicationsToTmp-mavenRepository"))
3230
}
3331

34-
val cleanLocalRepository by tasks.registering(Delete::class) {
32+
val cleanLocalRepository = tasks.register("cleanLocalRepository", Delete::class) {
3533
description = "Clears local-maven-repo so timestamp-based snapshot artifacts do not consume space"
3634
delete(localRepoDir)
3735
}

build-logic/publishing/src/main/kotlin/build-logic.signing.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ plugins {
44
}
55

66
signing {
7-
val signingKey: String? by project
8-
val signingPassword: String? by project
7+
val signingKey = project.findProperty("signingKey") as String?
8+
val signingPassword = project.findProperty("signingPassword") as String?
99
useInMemoryPgpKeys(signingKey, signingPassword)
1010
}
1111

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ allprojects {
1414
version = calculatedVersion
1515
}
1616

17-
val parameters by tasks.registering {
17+
val parameters = tasks.register("parameters") {
1818
group = HelpTasksPlugin.HELP_GROUP
1919
description = "Displays build parameters (i.e. -P flags) that can be used to customize the build"
2020
dependsOn(gradle.includedBuild("build-logic").task(":build-parameters:parameters"))

examples/hello-world/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ publishing {
3333

3434
// PGP signing setup for the purposes of this example.
3535
signing {
36-
val signingKey: String? by project
37-
val signingPassword: String? by project
36+
val signingKey = project.findProperty("signingKey") as String?
37+
val signingPassword = project.findProperty("signingPassword") as String?
3838
useInMemoryPgpKeys(signingKey, signingPassword)
3939
sign(publishing.publications["maven"])
4040
}

sandbox/gradle-sign-file/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ dependencies {
1818
// sigstoreClientClasspath("dev.sigstore:sigstore-java:0.1.0")
1919
}
2020

21-
val hello by tasks.registering(WriteProperties::class) {
21+
val hello = tasks.register("hello", WriteProperties::class) {
2222
group = LifecycleBasePlugin.BUILD_GROUP
2323
description = "Generates a sample $name.properties file to sign"
2424
destinationFile.set(layout.buildDirectory.file("props/$name.properties"))
2525
property("hello", "world")
2626
}
2727

28-
val signFile by tasks.registering(SigstoreSignFilesTask::class) {
28+
val signFile = tasks.register("signFile", SigstoreSignFilesTask::class) {
2929
group = LifecycleBasePlugin.BUILD_GROUP
3030
description = "Signs file via Sigstore"
3131
signFile(hello.map { it.destinationFile.get().asFile })

sigstore-gradle/sigstore-gradle-sign-base-plugin/src/main/kotlin/dev.sigstore.sign-base.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ gradle.sharedServices.registerIfAbsent(SigstoreSigningService.SERVICE_NAME, Sigs
3030
}
3131
}
3232

33-
val sigstoreClient by configurations.creating {
33+
val sigstoreClient = configurations.create("sigstoreClient") {
3434
description = "Declares sigstore client dependencies"
3535
isCanBeResolved = false
3636
isCanBeConsumed = false
@@ -41,7 +41,7 @@ val sigstoreClient by configurations.creating {
4141
}
4242
}
4343

44-
val sigstoreClientClasspath by configurations.creating {
44+
val sigstoreClientClasspath = configurations.create("sigstoreClientClasspath") {
4545
description = "Resolves Sigstore dependencies"
4646
isCanBeResolved = true
4747
isCanBeConsumed = false

0 commit comments

Comments
 (0)