ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guido.bart...@gerling.de
Subject How can I unset a property when calling a new ant-file
Date Tue, 13 Mar 2001 16:47:19 GMT
Hi there.

I have written a build.xml which copies itself into other dirs and executes
itself, and sometimes does this ongoing.
Each dir has a property file with specific information.

How if a property is once set, I want to unset it, because I use this
property in the target with 'if' and 'unless'.

I understood, that a property is there if it is once used, even if the value
is "".

To avoid entering allways the if-target (so to say), I must be able to unset
a property or find another workaround.

Any idea?

In the posted example the following targets are in my focus:
<target name="module.dist2base" if="app.isbasemod" >
<target name="module.dist2lib" unless="app.isbasemod" >

The property "app.isbasemod" must be unset anywhere, I think.

Unsetting the property must occur somewhere near the different, I think.
    <ant antfile= .... >
      <property file="../${module.name}/etc/app-config.properties" />
    </ant>


Kind regrads

Guido

----------------------------------------------------------------------------
--------------------------------------------------------
The following example is not complete (missing build.xml and depend.xml)
----------------------------------------------------------------------------
--------------------------------------------------------
<project name="Update Buildfile" default="update" basedir=".">
<!-- $Id: update.xml,v 1.3 2001/03/13 16:00:40 U29812 Exp $  -->

  <property file="../pc-config.properties" />
<!-- "../pc-config.properties" soll folgenden Inhalt haben: (für lokale
Umgebung)
tomcat.home    = c:/into/server/tomcat
jdk.home       = c:/jbuilder4/jdk1.3
baselibs.home = ../dev
-->

  <property file="etc/app-config.properties" />
<!-- "app-config.properties" soll folgenden Inhalt haben: (für
projektbezogene Informationen)
app.name     	= uwgl
app.fullname	= Underwriting Guidelines
app.cvsname	= uwgl
app.iswebapp    = Nur setzen, wenn Anwendung eine Webapp
-->

  <target name="jars_to_base" if="app.isbasemod" >
    <echo message="module '${app.name}', is basemod: ${app.isbasemod}" />
    <copy todir="${baselibs.home}" >
        <fileset dir="dist" >
         <include name="*.jar"/>
         <exclude name="*_doc.jar,*_src.jar"/>
        </fileset>
    </copy>
    <copy todir="${baselibs.home}" file="dist/${app.name}_doc.jar" />
    <copy todir="${baselibs.home}" file="dist/${app.name}_src.jar" />
  </target>

  <target name="jars_to_tomcat" if="app.isbasemod" >
    <echo message="module '${app.name}', is basemod: ${app.isbasemod}" />
    <copy todir="${tomcat.home}/lib/" >
        <fileset dir="dist" >
           <include name="*.jar"/>
           <exclude name="*_doc.jar,*_src.jar"/>
        </fileset>
    </copy>
  </target>

  <target name="module.init" if="module.name" >
    <echo message="------------------------------------------" />
    <echo message="Init von '${module.name}'" />
    <echo message="------------------------------------------" />
    <echo message="antfile=../${module.name}/build.xml" />
    <echo message="dir=../${module.name}" />
    <echo message="../${module.name}/etc/app-config.properties" />

    <cvs package="${module.name}" dest=".." />

    <mkdir dir="../${module.name}/build" />
    <copy todir="../${module.name}/build" >
      <fileset dir="build" >
        <include name="*"/>
        <exclude name="CVS"/>
      </fileset>
    </copy>

    <ant antfile="etc/depend.xml" target="init" dir="../${module.name}" >
      <property file="../${module.name}/etc/app-config.properties" />
    </ant>

    <ant antfile="build/build.xml" target="dist" dir="../${module.name}" >
      <property file="../${module.name}/etc/app-config.properties" />
    </ant>

    <copy todir="." file="../${module.name}/etc/${module.name}.library" />

    <ant antfile="build/update.xml" target="module.dist2base"
dir="../${module.name}" >
      <property file="../${module.name}/etc/app-config.properties" />
    </ant>
    <ant antfile="build/update.xml" target="module.dist2lib" dir="." >
      <property file="../${module.name}/etc/app-config.properties" />
    </ant>

    <echo message="------------------------------------------" />
    <echo message="Init von '${module.name}' abgeschlossen" />
    <echo message="------------------------------------------" />
  </target>

  <target name="module.dist2base" if="app.isbasemod" >
    <echo message="module '${app.name}', is basemod: ${app.isbasemod}" />
    <ant antfile="build/update.xml" target="jars_to_base"
dir="../${module.name}" >
      <property file="../${module.name}/etc/app-config.properties" />
    </ant>
  </target>

  <target name="module.dist2lib" unless="app.isbasemod" >
    <echo message="module '${app.name}', is basemod: ${app.isbasemod}" />
    <copy todir="lib" >
      <fileset dir="../${module.name}/dist" >
        <include name="*.jar"/>
        <exclude name="*_doc.jar,*_src.jar" />
      </fileset>
    </copy>
    <delete>
      <fileset dir="lib" >
        <include name="*_doc.jar,*_src.jar" />
      </fileset>
    </delete>
  </target>


  <!-- Die einzelnen Module -->
  <target name="mod.basisservlet" >
    <antcall target="module.init" >
      <param name="module.name"      value="basisservlet"/>
    </antcall>
  </target>

  <target name="mod.gendoc" >
    <antcall target="module.init" >
      <param name="module.name"      value="gendoc"/>
    </antcall>
  </target>

  <target name="mod.log4j" >
    <antcall target="module.init" >
      <param name="module.name"      value="log4j"/>
    </antcall>
  </target>

  <target name="mod.ecs" >
    <antcall target="module.init" >
      <param name="module.name"      value="ecs"/>
    </antcall>
  </target>

  <target name="mod.toplink" >
    <antcall target="module.init" >
      <param name="module.name"      value="toplink"/>
    </antcall>
  </target>

</project>


Mime
View raw message