ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: <import> and properties weirdness
Date Thu, 30 Sep 2004 14:21:09 GMT
On Thu, 30 Sep 2004, Frode E. Moe <frode@coretrek.no> wrote:

> I am currently experiencing some weirdness when using multiple
> levels of imported build files.

It is an ordering problem, as can be witnessed by looking into Ant's
-debug output.

Running "ant -f part3.xml -debug" you get

...
Importing file part2.xml from /tmp/part3.xml
parsing buildfile /tmp/part2.xml with URI = file:///tmp/part2.xml
Setting ro project property: ant.file.part2 -> /tmp/part2.xml
 +Target: usage
Property ${dir.src} has not been set
Setting project property: dir.srcphp -> ${dir.src}/php
Property ${dir.src} has not been set
     [echo] 
     [echo]     dir.src is ${dir.src}
     [echo]     dir.srcphp is ${dir.src}/php
     [echo]   
Importing file part1.xml from /tmp/part2.xml
parsing buildfile /tmp/part1.xml with URI = file:///tmp/part1.xml
Setting ro project property: ant.file.part1 -> /tmp/part1.xml
 +Target: release
Setting project property: dir.src -> src
...

so Ant performs the import of part2.xml and then continues with the
top level tasks of part3.xml before going back to the top level tasks
of part2.xml.  The <property> in part2.xml doesn't get executed until
after your <property> in part3.xml.

When you remove the target from part2.xml it becomes

...
Importing file part2.xml from /tmp/part3.xml
parsing buildfile /tmp/part2.xml with URI = file:///tmp/part2.xml
Setting ro project property: ant.file.part2 -> /tmp/part2.xml
Importing file part1.xml from /tmp/part2.xml
parsing buildfile /tmp/part1.xml with URI = file:///tmp/part1.xml
Setting ro project property: ant.file.part1 -> /tmp/part1.xml
 +Target: release
Setting project property: dir.src -> src
Setting project property: dir.srcphp -> src/php
...

so if there are no targets in part2, all its top level tasks get
executed immediately - if there are targets those top level tasks get
delayed until after the outer most build file has been done.

Smells like a bug, I'm opening a bug report in bugzilla.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message