ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject [PATCH] ant.bat - fix for -D args with spaces
Date Sun, 28 Jan 2001 02:20:38 GMT
Hello,

Here is a patch to ant.bat which fixes problems with spaces in the value
specified by a property such as -Dfoo="a b c".  Between the Ant 1.2
release and the current CVS version, someone changed the test in the
argument looping from %1a==a to "%1"=="" which broke the way quoted
arguments are appended together causing the script to fail.  In addition
to reverting this change, I made a small optimization for NT/2K so %* is
used to grab all the arguments instead of looping to get them.  As a
result, I renamed the target from "start" to "win9xArgs" which is now more
accurate.  Also made minor changes to a few of the comments.

This fix was tested on Windows NT 4.0 SP5 and Windows 98SE.

Here's a simple build file, proptest.xml:
<project name="PropTest" basedir="." default="main">
  <property name="p1" value="p1"/>
  <property name="p2" value="p2"/>
  <property name="p3" value="p3"/>
  <target name="main">
    <echo>
    p1="${p1}"
    p2="${p2}"
    p3="${p3}"
    </echo>
  </target>
</project>

Sure -debug will output the properties but you have to run against some
build file.  Here is a sample command:
  ant -f proptest.xml -Dp1="C:\Prog files" -Dp2=hello2 -Dp3="D:\ant home"
which should output:
main:
     [echo]
    p1="C:\Prog files"
    p2="hello2"
    p3="D:\ant home"

-Bill Burton
Mime
View raw message