The "Current Code" below works. It simply checks to see what environment (passed on the command line) the build is being run for and then calls the target based on the environment. I now want to add a little more logic that checks for the existence of a file on the file system, and then if it exist it will do something different. This is my problem/question...
I need to add an <and> tag, and don't even know if this is supported. The other issue is that I don't know what the syntax is to see if a property is set (the one that is set if the file exists). Under the "Current Code" below I put what I want in English, including some comments. Could you take a look at the "Future Code" below and correct the syntax as needed for the <and> statement and checking for the existence of a property being set?
Thanks!
Lisa
***************** START CURRENT CODE **********************
<target name="FTPFileTask">
<tstamp><format property="current.time" pattern="hh:mm:ss"/></tsta
mp>
<echo>FTP Filles for ${ant.project.name} at ${current.time}</echo>
<taskdef resource="net/sf/antcontri
b/antcontr
ib.propert
ies"/>
<if>
<equals arg1="${property.env.name}
" arg2="DEV" />
<then>
<antcall target="FTPFiles"/>
</then>
<else>
<if>
<equals arg1="${property.env.name}
" arg2="QA" />
<then>
<antcall target="FTPQAFiles"/>
</then>
<else>
<if>
<equals arg1="${property.env.name}
" arg2="PROD" />
<then>
<antcall target="FTPPRODFiles"/>
</then>
</if>
</else>
</if>
</else>
</if>
<tstamp><format property="current.time" pattern="hh:mm:ss"/></tsta
mp>
<echo>Build ALL for ${ant.project.name} at ${current.time}</echo>
</target>
***************** END CURRENT CODE **********************
***************** START FUTURE CODE **********************
<target name="FTPFileTask">
<tstamp><format property="current.time" pattern="hh:mm:ss"/></tsta
mp>
<echo>FTP Filles for ${ant.project.name} at ${current.time}</echo>
<-- ADDED THESE TWO LINES -->
<available file="${property.app.name}
.propertie
s.QA" type="file" property="QAPropertiesFile
.exists"/>
<available file="${property.app.name}
.propertie
s.PROD" type="file" property="PRODPropertiesFi
le.exists"
/>
<taskdef resource="net/sf/antcontri
b/antcontr
ib.propert
ies"/>
<if>
<equals arg1="${property.env.name}
" arg2="DEV" />
<-- ADDED THSESE THREE LINES. DON'T KNOW SYNTAX TO SEE IF PROPERTY IS SET OR IF AND IS ALLOWED-->
<and>
<the QAPropertiesFile.exist property is set>
</and>
<then>
<antcall target="FTPFiles"/>
</then>
<-- THIS ELSE STATEMENTS SAYS IF THERE ISN'T A QAPropertiesFile.exists PROPERTY SET THEN FTP TO ALL THREE ENVIRONMENTS -->
<else>
<if>
<equals arg1="${property.env.name}
" arg2="DEV" />
<then>
<antcall target="FTPFiles"/>
<antcall target="FTPQAFiles"/>
<antcall target="FTPPRODFiles"/>
</then>
<else>
<if>
<equals arg1="${property.env.name}
" arg2="QA" />
<then>
<antcall target="FTPQAFiles"/>
</then>
<else>
<if>
<equals arg1="${property.env.name}
" arg2="PROD" />
<then>
<antcall target="FTPPRODFiles"/>
</then>
</if>
</else>
</if>
</else>
</if>
</else>
</if>
<tstamp><format property="current.time" pattern="hh:mm:ss"/></tsta
mp>
<echo>Build ALL for ${ant.project.name} at ${current.time}</echo>
</target>
***************** END FUTURE CODE **********************
Start Free Trial