Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 25554 invoked from network); 4 Oct 2000 00:38:53 -0000 Received: from postbox.viquity.com (HELO dcsrv0.ecom2ecom.com) (63.198.126.137) by locus.apache.org with SMTP; 4 Oct 2000 00:38:53 -0000 Received: by dcsrv0 with Internet Mail Service (5.5.2650.21) id ; Tue, 3 Oct 2000 17:38:11 -0700 Message-ID: <635802DA64D4D31190D500508B9B04104E0F2A@dcsrv0> From: Jose Alberto Fernandez To: "Ant Project List (E-mail)" Subject: Ant templates and more templates Date: Tue, 3 Oct 2000 17:38:10 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C02D9B.5F4D03FC" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C02D9B.5F4D03FC Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C02D9B.5F4D03FC" ------_=_NextPart_001_01C02D9B.5F4D03FC Content-Type: text/plain; charset="iso-8859-1" Writing some build files for our projects here I have come across several situations in which I would have liked having some sort of template facilities for ANT. (1) This first is for tasks. The tasks that I use are quite quite monotonous: Call this class with this arguments, then call it again but just change the last arguments, etc, etc. One way to deal with this is to define my own task that extends and that presets all that needs to be preset. But wouldn't it be nice to have a way to say tell ANT to do that without a need to declare and maintain new classes? Something like: Now I should be able to use: And this should be equivalent to doing: (2) A second situation where templates are interesting is when trying to interconnect tasks from on build file to another using the task. In this case one usially want to have access from the marter build file to the suordinate build files. Usually one would have s like: Every time you add a task to the subproject, you need to add an entry point in the project. A real syncronization problem. What I would like is to be able to say: So with a call like: ant subtarget1 subtarget2 ANT will execute the above template twice, once for each substitution and call the respective subtarget1 and subtarget2 in subproject.xml. Now notice that the template mechanism is more generic than just calling subprojects. It will allow for some nice things. I do not think that (2), in particular, can be solved with XSLT because you only know the substitution at execution time. Does this looks as something interesting to have? I think the approach is quite declarative in both cases, does anybody see a major problem with this? Jose Alberto Now, ------_=_NextPart_001_01C02D9B.5F4D03FC Content-Type: text/html; charset="iso-8859-1"
Writing some build files for our projects here I have come across several situations in which I would have liked having some sort of template facilities for ANT.
 
(1) This first is for tasks. The <java> tasks that I use are quite quite monotonous: Call this class with this arguments, then call it again but just change the last arguments, etc, etc.
One way to deal with this is to define my own task that extends <java> and that presets all that needs to be preset. But wouldn't it be nice to have a way to say tell ANT to do that without a need to declare and maintain new classes?
 
Something like:
 
<javataskdef name="mytask" classname="XYZ" >
  <classpath refid="XYZpath" />
  <arg value="fix value" />
</javataskdef>
 
Now I should be able to use:
 
<mytask fork="yes" >
  <arg value="changing value" />
</mytask>
 
And this should be equivalent to doing:
 
<java classname="XYZ" fork="yes" >
  <classpath refid="XYZpath" />
  <arg value="fix value" />
  <arg value="changing value" />
</java>
 
 
 
(2) A second situation where templates are interesting is when trying to interconnect tasks from on build file to another using the <ant> task. In this case one usially want to have access from the marter build file to the suordinate build files. Usually one would have <target>s like:
 
<target name="subtarget1"  depends="..." >
  <ant target="subtarget1" antfile="subproject.xml" />
</target>
 
Every time you add a task to the subproject, you need to add an entry point in the project. A real syncronization problem. What I would like is to be able to say:
 
<target template="sub*" key="subtarget" depends="..." >
   <ant target="${subtarget} antfile="subproject.xml" />
</target>
 
So with a call like:
 
    ant subtarget1 subtarget2
 
ANT will execute the above template twice, once for each substitution and call the respective subtarget1 and subtarget2 in subproject.xml. Now notice that the template mechanism is more generic than just calling subprojects. It will allow for some nice things.
 
I do not think that (2), in particular, can be solved with XSLT because you only know the substitution at execution time.
 
Does this looks as something interesting to have? I think the approach is quite declarative in both cases, does anybody see a major problem with this?
 
Jose Alberto
 
 
Now,
 

 
------_=_NextPart_001_01C02D9B.5F4D03FC-- ------_=_NextPart_000_01C02D9B.5F4D03FC Content-Type: application/octet-stream; name="Jose Alberto Fernandez.vcf" Content-Disposition: attachment; filename="Jose Alberto Fernandez.vcf" BEGIN:VCARD VERSION:2.1 N:Fernandez;Jose FN:Jose Alberto Fernandez ORG:Viquity;Engineering TITLE:Architect Software Development TEL;WORK;VOICE:408-548-9755 ADR;WORK:;Sunnyvale;1161 N Fair Oaks Ave;Sunnyvale;CA;94089;USA LABEL;WORK;ENCODING=QUOTED-PRINTABLE:Sunnyvale=0D=0A1161 N Fair Oaks Ave=0D=0ASunnyvale, CA 94089=0D=0AUSA EMAIL;PREF;INTERNET:JFernandez@viquity.com REV:20000629T183010Z END:VCARD ------_=_NextPart_000_01C02D9B.5F4D03FC--