amadeu01
3/13/2018 - 7:36 PM

Test some gradle stuff while lern it

Test some gradle stuff while lern it

println 'Above all stuff'

task hello {
    println 'Inside hello, before doLast'
    doLast {
        println "Hello World"
        println 'Inside hello, Inside do doLast'
    }
    println 'Inside hello, after doLast'
}

println 'Between hello and date'

task date(dependsOn: hello) { // Can put a collection
    // dependsOn hello
    dependsOn 'hi', 'whatUp'
    println 'Inside date, before doLast'
    doLast {
        println new Date()
    }
}

println 'After every stuff'

task hi(type: Greeting)

task whatUp(type: Greeting) {
    user = 'Amadeu'
}

class Greeting extends DefaultTask {
    String user = 'Pedro'

    @TaskAction
    void sayHello() {
        println "Hello, $user!"
    }
}