You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Grossbart, Zack" <za...@silverstream.com> on 2000/12/06 16:57:46 UTC

[PATCH] Including build files - bug ID 537

It would be a nice feature to be able to include build files within other
build files.  This would work similarly to antcall, but would allow you to
specify targets within another xml file.  For example:  if I had a build
file that setup some necessary environment information, I could include that
file in all of my build files.  In the attached xml files, build.xml calls
common.xml to set a commonly used property.

I have a patch that does this.  It is called CallTargetExternal, and is
based loosely on CallTarget.java which implements antcall.  This task
imposes the restriction that you must maintain unique target name across all
of the xml files that are called.  This limitation could be avoided with a
little more work in Project.java, but I'm not sure that it is worth it.

What does everyone think?

Zack




Re: [PATCH] Including build files - bug ID 537

Posted by Stefan Bodewig <bo...@apache.org>.
Zack Grossbart <za...@silverstream.com> wrote:

> The XML include mechanism that Stefan suggested is very tempting.  I
> never knew about this mechanism and can't find any reference to it
> in the XML 1.0 specification.  Is there a newer version of XML that
> Ant is supporting, or is this feature specific to Ant's XML parser.

Neither nor, it's SGML legacy so to speak. Newer XML ideas would say
"don't use this" as it requires a DTD (at least an implicit one) and
doesn't work well with XML Schema - actually it doesn't - XInclude
would be the way to go.

> I'm assuming that Ant is using a derivative of the Xerces XML
> parser, but I could be wrong.

It uses any JAXP 1.0 parser, including Xerces. All it uses ATM is SAX1
and DOM1.

Stefan

RE: [PATCH] Including build files - bug ID 537

Posted by "Grossbart, Zack" <za...@silverstream.com>.
Stefan and Diane,

The issue with using the ant task, as Diane suggested, is that I want to be
able to invoke the task from the other XML file as part of the same project.

The XML include mechanism that Stefan suggested is very tempting.  I never
knew about this mechanism and can't find any reference to it in the XML 1.0
specification.  Is there a newer version of XML that Ant is supporting, or
is this feature specific to Ant's XML parser.  I'm assuming that Ant is
using a derivative of the Xerces XML parser, but I could be wrong.  The only
issue I see with using the XML include mechanism, is that you don't get to
use the variable substitution that Ant gives you.  This means that you have
to know the full path to the included file when you write the calling XML
file instead of allowing the user to specify and environment variable or
something else to say where the file is.

When you look at it this request fits into the "nice to have" category
better than any other, but it would still be nice to have.

Zack

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> Sent: Wednesday, December 06, 2000 11:58 AM
> To: ant-dev@jakarta.apache.org
> Subject: Re: [PATCH] Including build files - bug ID 537
>
>
> Zack Grossbart <za...@silverstream.com> wrote:
>
> > It would be a nice feature to be able to include build files within
> > other build files.  This would work similarly to antcall, but would
> > allow you to specify targets within another xml file.  For example:
> > if I had a build file that setup some necessary environment
> > information, I could include that file in all of my build files.  In
> > the attached xml files, build.xml calls common.xml to set a commonly
> > used property.
>
> I would have commented on the report and even closed it, but the
> bugrat server doesn't like me at the moment. My answer would be (and
> will be once I get through):
>
> Already possible via XML SYSTEM entities, see
> <http://marc.theaimsgroup.com/?l=ant-user&m=97358675517672&w=2> for
> example.
>
> Cheers
>
>         Stefan

Re: [PATCH] Including build files - bug ID 537

Posted by Stefan Bodewig <bo...@apache.org>.
Zack Grossbart <za...@silverstream.com> wrote:

> It would be a nice feature to be able to include build files within
> other build files.  This would work similarly to antcall, but would
> allow you to specify targets within another xml file.  For example:
> if I had a build file that setup some necessary environment
> information, I could include that file in all of my build files.  In
> the attached xml files, build.xml calls common.xml to set a commonly
> used property.

I would have commented on the report and even closed it, but the
bugrat server doesn't like me at the moment. My answer would be (and
will be once I get through):

Already possible via XML SYSTEM entities, see
<http://marc.theaimsgroup.com/?l=ant-user&m=97358675517672&w=2> for
example.

Cheers

        Stefan