ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MNewc...@tacintel.com
Subject RE: [PATCH] adds 'if'/'unless' to <antcall> (CallTarget.java)
Date Tue, 26 Nov 2002 16:45:42 GMT
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> 
> On Tue, 26 Nov 2002, <MNewcomb@tacintel.com> wrote:
> >> -----Original Message-----
> >> From: Stefan Bodewig [mailto:bodewig@apache.org]
> >> 
> >> In the case of <antcall> I pretty much doubt it would be too useful
> >> as you could always add the if/unless attributes to the target you
> >> intend to call.
> > 
> > No, you can't really do that because if/unless tests for a
> > properties existence.  How would you *not* pass a property using
> > <param>?
> 
> inheritall="false"

<target name="my-func" unless="my-func.notRequired" depends="">
  <!-- do some stuff -->
</target>

<target name="call-my-func">
  <uptodate .../>
  <antcall target="my-func">
    <param name="my-func.notRequired" value="?"/>
  </antcall>
</target>

How would this caller sometimes pass 'my-func.notRequired' and other times
not?  As soon as you create <param>, the property is defined for the callee.

> > I see <antcall> allowing me to write certain repetitive tasks
> > once-and-only-once.
> 
> IMHO writing a task to perform the "certain repetitive tasks" would be
> better than using <antcall>.

Example:

<target name="ejbdoclet" depends="">

  <!-- check parameters -->
  <fail unless="metainf" message="no 'metainf' parameter"/>
  <fail unless="gen.src" message="no 'gen.src' parameter"/>
  <fail unless="merge.dir" message="no 'merge.dir' parameter"/>
  <fail unless="ejb.spec" message="no 'ejb.spec' parameter"/>
  <fail unless="src" message="no 'src' parameter"/>
  <fail unless="includes" message="no 'includes' parameter"/>
  <fail unless="excludes" message="no 'excludes' parameter"/>

  <!-- create output directories -->
  <mkdir dir="${gen.src}"/>
  <mkdir dir="${metainf}"/>

  <ejbdoclet destdir="${gen.src}" mergedir="${merge.dir}"
             ejbspec="${ejb.spec}" verbose="true">

  <fileset dir="${src}" includes="${includes}"/>

  <packageSubstitution packages="ejb" substituteWith="interfaces"/>

  <remoteinterface/>
  <localinterface/>
  <homeinterface />
  <localhomeinterface/>

  <dataobject/>
  <valueobject/>

  <entitypk/>

  <entitycmp/>
  <entitybmp/>

  <session/>

  <dao>
    <packageSubstitution packages="ejb" substituteWith="dao"/>
  </dao>

  <utilobject includeGUID="true"/>

  <deploymentdescriptor destdir="${metainf}" validatexml="true"/>

  <jboss version="${jboss.version}" xmlencoding="UTF-8"
         destdir="${metainf}" validatexml="true"
         datasource="${datasource}"
         datasourcemapping="${datasourcemapping}"/>

  </ejbdoclet>
</target>

I really would rather not rape-and-paste this task for each of my 4
different EJB jar files.  I also do not want to expend the time running each
subtask if none of the *Bean files have changed...

Thanks,
Michael

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message