I am new to gradle and groovy,I am reading the usr guide of Gradle, and have some syntax questions on task method:
task intro(dependsOn: hello) {
doLast { println "I'm Gradle" }
}
Question 1:in above code, which method is called in Project
API ? I know there are four overload in API:
Task task(String name, Closure configureClosure);
Task task(Map<String, ?> args, String name, Closure configureClosure);
Task task(Map<String, ?> args, String name) throws InvalidUserDataException;
Task task(String name) throws InvalidUserDataException;
but the parameter such as intro(dependsOn: hello)
or copy(type: Copy)
make me confused, what it should be if add parentheses?
Question 2: why << is shorthand for doLast
method? I mean there is a leftshift
method in Task
API ? what is diff between them?
Question 3: why can use tasks.create()
method in build.gradle 17.1. Defining tasks,I did not see tasks
property in Project
API or in AbstractProject
source code.