On May 26, 2009, at 1:04 PM, Pfau, Matthias wrote:
Hello Hans,
thanks for clearing this up. I just digged into the manual again and
saw, that you described my problem in Example 23.2.
Anyhow, the difference between adding actions to a task and
configuring a task is very small.
One very important difference is in my opinion, that task actions are
ordered and executed via an directed acyclic graph (where you can
define depends on relations, do skipping, etc ...).
- Hans
Kind regards
Matthias
-----Original Message-----
From: Hans Dockter [mailto:[email protected]]
Sent: Montag, 25. Mai 2009 14:53
To: [email protected]
Subject: Re: [gradle-user] Changes in task definition dsl?
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
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
Hans Dockter
Gradle Project Manager
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email