ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21505] - propertyfile does *2 instead of +1
Date Fri, 11 Jul 2003 15:35:16 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21505>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21505

propertyfile does *2 instead of +1

ts@appliedgenerics.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |



------- Additional Comments From ts@appliedgenerics.com  2003-07-11 15:35 -------
That is not the same thing at all.

Perhaps I didn't explain clearly enough.

Did you test my xml, typing something like
    java org.apache.tools.ant.Main bugDemo1 bugDemo2
at the command line?

The incorrect behaviour only happens if the target containing the propertyfile
task runs more than once.  There is no problem with running propertyfile
multiple times within a target.

Your xml would show the problem if you removed the delete task and specified
targets "all all" on the command line (or "all bugDemoInit" or "all all all" etc.)

Also, you say that the property file is loaded automatically, but I find that it
is undefined until an explicit <property file=.../> is run.

Here is this output from a slightly changed build.xml (better debug output):

[prompt]$ cat build.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="demoproj" default="notUsed">
   <target name="notUsed"/>

   <target name="bugDemo1" depends="bugDemoInit"/>

   <target name="bugDemo2" depends="bugDemoInit"/>

   <target name="bugDemoInit">
      <concat><fileset file="bugPropFile"/></concat>

      <echo>property at start of init is ${foo}</echo>

      <propertyfile file="bugPropFile">
         <entry key="foo" default="0" value="1" operation="+" type="int"/>
      </propertyfile>

      <echo>property after writing, but before reading file is ${foo}</echo>
      <property file="bugPropFile"/>
      <echo>property after reading file is ${foo}</echo>

      <concat><fileset file="bugPropFile"/></concat>
   </target>
</project>
[prompt]$ rm -f bugPropFile
[prompt]$ java $myJavaOptions org.apache.tools.ant.Main bugDemo1 bugDemo2
Buildfile: build.xml

bugDemoInit:
   [concat] Warning: Could not find any of the files specified in concat task.
     [echo] property at start of init is ${foo}
[propertyfile] Creating new property file: /home/ts/proj/bugPropFile
     [echo] property after writing, but before reading file is ${foo}
     [echo] property after reading file is 1
   [concat] #Fri Jul 11 16:01:35 BST 2003
   [concat] foo=1

bugDemo1:

bugDemoInit:
   [concat] #Fri Jul 11 16:01:35 BST 2003
   [concat] foo=1
     [echo] property at start of init is ${foo}
[propertyfile] Updating property file: /home/ts/proj/bugPropFile
     [echo] property after writing, but before reading file is ${foo}
     [echo] property after reading file is 1
   [concat] #Fri Jul 11 16:01:35 BST 2003
   [concat] foo=2

bugDemo2:

BUILD SUCCESSFUL
Total time: 2 seconds
[prompt]$ java $myJavaOptions org.apache.tools.ant.Main bugDemo1 bugDemo2
Buildfile: build.xml

bugDemoInit:
   [concat] #Fri Jul 11 16:01:35 BST 2003
   [concat] foo=2
     [echo] property at start of init is ${foo}
[propertyfile] Updating property file:
/homes/ts/project/default/common-main/bugPropFile
     [echo] property after writing, but before reading file is ${foo}
     [echo] property after reading file is 3
   [concat] #Fri Jul 11 16:02:06 BST 2003
   [concat] foo=3

bugDemo1:

bugDemoInit:
   [concat] #Fri Jul 11 16:02:06 BST 2003
   [concat] foo=3
     [echo] property at start of init is ${foo}
[propertyfile] Updating property file:
/homes/ts/project/default/common-main/bugPropFile
     [echo] property after writing, but before reading file is ${foo}
     [echo] property after reading file is 3
   [concat] #Fri Jul 11 16:02:06 BST 2003
   [concat] foo=6

bugDemo2:

BUILD SUCCESSFUL
Total time: 2 seconds
[prompt]$

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


Mime
View raw message