Slackbot
07/06/2023, 3:40 PMPiotr Minkina
07/07/2023, 10:18 AMAdam
07/07/2023, 10:33 AMPiotr Minkina
07/07/2023, 10:38 AMAdam
07/07/2023, 10:38 AMAdam
07/07/2023, 10:41 AMAdam
07/07/2023, 10:41 AMPiotr Minkina
07/07/2023, 10:42 AMPiotr Minkina
07/07/2023, 10:43 AMAdam
07/07/2023, 10:44 AMAdam
07/07/2023, 10:45 AMAdam
07/07/2023, 10:45 AMPiotr Minkina
07/07/2023, 10:46 AMPiotr Minkina
07/07/2023, 10:46 AMAdam
07/07/2023, 10:48 AM@Delegate(interfaces = true) works in Gradle 6.4, but no longer works in Gradle 8.2Adam
07/07/2023, 10:49 AM@Delegate(interfaces = true)?Piotr Minkina
07/07/2023, 10:50 AMPiotr Minkina
07/07/2023, 10:51 AMAdam
07/07/2023, 10:51 AMPiotr Minkina
07/07/2023, 10:52 AMAdam
07/07/2023, 10:53 AMPiotr Minkina
07/07/2023, 10:57 AMPiotr Minkina
07/07/2023, 10:58 AMAdam
07/07/2023, 10:59 AMPiotr Minkina
07/07/2023, 11:06 AM> Task :compileGroovy FAILED
startup failed:
/tmp/exampleSourceSetsPlugin/src/main/groovy/com/example/internal/DefaultExampleSourceSets.groovy: 10: [Static type checking] - Cannot find matching method org.gradle.api.NamedDomainObjectContainer#add(com.example.ExampleSourceDirectorySet). Please check if the declared type is correct and if the method exists.
@ line 10, column 5.
@Delegate(interfaces = true)
^
1 error
6.9.1 — tests pass
So as you wrote, it may have to do with the Groovy version. I'll try forcing an older version of Groovy in Plugin Development in that case.Adam
07/07/2023, 11:08 AMGradle plugins written in Groovy must use Groovy 3.x for compatibility with Gradle and Groovy DSL build scripts.
Piotr Minkina
07/07/2023, 11:10 AMAdam
07/07/2023, 11:15 AMPiotr Minkina
07/07/2023, 11:27 AMDefaultExampleSourceSets class must implement as a result of implementing the ExampleSourceSets interface. I have highlighted those methods that I needed to define in the DefaultExampleSourceSets class. It seems that the @Delegate annotation in the new version of Groovy has a problem with methods that take Class<T> as a parameter.Piotr Minkina
07/07/2023, 11:39 AMPiotr Minkina
07/07/2023, 12:20 PMAdam
07/07/2023, 3:02 PMAdam
07/07/2023, 3:04 PMDefaultExampleSourceSets and then use ‘add’ instead of ‘create’. Then you wouldn’t have to worry about trying to be compatible with how Gradle instantiates types.