On May 25, 2009, at 2:40 PM, Pfau, Matthias wrote:

Hi,
I just had some problems with the new task definition dsl.

The following script will evaluate successfully when calling 'gradle b'. This means, that a task that is declared without "<<", will be executed in any case.
        def myVar = null

        
        task a {
                myVar = 'Task a was here'
        }
        
        task b << {
                assert myVar == 'Task a was here'
        }


Why has the dsl changed since Adam's last proposal (or did I miss something?).

The DSL has not changed.

Let's rewrite the example a little bit:

def myVar = null

task a << {
   myVar = 'Task a was here'
}

task b(dependsOn: a) {
   assert myVar == null
}

If you execute 'gradle b' this will run without exception.

task a { <configure> }

The closure passed to task a is applied against task a at configuration time, that is before any task action of any task is executed. Therefore your example works.

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to