开发者

problem with ant script properties

The following is my ant script:

<project name="nightly_build" default="main" basedir="C:\Work\6.70_Extensions\NightlyBuild">
    <target name="init">
        <sequential>
            <exec开发者_JS百科 executable="C:/Work/Searchlatestversion.exe">
                <arg line='"/SASE Lab Tools" "6.70_Extensions/6.70.102/ANT_SASE_RELEASE_"'/>
            </exec>
            <property file="C:/Work/latestbuild.properties"/>
            <sleep seconds="10"/>
            <echo message="The product version is ${Product_Version}"/>
            <exec executable="C:/Work/checksnapshot.exe">
                <arg line='"ANT_SASE_RELEASE_${Product_Version}_SASE Lab Tools-NightlyBuild" ANT_SASE_RELEASE_${Product_Version}_AnalyzerCommon-NightlyBuild ${Product_Version}-AppsMerge' />
            </exec> 
            <property file="C:/Work/checksnapshot.properties"/>
            <tstamp>
                <format property="suffix" pattern="ddMMyyyyHHmm"/>
            </tstamp>
        </sequential>
    </target>
    <target name="main" depends="init">
            <echo message="loading properties files.." />
            <sleep seconds="10"/>
            <echo message="Backing up folder" />
            <move file="C:\NightlyBuild\NightlyBuild" tofile="C:\NightlyBuild\NightlyBuild.${suffix}" failonerror="false" />
            <parallel>
                <exec executable="C:/Work/sortfolder.exe">
                    <arg line="6" />
                </exec>
                <exec executable="C:/Work/6.70_Extensions/NightlyBuild/antc.bat">
                </exec>
            </parallel>
    </target>
</project>

Basically the sequence goes something like this:

  1. I will run Searchlatestversion.exe and write latestbuild.properties
  2. Using the latestbuild.properties i will obtain ${Product_Version} and would like to allow checksnapshot.exe access to latestbuild.properties and obtain ${Product_Version}
  3. checksnapshot.exe will then generate checksnapshot.properties which will then be used by the target in main antc.bat

am i doing something wrong over here? seems like ${Product_Version} is not being received well by checksnapshot.exe


You appear to have a hard coded wait period of 10 seconds for Searchlatestversion to write out your file. If the executable does not complete inside that time, ${Product_Version} cannot be read from file.

Have you considered using the Waitfor Ant Task? As the name implies, this will wait for a certain condition before it will allow the rest of the task to progress. You could do something like

<property name="props.file" value="C:/Work/latestbuild.properties"/>
<waitfor maxwait="10" maxwaitunit="second">
  <available file="${props.file}"/>
</waitfor>
<property file="${props.file}"/>


Does Searchlatestversion.exe produce the file C:/Work/latestbuild.properties?

If so, should you not sleep/wait before you load that properties file?

You have this:

        <exec .../>
        <property file="C:/Work/latestbuild.properties"/>
        <sleep seconds="10"/>

Should you not have this:

        <exec ... />
        <sleep seconds="10"/>
        <property file="C:/Work/latestbuild.properties"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜