What if I tell you that you cannot reference properties in the 'name' and
'depends' attributes of <target>... What you intend to do cannot work.

On the other hand, I submitted to bugzilla a <subant> task
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12368) which is like
<ant>, but for multiple sub-project (or sub-builds, however you prefer).

As discussed there in a to-do, I enhanced it to support a dynamic build
path, which can by computed by a resolver class from some arbitrary
information. I didn't post it, since my single class now uses a few other
support classes, and also the only build path resolver is specific to my
needs, but with little programming, your use case (as I understand) it would
be supported.

My use case is as follows:

I have a custom dependencies.xml file (inspired from GUMP descriptor)
listing the dependencies between my sub-projects.

I define a <buildpath> (a custom datatype I wrote extending Ant's <path>) as
follows:

  <target name="buildpath" depends="init, validate" unless="buildpath-set"
          description="Compute buildpath from dependencies.xml and display
it">
    <buildpath ident="buildpath"
 
resolverClassname="com.lgc.buildmagic.TahoeBuildPathResolver">
      <param name="destdir" value="${destdir}" />
      <param name="dependencies" value="${dependencies}" />
    </buildpath>
    <property name="buildpath" refid="buildpath" />

    <pathconvert property="formatted-buildpath"
                 pathsep="${line.separator}            "
                 refid="buildpath" />
    <echo message="buildpath = ${formatted-buildpath}" />
    <property name="buildpath-set" value="true" />
  </target>

This tells the <buildpath> datatype that it should delegate to the specified
build path resolver (TahoeBuildPathResolver in my case) when requested to
provide the ordered list of sub-projects to build.

The resolver reads my dependencies.xml file, handing out that info in a
standard way to another class that actually checks for cycles and does the
ordering of the sub-projects.

Then the <buildpath> is used by reference by <subant>, as below:

  <target name="clean" depends="buildfiles, buildpath"
          description="Deletes all the modules' compiled classes">
    <subant buildpathref="buildpath">
      <property name="-buildmagic-defined" value="true" />
      <property name="-ant-contrib-defined" value="true" />
    </subant>
    ...
  </target>

The scenario above requires writing a new type of resolver to extract the
dependency info from a properties file (as you defined) instead of a more
complicated XML file as I do.

I have been meaning to post this updated version of <subant>, but without a
concrete resolver anyone could use, it would be useless to users (unless
they write a resolver). I'll try to write something up and package it.

When I do that is the issue ;-) Cheers, --DD

-----Original Message-----
From: Dean Hiller [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, January 04, 2003 10:36 AM
To: [EMAIL PROTECTED]
Subject: does ant have opposite of pathconvert?

Here is a very tough one....

I would like to set up a depency.properties file like so
serviceA = serviceA
serviceB = serviceB
serviceC = serviceC
serviceA.depends = serviceB serviceC
serviceB.depends = common
serviceC.depends = common

This is so I can easily see and change my dependencies on the modules in 
my project.  Each service above has it's own ant build file already. 
 This properties file is for the master ant build file.

Now I have one target of my build file looking like so
<target name="${serviceA}" depends="${serviceA.depends}"/>
   <copy todir="${serviceA}/temp.lib">
<!-- Before this step, I need to convert ${serviceA.depends} so it looks 
like "serviceB/dist/*" and "serviceC/dist/*" and then convert
        that into a fileset somehow.  I have no idea how to do either. 
The second is exactly the opposite of pathconvert-->
         <fileset dir="Need to take
   </copy>
   <ant antfile="${serviceA} target="build" dir="${serviceA}"/>
</target>


thanks for any out of the box ideas on this one,
Dean


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

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

Reply via email to