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?