diff --git a/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db b/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db index a76925e4c6b1..791e78a6f7d6 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db +++ b/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db @@ -5,7 +5,7 @@ Method has arguments/return t Method has arguments/return type org.gradle.internal.Factory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ExclusiveContentRepository.java:0) Method has arguments/return type org.gradle.internal.metaobject.DynamicObject that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Convention.java:0) Method has arguments/return type org.gradle.api.internal.project.ProjectInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (JavaPluginConvention.java:0) -Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Checkstyle.java:123) +Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Checkstyle.java:122) Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (CodeNarc.java:127) Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Pmd.java:117) Method has arguments/return type org.gradle.api.internal.attributes.ImmutableAttributes that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GenerateMavenPom.java:65) @@ -25,12 +25,12 @@ Method has a Method has arguments/return type org.gradle.api.tasks.diagnostics.internal.PropertyReportRenderer that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PropertyReportTask.java:67) Method has arguments/return type org.gradle.api.tasks.diagnostics.internal.ReportRenderer that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (TaskReportTask.java:69) Method has arguments/return type org.gradle.api.tasks.diagnostics.internal.TaskReportRenderer that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (TaskReportTask.java:76) -Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:199) -Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:208) +Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:198) +Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:207) Method has arguments/return type org.gradle.language.base.internal.compile.Compiler that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ScalaCompile.java:123) -Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:915) -Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:910) -Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:919) +Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:916) +Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:911) +Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:920) Method has arguments/return type org.gradle.buildinit.plugins.internal.ProjectLayoutSetupRegistry that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (InitBuild.java:177) Method has arguments/return type org.gradle.external.javadoc.internal.JavadocOptionFileWriterContext that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (OptionLessJavadocOptionFileOption.java:0) Method has arguments/return type org.gradle.internal.operations.logging.BuildOperationLoggerFactory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Assemble.java:85) @@ -67,7 +67,7 @@ Method h Method has arguments/return type org.bouncycastle.openpgp.PGPSignatureGenerator that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PgpSignatory.java:106) Method has arguments/return type org.bouncycastle.openpgp.PGPSecretKey that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PgpSignatoryFactory.java:73) Method has arguments/return type org.bouncycastle.openpgp.PGPSecretKey that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PgpSignatoryFactory.java:121) -Method has arguments/return type org.gradle.internal.Pair that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (CollectionUtils.java:590) -Method has arguments/return type org.gradle.internal.metaobject.ConfigureDelegate that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ConfigureUtil.java:179) -Method has arguments/return type java.util.zip.Checksum that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GFileUtils.java:279) -Method has arguments/return type org.gradle.internal.Factory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GUtil.java:176) \ No newline at end of file +Method has arguments/return type org.gradle.internal.Pair that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (CollectionUtils.java:656) +Method has arguments/return type org.gradle.internal.metaobject.ConfigureDelegate that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ConfigureUtil.java:192) +Method has arguments/return type java.util.zip.Checksum that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GFileUtils.java:329) +Method has arguments/return type org.gradle.internal.Factory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GUtil.java:195) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt b/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt index d2217938e9a6..f9d38014a412 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt @@ -1,8 +1,8 @@ Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AntlrTask.java:181) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AntlrTask.java:298) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:246) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:261) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:238) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:244) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:259) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:236) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:192) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:209) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:104) @@ -19,12 +19,12 @@ Method does not ha Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:114) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:389) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:358) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaCompile.java:403) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaCompile.java:405) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaCompile.java:120) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (DependencyInsightReportTask.java:201) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:187) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:170) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:143) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (DependencyInsightReportTask.java:200) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:186) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:169) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:142) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Javadoc.java:336) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Javadoc.java:229) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaCompile.java:70) @@ -33,11 +33,11 @@ Method does not hav Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaDoc.java:151) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaDoc.java:163) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaDoc.java:113) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:355) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:1124) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:823) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:356) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:1108) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:824) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GenerateXcodeWorkspaceFileTask.java:60) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CreateStartScripts.java:320) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AbstractScalaCompile.java:280) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AbstractScalaCompile.java:279) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (InstallExecutable.java:164) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JacocoBase.java:36) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt b/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt index 114b7948e5ba..c99933f03262 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt @@ -5,15 +5,15 @@ Method does not have raw retu Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntlrTask.java:95) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntlrTask.java:107) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntlrTask.java:119) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:100) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:297) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:338) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:368) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:390) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:328) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:63) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:348) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:410) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:99) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:295) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:336) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:366) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:388) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:326) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:62) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:346) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:408) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:95) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:299) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:245) @@ -137,8 +137,8 @@ Method d Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCompile.java:164) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GroovyCompile.java:369) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GroovyCompile.java:379) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:386) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:396) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:388) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:398) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractConfigurationReportTask.java:51) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractConfigurationReportTask.java:73) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractDependencyReportTask.java:111) @@ -148,24 +148,24 @@ Method doe Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractReportTask.java:140) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ConventionReportTask.java:88) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ConventionReportTask.java:109) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:167) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:233) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:166) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:232) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (DependencyReportTask.java:30) Method does not have raw return type assignable to org.gradle.api.provider.Property in (PropertyReportTask.java:63) Method does not have raw return type assignable to org.gradle.api.provider.Property in (TaskReportTask.java:114) Method does not have raw return type assignable to org.gradle.api.provider.Property in (TaskReportTask.java:142) Method does not have raw return type assignable to org.gradle.api.provider.Property in (TaskReportTask.java:69) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (TaskReportTask.java:92) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:199) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:153) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:282) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:320) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:301) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:443) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:263) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:231) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:246) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:216) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:198) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:152) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:281) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:319) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:300) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:400) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:262) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:230) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:245) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:215) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:251) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:416) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:276) @@ -185,29 +185,30 @@ Method does Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:102) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:571) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:368) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:547) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:494) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:512) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:388) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:478) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:572) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:887) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:288) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:539) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1160) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:864) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:279) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:428) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:436) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:412) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1194) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:380) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:632) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:958) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:321) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:915) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:243) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1137) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:548) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:495) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:513) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:389) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:479) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:573) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:888) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:289) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:540) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1144) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:865) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:280) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:429) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:437) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:413) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1178) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:381) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:633) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:934) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:971) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:322) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:916) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:244) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1121) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Wrapper.java:426) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Wrapper.java:409) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Wrapper.java:309) @@ -244,7 +245,7 @@ Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateSolutionFileTask.java:57) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateSchemeFileTask.java:128) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateSchemeFileTask.java:51) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateXcodeProjectFileTask.java:317) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateXcodeProjectFileTask.java:319) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateXcodeWorkspaceFileTask.java:69) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CreateStartScripts.java:298) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CreateStartScripts.java:285) diff --git a/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt b/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt index 419a2a67dd16..821301e4b0f5 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt @@ -1,4 +1,4 @@ -Method has raw return type org.gradle.api.resources.TextResource in (Checkstyle.java:278) +Method has raw return type org.gradle.api.resources.TextResource in (Checkstyle.java:276) Method has raw return type org.gradle.api.resources.TextResource in (CodeNarc.java:228) Method has raw return type org.gradle.api.resources.TextResource in (Pmd.java:304) -Method has raw return type org.gradle.api.resources.TextResource in (Groovydoc.java:339) \ No newline at end of file +Method has raw return type org.gradle.api.resources.TextResource in (Groovydoc.java:338) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt index 57c52d54020c..26273057a702 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt @@ -1,4 +1,4 @@ -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (PmdExtension.java:185) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (PmdExtension.java:184) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceSet.java:0) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceSet.java:0) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceSet.java:0) diff --git a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt index ab035b3b2072..19dc4408f766 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt @@ -189,9 +189,9 @@ Method doe Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeQualityExtension.java:51) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeQualityExtension.java:37) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeQualityExtension.java:67) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:64) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:95) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:217) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:63) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:94) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:216) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IvyArtifact.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IvyArtifact.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IvyArtifact.java:0) @@ -352,11 +352,11 @@ Method does no Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractBuildCache.java:49) Method does not have raw return type assignable to org.gradle.api.provider.Property in (BuildCache.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (BuildCache.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HttpBuildCache.java:98) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:70) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:155) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:124) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:196) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HttpBuildCache.java:97) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:69) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:154) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:123) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:193) Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCacheCredentials.java:61) Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCacheCredentials.java:40) Method does not have raw return type assignable to org.gradle.api.provider.Property in (DirectoryBuildCache.java:38) @@ -636,8 +636,8 @@ Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpComponent.java:290) Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpComponent.java:219) Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpComponent.java:206) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpFacet.java:129) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (EclipseWtpFacet.java:94) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpFacet.java:131) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (EclipseWtpFacet.java:96) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Facet.java:77) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Facet.java:69) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Facet.java:85) @@ -858,7 +858,7 @@ Method does not have raw return type assignable to org.gradle.api.provider.Provider in (UnexpectedBuildResultException.java:40) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ListenerFailedException.java:39) Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseRuntime.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ConfigureUtil.java:121) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ConfigureUtil.java:130) Method does not have raw return type assignable to org.gradle.api.provider.Property in (VersionControlRepository.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (VersionControlSpec.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (VersionControlSpec.java:0) diff --git a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt index 0eec6a286d0d..6a9edcc0e25e 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt @@ -1,5 +1,5 @@ Method has raw return type org.gradle.api.resources.TextResource in (CheckstyleExtension.java:67) Method has raw return type org.gradle.api.resources.TextResource in (CodeNarcExtension.java:53) -Method has raw return type org.gradle.api.resources.TextResource in (PmdExtension.java:158) +Method has raw return type org.gradle.api.resources.TextResource in (PmdExtension.java:157) Method has raw return type org.gradle.api.resources.TextResource in (CustomizableHtmlReport.java:0) Method has raw return type org.gradle.api.resources.TextResource in (TemplateBasedScriptGenerator.java:0) \ No newline at end of file diff --git a/subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/DefaultJvmTestSuite.java b/subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/DefaultJvmTestSuite.java index 63b619cc8301..d2b2f6a7c248 100644 --- a/subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/DefaultJvmTestSuite.java +++ b/subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/DefaultJvmTestSuite.java @@ -19,6 +19,7 @@ import com.google.common.annotations.VisibleForTesting; import org.gradle.api.Action; import org.gradle.api.ExtensiblePolymorphicDomainObjectContainer; +import org.gradle.api.GradleException; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.ExternalModuleDependency; @@ -47,6 +48,7 @@ import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.TaskDependency; +import javax.annotation.Nullable; import javax.inject.Inject; import java.util.Collections; import java.util.HashMap; @@ -55,38 +57,40 @@ import java.util.stream.Collectors; public abstract class DefaultJvmTestSuite implements JvmTestSuite { - /** * Dependency information and default versions for supported testing frameworks. * When updating these versions, be sure to update the default versions noted in `JvmTestSuite` javadoc */ @VisibleForTesting public enum TestingFramework { - JUNIT4("junit", "junit", "4.13.2"), - JUNIT_JUPITER("org.junit.jupiter", "junit-jupiter", "5.8.2", Collections.singletonList( + JUNIT4("JUnit 4", "junit", "junit", "4.13.2"), + JUNIT_JUPITER("JUnit Jupiter", "org.junit.jupiter", "junit-jupiter", "5.8.2", Collections.singletonList( // junit-jupiter's BOM, junit-bom, specifies the platform version DefaultModuleVersionIdentifier.newId("org.junit.platform", "junit-platform-launcher", "") )), // Should be the same as the version listed in the junit-bom corresponding to the default junit-jupiter version. - JUNIT_PLATFORM("org.junit.platform", "junit-platform-launcher", "1.8.2"), - SPOCK("org.spockframework", "spock-core", "2.2-groovy-3.0", Collections.singletonList( + JUNIT_PLATFORM("JUnit Platform", "org.junit.platform", "junit-platform-launcher", "1.8.2"), + SPOCK("Spock", "org.spockframework", "spock-core", "2.2-groovy-3.0", Collections.singletonList( // spock-core references junit-jupiter's BOM, which in turn specifies the platform version DefaultModuleVersionIdentifier.newId("org.junit.platform", "junit-platform-launcher", "") )), - KOTLIN_TEST("org.jetbrains.kotlin", "kotlin-test-junit5", "1.7.10", Collections.singletonList( + KOTLIN_TEST("Kotlin Test", "org.jetbrains.kotlin", "kotlin-test-junit5", "1.7.10", Collections.singletonList( // kotlin-test-junit5 depends on junit-jupiter, which in turn specifies the platform version DefaultModuleVersionIdentifier.newId("org.junit.platform", "junit-platform-launcher", "") )), - TESTNG("org.testng", "testng", "7.5"); + TESTNG("Test NG", "org.testng", "testng", "7.5"); + @Nullable + private final String displayName; private final ModuleVersionIdentifier module; private final List dependencies; - TestingFramework(String group, String name, String defaultVersion) { - this(group, name, defaultVersion, Collections.emptyList()); + TestingFramework(@Nullable String displayName, String group, String name, String defaultVersion) { + this(displayName, group, name, defaultVersion, Collections.emptyList()); } - TestingFramework(String group, String name, String defaultVersion, List dependencies) { + TestingFramework(@Nullable String displayName, String group, String name, String defaultVersion, List dependencies) { + this.displayName = displayName; this.module = DefaultModuleVersionIdentifier.newId(group, name, defaultVersion); this.dependencies = dependencies; } @@ -105,6 +109,13 @@ public List getRuntimeOnlyDependencies(String version) // these runtime dependencies. return dependencies; } + + /** + * How we describe this test framework to the user (i.e., in error messages). + */ + public String getDisplayName() { + return displayName; + } } private static class VersionedTestingFramework { @@ -171,9 +182,12 @@ public DefaultJvmTestSuite(String name, DependencyFactory dependencyFactory, Con addDefaultTestTarget(); - // Until the values here can be finalized upon the user setting them (see the org.gradle.api.tasks.testing.Test#testFramework(Closure) method), - // in Gradle 8, we will be executing the provider lambda used as the convention multiple times. So make sure, within a Test Suite, that we - // always return the same one via computeIfAbsent() against this map. + // We can still execute this innermost provider lambda below used as the convention multiple times. + // So make sure, within a Test Suite, that we always return the same framework instance via computeIfAbsent() against this map. + // Doing so will ensure the UP-TO-DATE checking (tested in JUnitCategoriesIntegrationSpec, for instance) still works. + // + // You might think you can replace the map and just return a new instance (perhaps adding equals/hashCode implementations + // to the framework and options classes, but you cannot - tests should enforce this. final Map frameworkLookup = new HashMap<>(4); this.targets.withType(JvmTestSuiteTarget.class).configureEach(target -> { @@ -207,6 +221,17 @@ private List createDependencies(List version) { + this.targets.withType(JvmTestSuiteTarget.class).configureEach(target -> { + target.getTestTask().configure(task -> { + if (task.getOptionsAccessed()) { + throw new GradleException(String.format("You cannot set the test framework on suite: %s to: %s after accessing test options on an associated Test task: %s.", + getName(), + framework.getDisplayName(), + task.getName())); + } + }); + }); + getVersionedTestingFramework().set(version.map(v -> new VersionedTestingFramework(framework, v))); // This whole way of adding the dependencies here is messed up. Once a user calls the useXXX method, they can't diff --git a/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestOptionsIntegrationSpec.groovy b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestOptionsIntegrationSpec.groovy new file mode 100644 index 000000000000..d8a94bbb894a --- /dev/null +++ b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestOptionsIntegrationSpec.groovy @@ -0,0 +1,472 @@ +/* + * Copyright 2022 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle.testing + +import org.gradle.integtests.fixtures.AbstractSampleIntegrationTest +import org.gradle.integtests.fixtures.TestResources +import org.junit.Rule + +/** + * These tests demonstrate what is and isn't allowed in terms of modifying the {@link org.gradle.api.tasks.testing.TestFrameworkOptions TestFrameworkOptions} + * provided to a {@link org.gradle.api.tasks.testing.Test Test} task. + */ +class TestOptionsIntegrationSpec extends AbstractSampleIntegrationTest { + @Rule + TestResources resources = new TestResources(temporaryFolder) + + def "can NOT set options and then change framework within a suite using a single task configuration action"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + testing { + suites { + test { + targets { + all { + testTask.configure { + options { + includeCategories 'org.gradle.CategoryA' + } + useJUnitPlatform() + } + } + } + } + } + }""".stripMargin() + + when: + fails ":test" + + then: + result.assertHasErrorOutput("You cannot change the test framework to: JUnit Platform after accessing test options. The current framework is: JUnit 4.") + } + + def "can NOT set options and then change framework within a suite using 2 different task configuration actions"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + testing { + suites { + test { + targets { + all { + testTask.configure { + options { + includeCategories 'org.gradle.CategoryA' + } + } + testTask.configure { + useJUnitPlatform() + } + } + } + } + } + }""".stripMargin() + + when: + fails ":test" + + then: + result.assertHasErrorOutput("You cannot change the test framework to: JUnit Platform after accessing test options. The current framework is: JUnit 4.") + } + + def "can NOT set options in #suiteName prior to calling useJUnitJupiter() on suite"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + testing { + suites { + $suiteDeclaration { + targets { + all { + testTask.configure { + options { + ${type} 'fast' + } + } + } + } + useJUnitJupiter() + } + } + }""".stripMargin() + + when: + fails ":$task" + + then: + result.assertHasErrorOutput("You cannot set the test framework on suite: $suiteName to: JUnit Jupiter after accessing test options on an associated Test task: $task.") + + where: + suiteName | suiteDeclaration | task | type + 'test' | 'test' | 'test' | 'includeTags' + 'test' | 'test' | 'test' | 'excludeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'includeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'excludeTags' + } + + def "can NOT set options in #suiteName prior to calling useJUnitJupiter() on suite across 2 configurations actions"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + testing { + suites { + $suiteDeclaration { + targets { + all { + testTask.configure { + options { + ${type} 'fast' + } + } + } + } + } + } + } + testing { + suites { + $suiteDeclaration { + useJUnitJupiter() + } + } + }""".stripMargin() + + when: + fails ":$task" + + then: + result.assertHasErrorOutput("You cannot set the test framework on suite: $suiteName to: JUnit Jupiter after accessing test options on an associated Test task: $task.") + + where: + suiteName | suiteDeclaration | task | type + 'test' | 'test' | 'test' | 'includeTags' + 'test' | 'test' | 'test' | 'excludeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'includeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'excludeTags' + } + + def "can NOT set options on test task directly outside of default test suite, prior to setting test framework inside of suite"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + test { + options { + includeCategories 'org.gradle.CategoryA' + } + } + + testing { + suites { + test { + useJUnitJupiter() + } + } + }""".stripMargin() + + when: + fails ":test" + + then: + result.assertHasErrorOutput("You cannot set the test framework on suite: test to: JUnit Jupiter after accessing test options on an associated Test task: test.") + } + + def "can NOT set options on test task directly, outside of default test suite, then again inside suite"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + test { + useJUnitPlatform() + options { + includeTags 'fast' + } + } + + testing { + suites { + test { + useJUnit() // NOT ALLOWED, task is already configured with a framework, should fail-fast here + } + } + }""".stripMargin() + + when: + fails ":test" + + then: + result.assertHasErrorOutput("You cannot set the test framework on suite: test to: JUnit 4 after accessing test options on an associated Test task: test.") + } + + def "can set non-options test property for test task in #suiteName prior to setting framework within suite"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + testing { + suites { + $suiteDeclaration { + targets { + all { + testTask.configure { + minHeapSize = "128m" + } + } + } + useJUnitJupiter() + targets { + all { + testTask.configure { + options { + ${type} 'fast' + } + } + } + } + } + } + }""".stripMargin() + + expect: + succeeds ":$task" + + where: + suiteName | suiteDeclaration | task | type + 'test' | 'test' | 'test' | 'includeTags' + 'test' | 'test' | 'test' | 'excludeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'includeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'excludeTags' + } + + def "can set test framework in test task prior to setting #type option within #suiteName suite"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + // Ensure non-default suites exist + testing { + suites { + $suiteDeclaration + } + } + + // Configure task directly using name + $task { + useJUnitPlatform() + } + + // Configure task through suite + testing.suites.$suiteName { + useJUnitJupiter() + targets { + all { + testTask.configure { + options { + ${type} 'fast' + } + } + } + } + }""".stripMargin() + + expect: + succeeds ":$task" + + where: + suiteName | suiteDeclaration | task | type + 'test' | 'test' | 'test' | 'includeTags' + 'test' | 'test' | 'test' | 'excludeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'includeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'excludeTags' + } + + def "can set test framework in #suiteName suite prior to setting #type option within test task"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + // Configure task through suite + testing { + suites { + $suiteDeclaration { + useJUnitJupiter() + dependencies { + implementation 'org.junit.jupiter:junit-jupiter-engine:5.4.2' + } + } + } + } + + // Configure task directly using name + $task { + options { + ${type} 'fast' + } + } + + """.stripMargin() + + expect: + succeeds ":$task" + + where: + suiteName | suiteDeclaration | task | type + 'test' | 'test' | 'test' | 'includeTags' + 'test' | 'test' | 'test' | 'excludeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'includeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'excludeTags' + } + + // See JUnitCategoriesIntegrationSpec for the inspiration for this test + def "re-executes test when #type is changed in #suiteName"() { + given: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + testing { + suites { + $suiteDeclaration { + useJUnitJupiter() + targets { + all { + testTask.configure { + options { + ${type} 'fast' + } + } + } + } + } + } + }""".stripMargin() + + when: + succeeds ":$task" + + then: + executedAndNotSkipped ":$task" + + when: + resources.maybeCopy("TestOptionsIntegrationSpec") + buildFile << """ + testing { + suites { + $suiteDeclaration { + useJUnitJupiter() + targets { + all { + testTask.configure { + options { + ${type} 'slow' + } + } + } + } + } + } + }""".stripMargin() + + and: + succeeds ":$task" + + then: + executedAndNotSkipped ":$task" + + where: + suiteName | suiteDeclaration | task | type + 'test' | 'test' | 'test' | 'includeTags' + 'test' | 'test' | 'test' | 'excludeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'includeTags' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'excludeTags' + } + + def "can NOT set new framework for suite in different testing block after configuring options"() { + buildFile << """ + plugins { + id 'java' + } + + ${mavenCentralRepository()} + + testing { + suites { + integrationTest(JvmTestSuite) { + useJUnit() + targets.all { + // explicitly realize the task now to cause this configuration to run now + testTask.get().configure { + options { + excludeCategories "com.example.Exclude" + } + } + } + } + } + } + + testing { + suites { + integrationTest { + useTestNG() + } + } + } + + check.dependsOn testing.suites + """ + + when: + fails("check") + + then: + result.assertHasErrorOutput("You cannot set the test framework on suite: integrationTest to: Test NG after accessing test options on an associated Test task: integrationTest.") + } + + def "can NOT change test framework in test task after options have been set within test suites"() { + buildFile << """ + plugins { + id 'java' + } + + ${mavenCentralRepository()} + + testing { + suites { + integrationTest(JvmTestSuite) { + useJUnit() + targets.all { + testTask.configure { + options { + excludeCategories "com.example.Exclude" + } + } + } + } + } + } + + integrationTest { + useTestNG() + } + + check.dependsOn testing.suites + """ + + when: + fails("check") + + then: + failure.assertHasErrorOutput("You cannot change the test framework to: Test NG after accessing test options. The current framework is: JUnit 4.") + } +} diff --git a/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy index fb78e1c9df73..3c6e4e6b5909 100644 --- a/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy +++ b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy @@ -282,7 +282,7 @@ class TestTaskIntegrationTest extends JUnitMultiVersionIntegrationSpec { extraArgs << [[], ["--tests", "MyTest"]] } - def "options set prior to setting same test framework will warn and have no effect"() { + def "options set prior to setting same test framework will cause error"() { ignoreWhenJUnitPlatform() given: @@ -302,22 +302,16 @@ class TestTaskIntegrationTest extends JUnitMultiVersionIntegrationSpec { } useJUnit() } - - tasks.register('verifyTestOptions') { - doLast { - assert tasks.getByName("test").getOptions().getClass() == JUnitOptions - assert !tasks.getByName("test").getOptions().getExcludeCategories().contains("Slow") - } - } """.stripIndent() - executer.expectDeprecationWarning("Accessing test options prior to setting test framework has been deprecated.") + when: + fails("test") - expect: - succeeds("test", "verifyTestOptions", "--warn") + then: + failure.assertHasErrorOutput("You cannot set the test framework to: JUnit 4 after accessing test options. The current framework is: JUnit 4.") } - def "options set prior to changing test framework will produce additional warning and have no effect"() { + def "options set prior to changing test framework will cause error"() { ignoreWhenJUnitPlatform() given: @@ -340,24 +334,16 @@ class TestTaskIntegrationTest extends JUnitMultiVersionIntegrationSpec { test { useJUnitPlatform() } - - tasks.register('verifyTestOptions') { - doLast { - assert tasks.getByName("test").getOptions().getClass() == JUnitPlatformOptions - } - } """.stripIndent() - executer.expectDeprecationWarning("Accessing test options prior to setting test framework has been deprecated.") - when: - succeeds("test", "verifyTestOptions", "--warn") + fails("test") then: - outputContains("Test framework is changing from 'JUnitTestFramework', previous option configuration would not be applicable.") + failure.assertHasErrorOutput("You cannot change the test framework to: JUnit Platform after accessing test options. The current framework is: JUnit 4.") } - def "options accessed and not explicitly configured prior to setting test framework will also warn"() { + def "options accessed and not explicitly configured prior to setting test framework also fails"() { given: file('src/test/java/MyTest.java') << junitJupiterStandaloneTestClass() @@ -377,19 +363,13 @@ class TestTaskIntegrationTest extends JUnitMultiVersionIntegrationSpec { test { useJUnitPlatform() } - - tasks.register('verifyTestOptions') { - doLast { - assert options.getClass() == JUnitOptions - assert tasks.getByName("test").getOptions().getClass() == JUnitPlatformOptions - } - } """.stripIndent() - executer.expectDeprecationWarning("Accessing test options prior to setting test framework has been deprecated.") + when: + fails("test") - expect: - succeeds("test", "verifyTestOptions", "--warn") + then: + failure.assertHasErrorOutput("You cannot change the test framework to: JUnit Platform after accessing test options. The current framework is: JUnit 4.") } def "options configured after setting test framework works"() { diff --git a/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec.groovy b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec.groovy index a6b2c2cca98c..9ab814d3ba44 100644 --- a/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec.groovy +++ b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec.groovy @@ -115,13 +115,13 @@ public class MyTest { } @Issue('https://github.com/gradle/gradle/issues/4924') - def "re-executes test when #type is changed"() { + def "re-executes test when #type is changed in #suiteName"() { given: resources.maybeCopy("JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged") buildFile << """ |testing { | suites { - | test { + | $suiteDeclaration { | useJUnit() | targets { | all { @@ -137,17 +137,17 @@ public class MyTest { |}""".stripMargin() when: - succeeds ':test' + succeeds ":$task" then: - executedAndNotSkipped ':test' + executedAndNotSkipped ":$task" when: resources.maybeCopy("JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged") buildFile << """ |testing { | suites { - | test { + | $suiteDeclaration { | useJUnit() | targets { | all { @@ -163,11 +163,53 @@ public class MyTest { |}""".stripMargin() and: + succeeds ":$task" + + then: + executedAndNotSkipped ":$task" + + where: + suiteName | suiteDeclaration | task | type + 'test' | 'test' | 'test' | 'includeCategories' + 'test' | 'test' | 'test' | 'excludeCategories' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'includeCategories' + 'integTest' | 'integTest(JvmTestSuite)' | 'integTest' | 'excludeCategories' + } + + @Issue('https://github.com/gradle/gradle/issues/4924') + def "skips test on re-run when #type is NOT changed"() { + given: + resources.maybeCopy("JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged") + buildFile << """ + |testing { + | suites { + | test { + | useJUnit() + | targets { + | all { + | testTask.configure { + | options { + | ${type} 'org.gradle.CategoryA' + | } + | } + | } + | } + | } + | } + |}""".stripMargin() + + when: succeeds ':test' then: executedAndNotSkipped ':test' + when: + succeeds ':test' + + then: + skipped ':test' + where: type << ['includeCategories', 'excludeCategories'] } diff --git a/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/testsuites/TestSuitesIntegrationTest.groovy b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/testsuites/TestSuitesIntegrationTest.groovy index 36abe97d634a..e714f135077d 100644 --- a/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/testsuites/TestSuitesIntegrationTest.groovy +++ b/subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/testsuites/TestSuitesIntegrationTest.groovy @@ -20,10 +20,7 @@ import org.gradle.api.internal.tasks.testing.junit.JUnitTestFramework import org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestFramework import org.gradle.api.internal.tasks.testing.testng.TestNGTestFramework import org.gradle.api.plugins.jvm.internal.DefaultJvmTestSuite -import org.gradle.api.tasks.testing.junit.JUnitOptions -import org.gradle.api.tasks.testing.junitplatform.JUnitPlatformOptions import org.gradle.integtests.fixtures.AbstractIntegrationSpec -import org.gradle.integtests.fixtures.DefaultTestExecutionResult import org.gradle.integtests.fixtures.JUnitXmlTestExecutionResult import spock.lang.Issue @@ -488,133 +485,6 @@ class TestSuitesIntegrationTest extends AbstractIntegrationSpec { succeeds("checkConfiguration") } - // TODO: Test Framework Selection - Revert this to may NOT in Gradle 8 - def "test framework MAY be changed once options have been used with test suites"() { - buildFile << """ - plugins { - id 'java' - } - - ${mavenCentralRepository()} - - testing { - suites { - integrationTest(JvmTestSuite) { - useJUnit() - targets.all { - testTask.configure { - options { - excludeCategories "com.example.Exclude" - } - } - } - } - } - } - - integrationTest { - useTestNG() - } - - check.dependsOn testing.suites - """ - - executer.expectDeprecationWarning("Accessing test options prior to setting test framework has been deprecated. This is scheduled to be removed in Gradle 8.0.") - - expect: - succeeds("check") - } - - // This checks for backwards compatibility with builds that may rely on this - def "can change the test framework multiple times before execution when not using test suites"() { - given: - buildFile << """ - plugins { - id 'java' - } - ${mavenCentralRepository()} - dependencies { testImplementation "junit:junit:4.13" } - - test { - useJUnit() - options { - assert it instanceof ${JUnitOptions.canonicalName} - } - useJUnitPlatform() - options { - assert it instanceof ${JUnitPlatformOptions.canonicalName} - } - useJUnit() - } - """ - - and: - file("src/test/java/SomeTest.java") << """ - import org.junit.*; - - public class SomeTest { - @Test public void foo() { - } - } - """ - - executer.expectDeprecationWarning("Accessing test options prior to setting test framework has been deprecated. This is scheduled to be removed in Gradle 8.0.") - executer.expectDeprecationWarning("Accessing test options prior to setting test framework has been deprecated. This is scheduled to be removed in Gradle 8.0.") - - when: - succeeds("test") - - then: - executedAndNotSkipped(":test") - DefaultTestExecutionResult result = new DefaultTestExecutionResult(testDirectory) - result.assertTestClassesExecuted("SomeTest") - } - - // This is not the behavior we want in the long term because this makes build configuration sensitive to the order - // that tasks are realized. - // useTestNG() is ignored here because we finalize the test framework on the task as soon as we configure options - // The test framework options should be pushed up into the test suite target/test suite and passed down into the - // Test task - def "build succeeds when test framework is changed to another kind when realizing task and configuring options"() { - buildFile << """ - plugins { - id 'java' - } - - ${mavenCentralRepository()} - - testing { - suites { - integrationTest(JvmTestSuite) { - useJUnit() - targets.all { - // explicitly realize the task now to cause this configuration to run now - testTask.get().configure { - options { - excludeCategories "com.example.Exclude" - } - } - } - } - } - } - - testing { - suites { - integrationTest { - // This is ignored - useTestNG() - } - } - } - - check.dependsOn testing.suites - """ - - expect: - succeeds("check") - } - @Issue("https://github.com/gradle/gradle/issues/18622") def "custom Test tasks eagerly realized prior to Java and Test Suite plugin application do not fail to be configured when combined with test suites"() { buildFile << """ diff --git a/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/build.gradle b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/build.gradle new file mode 100644 index 000000000000..77acb152a3a2 --- /dev/null +++ b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/build.gradle @@ -0,0 +1,21 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: "java" + +repositories { + mavenCentral() +} diff --git a/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/src/integTest/java/org/gradle/SomeTestClass.java b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/src/integTest/java/org/gradle/SomeTestClass.java new file mode 100644 index 000000000000..0bf1af76a42c --- /dev/null +++ b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/src/integTest/java/org/gradle/SomeTestClass.java @@ -0,0 +1,31 @@ +/* + * Copyright 2022 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Tag; + +@Tag("fast") +public class SomeTestClass { + @Test + public void ok1() { + } + + @Test + public void ok2() { + } +} diff --git a/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/src/test/java/org/gradle/SomeTestClass.java b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/src/test/java/org/gradle/SomeTestClass.java new file mode 100644 index 000000000000..0bf1af76a42c --- /dev/null +++ b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/TestOptionsIntegrationSpec/src/test/java/org/gradle/SomeTestClass.java @@ -0,0 +1,31 @@ +/* + * Copyright 2022 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Tag; + +@Tag("fast") +public class SomeTestClass { + @Test + public void ok1() { + } + + @Test + public void ok2() { + } +} diff --git a/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/CategoryA.java b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/CategoryA.java new file mode 100644 index 000000000000..8329eaec152a --- /dev/null +++ b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/CategoryA.java @@ -0,0 +1,20 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle; + +public interface CategoryA { +} diff --git a/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/CategoryB.java b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/CategoryB.java new file mode 100644 index 000000000000..4c09973ad3ea --- /dev/null +++ b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/CategoryB.java @@ -0,0 +1,20 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle; + +public interface CategoryB { +} diff --git a/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/SomeTestClass.java b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/SomeTestClass.java new file mode 100644 index 000000000000..c60f95962337 --- /dev/null +++ b/subprojects/testing-jvm/src/integTest/resources/org/gradle/testing/junit/JUnitCategoriesIntegrationSpec/reExecutesWhenPropertyIsChanged/src/integTest/java/org/gradle/SomeTestClass.java @@ -0,0 +1,29 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle; + +import org.junit.Test; + +public class SomeTestClass { + @Test + public void ok1() { + } + + @Test + public void ok2() { + } +} diff --git a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/TestFramework.java b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/TestFramework.java index b6a5c9db6b0c..e0f7d7f11556 100644 --- a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/TestFramework.java +++ b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/TestFramework.java @@ -74,6 +74,12 @@ public interface TestFramework extends Closeable { @Internal List getTestWorkerImplementationModules(); + /** + * This property controls how we describe this test framework to the user (i.e., in error messages). + */ + @Internal + String getDisplayName(); + /** * Whether the legacy behavior of loading test framework dependencies from the Gradle distribution * is enabled. If true, jars and modules as specified by {@link #getTestWorkerImplementationClasses()} @@ -87,4 +93,5 @@ public interface TestFramework extends Closeable { */ @Internal boolean getUseImplementationDependencies(); + } diff --git a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junit/JUnitTestFramework.java b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junit/JUnitTestFramework.java index 699fb896bbae..9c96d606180d 100644 --- a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junit/JUnitTestFramework.java +++ b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junit/JUnitTestFramework.java @@ -80,6 +80,11 @@ public List getTestWorkerImplementationModules() { return Collections.emptyList(); } + @Override + public String getDisplayName() { + return "JUnit 4"; + } + @Override public boolean getUseImplementationDependencies() { return useImplementationDependencies; diff --git a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junitplatform/JUnitPlatformTestFramework.java b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junitplatform/JUnitPlatformTestFramework.java index 68ef7dba7de3..b2c58eecf6d9 100644 --- a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junitplatform/JUnitPlatformTestFramework.java +++ b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junitplatform/JUnitPlatformTestFramework.java @@ -92,6 +92,11 @@ public List getTestWorkerImplementationModules() { return ImmutableList.of("junit-platform-engine", "junit-platform-launcher", "junit-platform-commons"); } + @Override + public String getDisplayName() { + return "JUnit Platform"; + } + @Override public boolean getUseImplementationDependencies() { return useImplementationDependencies; diff --git a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/testng/TestNGTestFramework.java b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/testng/TestNGTestFramework.java index 04df532c3930..0d4686b2036e 100644 --- a/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/testng/TestNGTestFramework.java +++ b/subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/testng/TestNGTestFramework.java @@ -176,6 +176,11 @@ public List getTestWorkerImplementationModules() { return Collections.emptyList(); } + @Override + public String getDisplayName() { + return "Test NG"; + } + @Override public boolean getUseImplementationDependencies() { // We have no (default) implementation dependencies (see above). diff --git a/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java b/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java index 2f6d2c5aea99..d93d5266fd36 100644 --- a/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java +++ b/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java @@ -21,6 +21,7 @@ import groovy.lang.DelegatesTo; import org.gradle.StartParameter; import org.gradle.api.Action; +import org.gradle.api.GradleException; import org.gradle.api.Incubating; import org.gradle.api.InvalidUserDataException; import org.gradle.api.JavaVersion; @@ -70,7 +71,6 @@ import org.gradle.internal.Factory; import org.gradle.internal.actor.ActorFactory; import org.gradle.internal.concurrent.CompositeStoppable; -import org.gradle.internal.deprecation.DeprecationLogger; import org.gradle.internal.jvm.DefaultModularitySpec; import org.gradle.internal.jvm.JavaModuleDetector; import org.gradle.internal.jvm.UnsupportedJavaRuntimeException; @@ -174,7 +174,7 @@ public class Test extends AbstractTestTask implements JavaForkOptions, PatternFi private FileCollection classpath; private final ConfigurableFileCollection stableClasspath; private final Property testFramework; - private boolean userHasConfiguredTestFramework; + private boolean optionsAccessed; private boolean scanForTestClasses = true; @@ -922,31 +922,6 @@ public TestFramework testFramework(@Nullable Closure testFrameworkConfigure) { useJUnit(testFrameworkConfigure); } - // To maintain backwards compatibility with builds that may configure the test framework - // multiple times for a single task--either switching between frameworks or overwriting - // the existing configuration for a test framework--we need to keep track if the user has - // explicitly set a test framework - // With test suites, users should never need to call the useXXX methods, so we can warn if - // them from doing something like this (for now, in order to preserve existing builds). - // This behavior should be restored to fail fast once again with the next major version. - // - // testTask.configure { - // options { - // /* configure JUnit Platform */ - // } - // } - // testTask.configure { - // useJUnit() - // options { - // /* configure JUnit */ - // } - // } - - // TODO: Test Framework Selection - Restore this to re-enable fail-fast behavior for Gradle 8 -// if (!userHasConfiguredTestFramework) { -// testFramework.finalizeValue(); -// } - return testFramework.get(); } @@ -985,24 +960,32 @@ public TestFrameworkOptions options(Action testFra return options; } + /** + * Checks if the options for this test task have already been accessed; if so the framework cannot be changed on either the + * task or it's associated test suite. + * + * @since 8.0 + */ + @Internal + @Incubating + public Boolean getOptionsAccessed() { + return optionsAccessed; + } + TestFramework useTestFramework(TestFramework testFramework) { return useTestFramework(testFramework, null); } private TestFramework useTestFramework(TestFramework testFramework, @Nullable Action testFrameworkConfigure) { + final TestFramework oldFramework = Test.this.testFramework.get(); + if (optionsAccessed) { - DeprecationLogger.deprecateAction("Accessing test options prior to setting test framework") - .withContext("\nTest options have already been accessed for task: '" + getProject().getName() + ":" + getName() + "' prior to setting the test framework to: '" + testFramework.getClass().getSimpleName() + "'. Any previous configuration will be discarded.\n") - .willBeRemovedInGradle8() - .withDslReference(Test.class, "options") - .nagUser(); - - if (!this.testFramework.get().getClass().equals(testFramework.getClass())) { - getLogger().warn("Test framework is changing from '{}', previous option configuration would not be applicable.", this.testFramework.get().getClass().getSimpleName()); - } + throw new GradleException(String.format("You cannot %s the test framework to: %s after accessing test options. The current framework is: %s.", + testFramework.getClass() == oldFramework.getClass() ? "set" : "change", + testFramework.getDisplayName(), + oldFramework.getDisplayName())); } - userHasConfiguredTestFramework = true; this.testFramework.set(testFramework); if (testFrameworkConfigure != null) {