ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shankar S" <sha...@gmail.com>
Subject Passing properties as parameters to different targets in a build file
Date Sun, 02 Dec 2007 21:57:35 GMT
Hi all,

I have a project.properties file that define a set of properties for my
build system.
log.dir and build.dir are defined in project.properties. Based upon user's
confirguration these values are changed at build time.

My build.xml looks something like this:

<project name="TEST" default="Build_SS" basedir=".">
  <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask"/>
  <!-- Set the environment to access the environment variables -->
  <property environment="env" />

  <!-- Set the project property file -->
  <property file="project.properties" />

  <!-- Update the timestamp -->
  <tstamp/>

  <!-- Set up the build and log directories -->
  <if>
  <and>
   <equals arg1="${cvs.checkout}" arg2="true" />
   <equals arg1="${build.dir}" arg2="CVS_DIR" />
  </and>
 <then>
  <var name="build.dir" value="${root.dir}/${DSTAMP}_${TSTAMP}" />
  <var name="log.dir" value="../logs/${root_dir.name}/${DSTAMP}_${TSTAMP}"
/>
  <mkdir dir="${log.dir}" />
  <mkdir dir="${build.dir}" />
 </then>
 <else>
  <var name="build.dir" value="${local_root.dir}" />
  <var name="log.dir" value="${local_log.dir}" />
 </else>
  </if>
   <target name="Build_SS" >
 <if>
   <equals arg1="${cvs.tag}" arg2="true" />
   <then>
   *<antcall target="Tag_All_CVS_Modules">
*    <param name="log.dir" value="${log.dir}"/>
   </antcall>



<target name="Tag_All_CVS_Modules" >
 <echo message="Log directory --> ${log.dir}" />
</target>


-----------------------------------------------------------------------------------------------------------------------------------
Firstly log.dir value is not being passed to target *"Tag_All_CVS_Modules".*
Secondly I tried passing the value using <param/> but no luck with that
either.

Is there a way to pass log.dir (and other properties) to different targets
in the same build file.

Thanks in advance;
-Shankar

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message