How to use a model block in a build.gradle.kts file


(Baron Roberts) #1

I am in the process of converting my build.gradle files to Kotlin build.gradle.kts files. A number of my build files contain model blocks. I cannot find a way to code these in Kotlin and am concerned that this is a Groovy-only construct. Is there a Kotlin equivalent to the model block?


(Baron Roberts) #2

For the benefit of anyone else hitting this issue, the answer is that model blocks are not support in Gradle Kotlin Script 1.0 and a RuleSource class needs to be created directly. I have not yet tried this but it is the suggestion from https://github.com/gradle/gradle-script-kotlin/issues/260.