ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: Configure->Template->Build
Date Fri, 01 Jun 2001 16:55:07 GMT
At 12:00 PM 6/1/01 +0200, Stefan Bodewig wrote:
>Peter Donald <donaldp@apache.org> wrote:
>
>> At 12:02 PM 5/31/01 +0200, Stefan Bodewig wrote:
>>>
>>>So don't define the compile target in that thing you include with
>>>projectref at all and provide this single target in all 17 build
>>>files (as they all seem to be different anyway)?
>> 
>> And loose maintainability.
>
>Why so? All targets that are the same are in the shared file while all
>that are different will be maintained independently - or they are not
>that different at all 8-)

they are mostly the same with predictable variayions (ie one projects has 1
class to rmic while another may have 0 and another may have 10).

>> That would mean you are relegated to modifying 17 build files -
>> completely defeats the point of having templating don't you think ;)
>
>If this was true, yes.
>
>How would your configuration/templating aproach deal with this?

The actual example I have been using (rmic) doesn't need configuration
stage ;). You can do it base on input file. A snippet from my tests using
XML+XSL to do templating is below

----------------------------------------------------------------------------
       <!-- Compiles the source code -->
      <target name="compile" depends="prepare">

        <mkdir dir="${build.classes}"/>

        <javac srcdir="${java.dir}"
               destdir="${build.classes}"
               debug="${debug}"
               optimize="${optimize}"
               deprecation="${deprecation}">
          <classpath refid="project.class.path" />
          <xsl:apply-templates select="/project/java-compile"/>
        </javac>

        <xsl:apply-templates select="/project/rmic"/>

        <xsl:apply-templates select="/project/resources"/>

      </target>
----------------------------------------------------------------------------

In this case the statement '<xsl:apply-templates select="/project/rmic"/>'
will apply the templates for rmic in initial input file after javac task
and before resources are copied. SO if the individual project instance has
0 rmic elements then there will be no rmic tasks in final build file,
however if project had 12 rmics then all of them would be included (in the
order from original input file).

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message