Reputation: 1671
Is a build.gradle file a syntactically valid Groovy script? If the right classes are in the class path, will it compile? For instance, suppose you have task hello{}
. If I understand correctly, this creates a variable of type Task whose name is hello. But surely this is impossible in Groovy? Variables are declared with def
. Why is this not failing with due to an undeclared identifier?
Upvotes: 3
Views: 307
Reputation: 38669
No, Gradle scripts are not valid Groovy scripts. Gradle is using a DSL that is based on Groovy. This among other things means there are AST transformers provided by Gradle that transform the provided DSL to valid Groovy code that is then compiled and executed.
Upvotes: 7