ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From caleysoldman <tampa_...@yahoo.com>
Subject Re: can filesets be stored in a properties file?
Date Fri, 08 Jun 2007 17:40:23 GMT

hi matt, thanks for your reply...here you are ant folx:

my requirement is to produce sql using ant. i am enjoined not to use
velocity, groovy, or anything but ant. 

as such, what i am trying to replicate is shell script logic because those
are my marching orders. i mention this because i'm sure real application
developers will object to this egregious misuse of ant... 

:arguing:

regardless, what i did was create a working build ...all i really need to
understand is how to move the fileset to an external file that will then be
used based on the DBMS property which value is passed at the command line.
thanks in advance for your help ant folx!

<?xml version="1.0" ?>

<!-- #######################################################################
-->
<!-- Project Line               -->
<!-- #######################################################################
-->
<project default="createTableSQL">

 <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
 <taskdef resource="customtasks.properties"/>
 <typedef resource="customtypes.properties"/>

 <property file="${basedir}/generic.properties" />
 <property name="DBMS" value="NOT_SET" />

<!-- ############################################################# -->
<!-- Target to loop through the files -->
<!-- ############################################################# -->
 <target name="createTableSQL" depends="commandline">

 <echo>
  Producing SQL for DBMS ${DBMS}
 </echo>

<!-- ############################################################# -->
<!-- Outer for loop for the typical tables -->
<!-- ############################################################# -->
  <for param="tabfiles">
   <fileset refid="typicalTableSQL"/>
   <sequential>
    <processfile file="@{tabfiles}"/>

<!-- ############################################################# -->
<!-- Nested for loop for the typical storage -->
<!-- ############################################################# -->
     <for param="storage">
      <fileset refid="typicalTabStorage"/>
       <sequential>
        <processfile file="@{storage}"/>
       </sequential>
     </for>

   </sequential>
  </for>

 </target>

<!-- ############################################################# -->
<!-- MACRO to process the files -->
<!-- ############################################################# -->
 <macrodef name="processfile">
  <attribute name="file"/>
   <sequential>
    <echo>Process @{file}</echo>
     <concat destfile="test.txt" append="true">
      <fileset file="@{file}"/>
       <filterchain>
        <expandproperties/>
       </filterchain>
     </concat>
   </sequential>
 </macrodef>

<!-- ############################################################## -->
<!-- Validate Command Line Args -->
<!-- ############################################################## -->
 <target name="commandline">
  <if>
   <equals arg1="ora" arg2="${DBMS}" />
    <then>
     <property file="${basedir}/${DBMS}.properties" />
    </then>
  <elseif>
   <equals arg1="db2" arg2="${DBMS}" />
    <then>
     <property file="${basedir}/${DBMS}.properties" />
    </then>
  </elseif>
  <else>
   <fail>
    ERROR: Missing Command Line Property Varialbe DBMS: ${DBMS}.
   </fail>
  </else>
  </if>
 </target>

<!-- ############################################################# -->
<!-- Fileset for typical tables -->
<!-- ############################################################# -->
 <fileset
  id="typicalTableSQL"
  dir="sql_def/tables" >
  <include name="**/*.tmplt"/>
  <exclude name="a.tmplt"/>
  <exclude name="b.tmplt"/>
  <exclude name="${EXCLUDE01}.tmplt"/>
 </fileset>

<!-- ############################################################# -->
<!-- Fileset for typical table storage -->
<!-- ############################################################# -->
 <fileset
  id="typicalTabStorage"
  dir="sql_def/storage" >
  <include name="${DBMS}_typtab_storage.tmplt"/>
 </fileset>

</project>



-- 
View this message in context: http://www.nabble.com/can-filesets-be-stored-in-a-properties-file--tf3890587.html#a11030923
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message