ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: arg and jvmarg
Date Wed, 16 Apr 2008 12:57:53 GMT
Dave Pawson wrote:
> On 16/04/2008, Steve Loughran <stevel@apache.org> wrote:
> 
>>> Saxon XSLT processor.
>>> -o filename is the parameter. I'd always thought of it as one param.
>>> Name (-o)
>>> value (filename)
>>> Ant seems to view it differently.
>>>
>>  Its two separate parameters when you break up the command line by spaces,
>> which is what C main(char **argv)  does by the time every native program
>> gets a look in. And The Java Runtime exec() call takes the same list of
>> arguments, which is what ant sets up
>>
>>  When you go <arg line> ant splits up the line by spaces, and gets it wrong
>> when there are spaces in filenames -just as the shell would. When you build
>> it up using <arg value>, spaces in filenames get handled correctly.
>>
>>  If you build on on unix, you may not notice these problems, but other
>> developers may hit the problem. Its safest, therefore, to use arg value,
>> except in the special case that you want people who override your build file
>> to include a whole list of custom arguments (like custom JVM
>> properties/options).
> 
> 
> I can see the simpler interpretation Steve, just looks odd from
> the user perspective? Saxon does just the same as you say,
> but processes arg pairs (for such as -o, -x etc).

well, ant itself looks for arguments that follow the previous one. But 
they shouldnt say
if(arg[index].startswith("-o ")) setOutputFile(arg[index].substring(2);

what normally happens is more
  if(arg[index].startswith("-o ")) {
   index++;
   if(index>=arg.length) throw new NotEnoughValuesException("expected 
something after -o");
   setOutputFile(arg[index]);
   index++;
}

this pulls in two arguments and checks that there are two before doing 
the work. Or they use commons-cli to do this part of the grunge work.

> 
> I've given up with the xslt task now;
> Need it to handle a different parser (xercesImpl) for xIncludes
> and Apache resolver.jar for catalogs - I don't think
> the xslt task can hack that?

-you should be using xercesImpl from ANT_HOME/lib anyway...drop in a new 
version if you want to change that.
-resolver.jar is used for catalog resolution; I dont know what happens 
with xincludes

if xinclude doesnt work when resolver.jar is on the classpath, that's a 
feature to fix...

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

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


Mime
View raw message