ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@us.ibm.com
Subject Re: Ant Principles
Date Wed, 19 Apr 2000 04:36:08 GMT


>> > ant projectfile.xml -prop foo=bar -prop baz=bop [target]
>>
>> At that point, I would consider making equal signs in targets illegal,
and
>> eliminating the "-prop" altogether.
>
>Hmmm. The rules about args get nasty if you do that... Even number of
>args after the build.xml file means all props, odd means props till the
>last one where the last one is a target to execute. There's got to be a
>better solution. I don't want to do -Dprop=value because that's too
>close to the way sys props are defined.

That's not the rules I was thinking of.  Let me try this way:

   for (int i = 0; i < args.length; i++) {
     String arg = args[i];
     int posEq = arg.indexOf("=");
     if (posEq > 0) {
       value = arg.substring(posEq+1);
       name = arg.substring(0, posEq);
       definedProps.put(name, value);
     } else {
       targets.addElement(arg);
     }
   }

Of course, this means that targets can't have equals in them - no big loss.

- Sam Ruby



Mime
View raw message