Gradle up-to-date on exec tasks

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Gradle up-to-date on exec tasks

This post has NOT been accepted by the mailing list yet.
Hi I have the following situation:
task foo(type:Exec) {
    ext.dirName = ""
    outputs.dir = dirName
    doFirst {
        workingDir "."
        executable "sh"
        def mkdir = 'mkdir -p ' + dirName
        args '-c', mkdir

foo.dirName = "/tmp/bar"
compileJava.dependsOn foo

The problem is the property dirName is only available during doFirst, how do set outputs.dir based on this property. It throws an exception, since the default driName is empty. Also if I put outputs.dir inside doFirst, gradle complain that this is deprecated and it does not work.