ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 2137] New: - VAJAntToolGUI properties are evaluated the first run but not thereafter
Date Tue, 12 Jun 2001 20:24:44 GMT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2137

*** shadow/2137	Tue Jun 12 13:24:44 2001
--- shadow/2137.tmp.6781	Tue Jun 12 13:24:44 2001
***************
*** 0 ****
--- 1,137 ----
+ +============================================================================+
+ | VAJAntToolGUI properties are evaluated the first run but not thereafter    |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 2137                        Product: Ant                     |
+ |       Status: NEW                         Version: 1.3                     |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Major                    OS/Version: Windows NT/2K           |
+ |     Priority: Other                     Component: Optional Tasks          |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: jay_drummond@hotmail.com                                     |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ VAJAntToolGUI properties are evaluated the first run but not thereafter.
+ 
+ To reproduce, 
+ 
+ Create a task that updates a property. For example, a task that reports a 
+ random number each time it's run. I know this seems of little value but it's a 
+ simple test case. 
+ 
+ Here’s a simple build.xml file
+ 
+ <project name="simple" default="testReload" basedir=".">
+     <target name="testReload" description="qshow up">
+         <taskdef name="makeRandom" classname="com.test.RndNumber"/>
+         <makeRandom randomProperty="rnd.number"/>
+         <echo message="say number = ${rnd.number}"/>
+     </target>
+ </project>
+ 
+ See the end of this bug report for the Task code.
+ 
+ Load a build.xml file with the VAJ GUI tool. Build testReload. Note the rnd 
+ number is displayed. Click Build repeatedly.  
+ 
+ If you change the Message Level on the ANT GUI to debug. You'll see the 
+ property being set. See below:
+ 
+ testReload:
+ [echo] say number = 3
+ BUILD SUCCESSFUL
+ Total time: 0 seconds
+ 
+ testReload:
+ [echo] say number = 3
+ BUILD SUCCESSFUL
+ Total time: 0 seconds
+ 
+ <<<<<<<<debug message level on here>>>>>>>
+ 
+ Build sequence for target `testReload' is [testReload]
+ Complete build sequence is [testReload]
+  +User task: makeRandom     com.test.RndNumber
+ Setting project property: rnd.number -> 68
+ [echo] say number = 3
+ BUILD SUCCESSFUL
+ Total time: 0 seconds
+ 
+ 
+ 
+ ---- TASK CODE -----
+ 
+ package com.test;
+ 
+ import org.apache.tools.ant.*;
+ import org.apache.tools.ant.taskdefs.Execute;
+ import org.apache.tools.ant.taskdefs.LogStreamHandler;
+ import org.apache.tools.ant.types.Commandline;
+ 
+ import java.io.*;
+ import java.util.*;
+ 
+ 
+ /**
+  * Code to return the version number of a given project from the VAJ repository.
+  * @author Jay P. Drummond (4/24/01 4:18:02 PM)
+  */
+ public class RndNumber extends Task {
+ 
+ 
+ 
+ 
+ 
+ 	private java.lang.String randomProperty;
+ 
+ /**
+  * Undocumented method.
+  * <br>Added by Jay P. Drummond (6/12/01 3:45:58 PM)
+  */
+ public RndNumber() {}
+ 
+ 
+ /**
+  * Undocumented method.
+  * <br>Added by Jay P. Drummond (6/12/01 3:46:28 PM)
+  */
+ public void execute() throws BuildException {
+ 
+ 
+ 	Random rnd = new Random();
+ 
+ 	int val = (int) (rnd.nextDouble() * 255);
+ 
+ 	org.apache.tools.ant.Project aProj = getProject();
+ 	if (getRandomProperty() == null) {
+ 		String msg = "Must set randomProperty to a value.";
+ 		throw new BuildException(msg, location);
+ 	}
+ 
+ 	aProj.setProperty(getRandomProperty(), new Integer(val).toString());
+ 
+ }
+ 
+ 
+ /**
+  * Undocumented method.
+  * <br>Added by Jay P. Drummond (6/12/01 3:46:48 PM)
+  * @return java.lang.String
+  */
+ public java.lang.String getRandomProperty() {
+ 	return randomProperty;
+ }
+ 
+ 
+ /**
+  * Undocumented method.
+  * <br>Added by Jay P. Drummond (6/12/01 3:46:48 PM)
+  * @param newRandomProperty java.lang.String
+  */
+ public void setRandomProperty(java.lang.String newRandomProperty) {
+ 	randomProperty = newRandomProperty;
+ }
+ }
\ No newline at end of file

Mime
View raw message