From f9e3225c0c07eb10b596fdb0a30aa619909f93f6 Mon Sep 17 00:00:00 2001 From: Thomas Tresansky Date: Thu, 17 Nov 2022 09:31:23 -0500 Subject: [PATCH 1/9] Add upgrade note for project -> project() change in test suite dependencies block --- .../userguide/jvm/jvm_test_suite_plugin.adoc | 1 + .../migration/upgrading_version_7.adoc | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc b/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc index 2b6d8a907d94..d659832393d5 100644 --- a/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc +++ b/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc @@ -95,6 +95,7 @@ Common values are available as constants in link:{javadocPath}/org/gradle/api/at Here are several examples to illustrate the configurability of test suites. +[[sec:declare_an_additional_test_suite]] == Declare an additional test suite ==== include::sample[dir="snippets/testing/test-suite-plugin/groovy",files="build.gradle[tags=configure-testing-extension]"] diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index ce09e6db989c..f07d472d47dc 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -117,6 +117,56 @@ PMD has been updated to https://pmd.github.io/pmd-6.48.0/pmd_release_notes.html[ When configuring an executable explicitly for link:{groovyDslPath}/org.gradle.api.tasks.compile.ForkOptions.html#org.gradle.api.tasks.compile.ForkOptions:executable[`JavaCompile`] or link:{groovyDslPath}/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:executable[`Test`] tasks, Gradle will now emit an error if this executable does not exist. In the past, the task would be executed with the default toolchain or JVM running the build. +==== Strongly typed dependency declarations for Test Suites + +The `dependencies` block used to configure Test Suites and located at `testing.suites..dependencies` continues to diverge from the top-level `dependencies` block. +This is part of an ongoing effort to improve this `@Incubating` API to make it more discoverable and strongly typed. +This change should have the benefit of making the `testing` DSL easier to work with in your IDE. + +On consequence of this is that buildsscripts which previously added project dependencies to a suite using: + +```kotlin +testing { + suites { + register("integrationTest") { + dependencies { + implementation(project) + } + } + } +} +``` + +will now fail to compile, with a message like: + +``` +None of the following functions can be called with the arguments supplied: +public operator fun DependencyAdder.invoke(dependencyNotation: CharSequence): Unit defined in org.gradle.kotlin.dsl +public operator fun DependencyAdder.invoke(dependency: Dependency): Unit defined in org.gradle.kotlin.dsl +public operator fun DependencyAdder.invoke(files: FileCollection): Unit defined in org.gradle.kotlin.dsl +public operator fun DependencyAdder.invoke(dependency: Provider): Unit defined in org.gradle.kotlin.dsl +public operator fun DependencyAdder.invoke(externalModule: ProviderConvertible): Unit defined in org.gradle.kotlin.dsl +``` + +To fix this, replace the reference to `project` with a call to `project()`: + +```kotlin +testing { + suites { + register("integrationTest") { + dependencies { + implementation(project()) + } + } + } +} +``` + +There may be other breaking changes related to dependency declarations in this block. +For more information, see the updated <> example in the JVM Test Suite Plugin section of the user guide, and the link:{groovyDslPath}/org.gradle.api.artifacts.dsl.DependencyAdder.html[`DependencyAdder`] page in the DSL reference. + +```kotlin + === Deprecations [[invalid_toolchain_specification_deprecation]] From f8d87f8b1ade1c769e2a532f28b1b93540e19dc1 Mon Sep 17 00:00:00 2001 From: Thomas Tresansky Date: Thu, 17 Nov 2022 10:42:23 -0500 Subject: [PATCH 2/9] Slight formatting changes --- .../docs/src/docs/userguide/migration/upgrading_version_7.adoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index f07d472d47dc..68c7938923b2 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -163,9 +163,8 @@ testing { ``` There may be other breaking changes related to dependency declarations in this block. -For more information, see the updated <> example in the JVM Test Suite Plugin section of the user guide, and the link:{groovyDslPath}/org.gradle.api.artifacts.dsl.DependencyAdder.html[`DependencyAdder`] page in the DSL reference. -```kotlin +For more information, see the updated <> example in the JVM Test Suite Plugin section of the user guide, and the link:{groovyDslPath}/org.gradle.api.artifacts.dsl.DependencyAdder.html[`DependencyAdder`] page in the DSL reference. === Deprecations From a5e772bb19e2bcbee386d62ab476b674c119b89b Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Thu, 17 Nov 2022 13:19:02 -0500 Subject: [PATCH 3/9] Update subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc Co-authored-by: nate contino --- .../docs/userguide/migration/upgrading_version_7.adoc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index 68c7938923b2..fe49f9a8908c 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -117,13 +117,11 @@ PMD has been updated to https://pmd.github.io/pmd-6.48.0/pmd_release_notes.html[ When configuring an executable explicitly for link:{groovyDslPath}/org.gradle.api.tasks.compile.ForkOptions.html#org.gradle.api.tasks.compile.ForkOptions:executable[`JavaCompile`] or link:{groovyDslPath}/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:executable[`Test`] tasks, Gradle will now emit an error if this executable does not exist. In the past, the task would be executed with the default toolchain or JVM running the build. -==== Strongly typed dependency declarations for Test Suites +==== Added strongly typed dependency declarations to test suites -The `dependencies` block used to configure Test Suites and located at `testing.suites..dependencies` continues to diverge from the top-level `dependencies` block. -This is part of an ongoing effort to improve this `@Incubating` API to make it more discoverable and strongly typed. -This change should have the benefit of making the `testing` DSL easier to work with in your IDE. - -On consequence of this is that buildsscripts which previously added project dependencies to a suite using: +As part of the ongoing effort to improve the incubating Test Suites `dependencies` block, dependency declarations are now strongly typed. +In some case, this requires syntax changes. +For example, build scripts that previously added test suite dependencies with the following syntax: ```kotlin testing { From 6032175ea4fdfb5754d44921dbdb9b023f437f40 Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Thu, 17 Nov 2022 13:19:57 -0500 Subject: [PATCH 4/9] Update subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc Co-authored-by: nate contino --- .../docs/src/docs/userguide/migration/upgrading_version_7.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index fe49f9a8908c..681e04134387 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -162,7 +162,7 @@ testing { There may be other breaking changes related to dependency declarations in this block. -For more information, see the updated <> example in the JVM Test Suite Plugin section of the user guide, and the link:{groovyDslPath}/org.gradle.api.artifacts.dsl.DependencyAdder.html[`DependencyAdder`] page in the DSL reference. +For more information, see the updated <> example in the JVM Test Suite Plugin section of the user guide and the link:{groovyDslPath}/org.gradle.api.artifacts.dsl.DependencyAdder.html[`DependencyAdder`] page in the DSL reference. === Deprecations From 29aeab23ab0800bbe0c5e7fc8bd91da9c940f248 Mon Sep 17 00:00:00 2001 From: Thomas Tresansky Date: Thu, 17 Nov 2022 13:30:54 -0500 Subject: [PATCH 5/9] Various rewording changes as suggested by reviewers --- .../docs/userguide/jvm/jvm_test_suite_plugin.adoc | 1 + .../userguide/migration/upgrading_version_7.adoc | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc b/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc index d659832393d5..41d481dfd5b5 100644 --- a/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc +++ b/subprojects/docs/src/docs/userguide/jvm/jvm_test_suite_plugin.adoc @@ -222,6 +222,7 @@ include::sample[dir="snippets/testing/test-suite-multi-configure-each-extracted/ <2> Apply the closure to a test suite, using the default (`test`) test suite <3> Alternate means of applying a configuration closure to a test suite outside of its declaration, using the `integrationTest` test suite +[[sec:differences_with_top_level_dependencies]] == Differences between the test suite `dependencies` and the top-level `dependencies` blocks Gradle 7.6 changed the API of the test suite's `dependencies` block to be more strongly-typed. diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index 681e04134387..28e8b9be0c4c 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -117,11 +117,13 @@ PMD has been updated to https://pmd.github.io/pmd-6.48.0/pmd_release_notes.html[ When configuring an executable explicitly for link:{groovyDslPath}/org.gradle.api.tasks.compile.ForkOptions.html#org.gradle.api.tasks.compile.ForkOptions:executable[`JavaCompile`] or link:{groovyDslPath}/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:executable[`Test`] tasks, Gradle will now emit an error if this executable does not exist. In the past, the task would be executed with the default toolchain or JVM running the build. -==== Added strongly typed dependency declarations to test suites +==== Changes to dependency declarateions in Test Suites + +As part of the ongoing effort to improve Test Suites, dependency declarations using its nested `dependencies` block are <>. +This will help make this incubating API more discoverable and easier to use in an IDE. -As part of the ongoing effort to improve the incubating Test Suites `dependencies` block, dependency declarations are now strongly typed. In some case, this requires syntax changes. -For example, build scripts that previously added test suite dependencies with the following syntax: +For example, build scripts that previously added Test Suite dependencies with the following syntax: ```kotlin testing { @@ -160,7 +162,11 @@ testing { } ``` -There may be other breaking changes related to dependency declarations in this block. +There are other related changes, such as: + +- You cannot use `Provider` as a dependency declaration. +- You cannot use a `Map` as a dependency declaration for Kotlin or Java. +- You cannot use a bundle as a dependency declaration directly (`implementation(libs.bundles.testing)`), instead you have to use `implementation.bundle(libs.bundles.testing)`. For more information, see the updated <> example in the JVM Test Suite Plugin section of the user guide and the link:{groovyDslPath}/org.gradle.api.artifacts.dsl.DependencyAdder.html[`DependencyAdder`] page in the DSL reference. From 0df577d2ce53b5a4cc6d7e0f8b04e16d10fb9727 Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Thu, 17 Nov 2022 13:57:35 -0500 Subject: [PATCH 6/9] Update subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc Co-authored-by: nate contino --- .../docs/src/docs/userguide/migration/upgrading_version_7.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index 28e8b9be0c4c..1baecdda5b2c 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -122,7 +122,7 @@ In the past, the task would be executed with the default toolchain or JVM runnin As part of the ongoing effort to improve Test Suites, dependency declarations using its nested `dependencies` block are <>. This will help make this incubating API more discoverable and easier to use in an IDE. -In some case, this requires syntax changes. +In some cases, this requires syntax changes. For example, build scripts that previously added Test Suite dependencies with the following syntax: ```kotlin From 716906de4aba4f028995642ce5b1f7bb73efb410 Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Thu, 17 Nov 2022 13:58:21 -0500 Subject: [PATCH 7/9] Update subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc Co-authored-by: nate contino --- .../docs/src/docs/userguide/migration/upgrading_version_7.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index 1baecdda5b2c..d25033eace3c 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -162,7 +162,7 @@ testing { } ``` -There are other related changes, such as: +Other syntax effected by this change includes: - You cannot use `Provider` as a dependency declaration. - You cannot use a `Map` as a dependency declaration for Kotlin or Java. From 10302c427e7e8d91983d04500e506d72fb4d8737 Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Thu, 17 Nov 2022 13:58:31 -0500 Subject: [PATCH 8/9] Update subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc Co-authored-by: nate contino --- .../docs/src/docs/userguide/migration/upgrading_version_7.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index d25033eace3c..1349e2891c83 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -166,7 +166,7 @@ Other syntax effected by this change includes: - You cannot use `Provider` as a dependency declaration. - You cannot use a `Map` as a dependency declaration for Kotlin or Java. -- You cannot use a bundle as a dependency declaration directly (`implementation(libs.bundles.testing)`), instead you have to use `implementation.bundle(libs.bundles.testing)`. +- You cannot use a bundle as a dependency declaration directly (`implementation(libs.bundles.testing)`). Use `implementation.bundle(libs.bundles.testing)` instead. For more information, see the updated <> example in the JVM Test Suite Plugin section of the user guide and the link:{groovyDslPath}/org.gradle.api.artifacts.dsl.DependencyAdder.html[`DependencyAdder`] page in the DSL reference. From d14cc44c38c2ff20be9d42596a741a90aa495d36 Mon Sep 17 00:00:00 2001 From: Thomas Tresansky Date: Thu, 17 Nov 2022 14:16:13 -0500 Subject: [PATCH 9/9] Correct typo, phrasing --- .../src/docs/userguide/migration/upgrading_version_7.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc index 1349e2891c83..2d90feea08ee 100644 --- a/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc +++ b/subprojects/docs/src/docs/userguide/migration/upgrading_version_7.adoc @@ -117,9 +117,9 @@ PMD has been updated to https://pmd.github.io/pmd-6.48.0/pmd_release_notes.html[ When configuring an executable explicitly for link:{groovyDslPath}/org.gradle.api.tasks.compile.ForkOptions.html#org.gradle.api.tasks.compile.ForkOptions:executable[`JavaCompile`] or link:{groovyDslPath}/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:executable[`Test`] tasks, Gradle will now emit an error if this executable does not exist. In the past, the task would be executed with the default toolchain or JVM running the build. -==== Changes to dependency declarateions in Test Suites +==== Changes to dependency declarations in Test Suites -As part of the ongoing effort to improve Test Suites, dependency declarations using its nested `dependencies` block are <>. +As part of the ongoing effort to evolve Test Suites, dependency declarations in the Test Suites `dependencies` block are <>. This will help make this incubating API more discoverable and easier to use in an IDE. In some cases, this requires syntax changes.