val compile by tasks.creating {
    doLast {
        println("We are doing the compile.")
    }
}

compile.doFirst {
    // Here you would put arbitrary conditions in real life.
    // But this is used in an integration test so we want defined behavior.
    if (true) { throw StopExecutionException() }
}
task ("myTask") {
    dependsOn(compile)
    doLast {
        println("I am not affected")
    }
}
