ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mani G. Iyer" <i...@rcn.com>
Subject RE: CheckSum Task and Properties?
Date Wed, 02 Jun 2004 02:37:50 GMT

Yanrong:

The problem is that the <istrue> condition expects the value of the
property not the property itself.  So you will have to code something
like:
<istrue value ="${${f}.changed}"/>  but unfortunately this is not
allowed in Ant, althought you can use the <propertycopy> from
Ant-contrib to accomplish what you want.  My question to you is why do
you need to have properties as ${f}.verified or ${f}.changed when
something like file.verified or file.changed would do.  So you could
code something like:

<target name="SeeIfXChanged" >
     	<checksum file="${f}" verifyProperty="file.changed"/>
  	<condition property="file.verified">
	   <istrue value="${file.changed}"/>
	</condition>
      	<echo>Verification 02</echo>
</target>
<target name="ErrorMessageIfXChanged" depends="SeeIfXChanged"
if="file.verified">
      	<echo>Verification Succeeded</echo>
</target>

HTH.
Mani G. Iyer

-----Original Message-----
From: Yanrong Deng [mailto:Y-Deng@wiu.edu] 
Sent: Tuesday, June 01, 2004 9:01 PM
To: user@ant.apache.org
Subject: CheckSum Task and Properties?

   Mr. Mani G. Iyer helped Ms. Deng when we were using properties with 
   the checksum command to see if a value changed.  That is working for 
   us.   Thanks!

   However, I want to do the same thing where the file name is passed
   to one ant file using the "ant" task.  We are experiencing
   the same dificulty.

   The file ctM.xml  invokes the  ErrorMessageIfXChanged task of
ctdemo.xml
   However, the file name is passed  as the property "f".

   That is not working properly for us.  The "x" file has not
   changed but ant is not displaying "Verification Succeeded." 

__________________________________________________________
   Here is our main ant task (ctM.xml)


<project default="all">
  <target name="all">
    <ant target="GenerateCheckSum" antfile="ctdemo.xml">
      <property name="f" value="x"/>
    </ant>
  </target>
  <target name="Verify">
     <ant target="ErrorMessageIfXChanged" antfile="ctdemo.xml">
        <property name="f" value="x"/>
     </ant>
  </target>
</project>

   Here is the ctdemo.xml ant task which ctM  invoked:


<project>
  <target name="GenerateCheckSum">
     <checksum file="${f}" forceoverwrite="yes"/>
     <echo>Verification 01 </echo>
   </target>
   <target name="SeeIfXChanged" >
     <checksum file="${f}" verifyProperty="${f}.changed"/>
	<condition property="${f}.verified">
	   <istrue value="${f}.changed"/>
	</condition>
      <echo>Verification 02</echo>
   </target>
   <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged" 
if="${f}.verified">
      <echo>Verification Succeeded</echo>
   </target>
</project>


    Here is the shell file we run
  
ant -debug -buildfile ctM.xml Verify


Here is its output (I abbreviated a few of the lines that are
not relevant to this problem.)



Apache Ant version 1.6.0 compiled on December 18 2003
Buildfile: ctM.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.4 in: /usr/java/j2sdk1.4.1_01/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.version -> Apache Ant version 1.6.0
compiled 
on December 18 2003
Setting ro project property: ant.file ->
/home/leffstudent/Project/ctM.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /home/leffstudent/Project/ctM.xml with URI = 
file:///home/leffstudent/Project/ctM.xml
Setting ro project property: ant.file.null ->
/home/leffstudent/Project/ctM.xml
Project base dir set to: /home/leffstudent/Project
 +Target: 
 +Target: all
 +Target: Verify
Build sequence for target `Verify' is [Verify]
Complete build sequence is [Verify, all, ]

Verify:
Adding reference: ant.ComponentHelper
    *** setting internal property variables here ***
Project base dir set to: /home/leffstudent/Project
Setting ro project property: f -> x
      [ant] calling target ErrorMessageIfXChanged in build 
file /home/leffstudent/Project/ctdemo.xml
Setting ro project property: ant.file ->
/home/leffstudent/Project/ctdemo.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /home/leffstudent/Project/ctdemo.xml with URI = 
file:///home/leffstudent/Project/ctdemo.xml
Setting ro project property: ant.file.null -
> /home/leffstudent/Project/ctdemo.xml
Project base dir set to: /home/leffstudent/Project
 +Target: 
 +Target: GenerateCheckSum
 +Target: SeeIfXChanged
 +Target: ErrorMessageIfXChanged
      [ant] Entering /home/leffstudent/Project/ctdemo.xml...
Build sequence for target `ErrorMessageIfXChanged' is [SeeIfXChanged, 
ErrorMessageIfXChanged]
Complete build sequence is [SeeIfXChanged, ErrorMessageIfXChanged, 
GenerateCheckSum, ]

SeeIfXChanged:
Setting project property: x.changed -> true
Condition false; not setting x.verified
     [echo] Verification 02

ErrorMessageIfXChanged:
Skipped because property 'x.verified' not set.
      [ant] Exiting /home/leffstudent/Project/ctdemo.xml.

BUILD SUCCESSFUL
Total time: 1 second


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




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


Mime
View raw message