From: "Lev Zak" <[EMAIL PROTECTED]>
> I use ANT 1.4.1 on Windows 2000.
> I need to compare two properties (build number) that I take from a two
> different build.properties file.
> I have two installation in the different directory (d:/app1 and d:/app2)
and
> I would like to compare if this is the same build. For this I have a sign
of
> build number into the build.properties file under buildNumber key (e.g.
> buildNumber=200202031611).
> The part of build.xml target is a following:
>
> <target name="compare_build_number">
> <property name="build.prop.1" value="d:/app1/build.properties"/>
> <property name="build.prop.2" value="d:/app2/build.properties"/>
> <property file="${build.prop.1}"/>
> <property name="app1_ver" value="${buildNumber}"/>
> <property file="${build.prop.2}"/>
> <condition property="it_is_the_same_build">
> <equals arg1="${app1_ver"}" arg2="${buildNumber}"/>
> </condition>
> . . .
>
> I expected two defined values, app1_ver is a buildNumber of first
> application (d:/app1/build.properties) and buildNumber is a buildNumber of
> second application (d:/app2/build.properties), before a <condition> task
and
> I could to compare this values. But it is not happened. The second
> "<property file=" does not work. I tried to separate this target to two
> different targets which use "<property file=" each one. It was not helped.
I
> tried to use "<property resource=" instead of "<property file=". It was
not
> helped.
> What is wrong in my build.xml?
> What I missed?
> And what is the difference between <property resource=" and "<property
> file=" ?
Here is a workaround for your situation:
<property name="build.prop.1" value="d:/temp/app1/build.properties"/>
<property name="build.prop.2" value="d:/temp/app2/build.properties"/>
<replace file="${build.prop.1}" value="buildNumber.1">
<replacefilter token="buildNumber"/>
</replace>
<property file="${build.prop.1}"/>
<property file="${build.prop.2}"/>
<condition property="it_is_the_same_build">
<equals arg1="${buildNumber.1}" arg2="${buildNumber}"/>
</condition>
<replace file="${build.prop.1}" value="buildNumber">
<replacefilter token="buildNumber.1"/>
</replace>
> Lev.
>
Cheers,
Magesh
******************************************************
* Experience: The name men give to their mistakes. *
******************************************************
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>