On Mon, 22 Jul 2002, <[EMAIL PROTECTED]> wrote:

> In the first case, <import> will read the other file _before_ the
> targets in the main build.xml are read. That's how Nicola's original
> patch worked.

Does it really rely on the targets being read after the import or is
it sufficient to "execute" <import> before target dependencies get
calculated?

> Finally, for targetless files - the first 2 choices are really bad,
> because projecthelp would actually execute the build instead of just
> listing the targets.

This is not restricted to target less build files at all:

<project default="compile">
  <echo>This is the build file $Id: $</echo>

  <target name="compile">
    <javac ... />
  </target>
</project>

With any choice but the third one, the <echo> task would be executed
and do something for projecthelp.  So there is a problem for all build
files with tasks that actually "do something" at the top level, no
matter whether targets are present or not.

> One solution that would clarify things would be to 
> somehow ( marker Interface, metadata, etc ) indicate
> which task is 'active' ( javac, copy, etc ) and 
> which is 'initialization' ( property, taskdef, import ).

Is <echo> active?  If <taskdef> is active, it may need <javac> and
<jar> to be active as well to actually work (for cases where the task
you want to define gets built first).

I find it hard to draw the line.

> We can reimplement projecthelp to not use ProjectHelper ( or add a
> flag to just read descriptions ).

Would work, but there is yet another problem:

> cat /tmp/build.xml
<project default="bar">
  <echo>Foo</echo>
  <target name="bar" />
</project>
> ant -f /tmp/build.xml foo
Buildfile: /tmp/build.xml

BUILD FAILED
Target `foo' does not exist in this project. 

Total time: 1 second

With the options one and two, the echo task would be run.

Stefan

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to