You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ru...@us.ibm.com on 2000/05/23 04:32:45 UTC

Call for patches


.duncan wrote:
>Probably too early in the game. In the requirements doc, there's a start
>at talking about how this could be done. We need to have consensus on
>that and implementation of course.

It is hard to achieve consensus when we never seem to even have a quorum.
Yes, Duncan, I'm talking about you.  And me, lately, for that matter.

Due to the recent security breach, it is difficult to get new committers.
And the same breach contributed to the downfall of the only tracking system
we have had to date - Bugzilla.

Over the next few weeks, I am going to try to commit a bunch of changes.
I'm going to look at my personal archives for this mailing list, but quite
frankly if you have something that you want added, the way to increase your
changes is to post it again.  Now.

Things I'll be looking for:

1) bug fixes.  Things obviously broken.

2) consistency.  Task A calls one thing bar, Task B calls a similar thing
baz.

3) extensibility, maintainability enhancements for taskdef writers.  Unless
it is a clear simplification, I am *not* looking for changes to build.xml
files at this time.

4) new, independent, tasks.  Preferably, something that does something
novel or different.  Ones that do *not* require changes to the "core" of
Ant.

5) cleanup.  Deprecated items, for example, should ultimately be removed.

Once the ability to get new committers opens up a bit, I plan to propose a
few.  Yes, I could propose committers now, but I couldn't tell you when
they would be effective.  Furthermore, I have other things in the queue for
the people with root access that - yes, a bit selfishly - I would like to
see done first.

People I will be looking for are people with perseverance  And with
opinions.  And not necessarily ones I agree with.  It will take more than a
few sparks to keep this flame lit.

- Sam Ruby

P.S.  Please send the patches here, and not directly to me.



Re: Call for patches

Posted by Stefan Bodewig <bo...@bost.de>.
Does anybody by any chance have a copy of Thomas Haas' FileTranslation
task?  Tom seems to be unavailable at the moment (vacation I guess).

This task collapsed Fixcrlf, Replace and Keysubst into one IIRC. I
can't remember whether it extended MatchingTask (it should) so maybe
it would be better to include this task than to add RelaceMultiple as
new task with that much overlap to Replace.

Stefan

Re: Call for patches

Posted by Ken Wood <kw...@i2.com>.
I've used multiple targets and the depends
list to resolve my needs (so far) for 
multiple properties in the 'if'. Just
have several targets, each of which depends
on one property, and does one thing, and a
final target that depends on the other
targets that have conditionals. 

I agree with Stefan that the potential for
this to get out of hand is potentially too
great....

Stefan Bodewig wrote:
> 
> >>>>> "RB" == Ross Burton <ro...@lineone.net> writes:
> 
>  RB> I wanted Ant to be able to deal with multiple "if"s in the
>  RB> <target> block,
> 
> I'm not convinced this is a good idea. If you open the box with this
> ANDing of properties, others will need ORing and even more fancy
> operations.
>

Re: Call for patches

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "RB" == Ross Burton <ro...@mail.com> writes:

 RB> I just needed a way of saying (prop1 && prop2), but
 RB> didn't really think about all of the other options.  Without
 RB> allowing full use of && and || , there is no simple answer.

Hmm, ANDing can be done via

<target name="outer" if="cond1" depends="inner" />

<target name="inner" if="cond2">
...
</target>

It's not elegant though.

Stefan

Re: Call for patches

Posted by Ross Burton <ro...@mail.com>.
>  RB> I wanted Ant to be able to deal with multiple "if"s in the
>  RB> <target> block,
>
> I'm not convinced this is a good idea. If you open the box with this
> ANDing of properties, others will need ORing and even more fancy
> operations.
>
> Then, your patch is going to collide with the announced patch to add
> an "unless" attribute to target by Brill Pappin.
>
> What would be the meaning of unless="prop1, prop2"? prop1 doesn't
> exist OR prop2 doesn't exist (which would be the exact opposite of
> your if) or neither prop1 nor prop2 exist?
>
> I see the need to change something with regard to the conditional
> execution stuff but don't think adding boolean operations is the right
> direction - although I cannot offer something better at the moment.

Good point.  I just needed a way of saying (prop1 && prop2), but didn't
really think about all of the other options.  Without allowing full use of
&& and || , there is no simple answer.

Ross Burton


Re: Call for patches

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "BB" == Bill Barnhill <bb...@twcny.rr.com> writes:

 BB> If a target has both if and unless both need to pass for target
 BB> to be evaluated, right?

To match the behaviour of MatchingTask.NameEntry, yes.

Stefan

Re: Call for patches

Posted by Bill Barnhill <bb...@twcny.rr.com>.
> What I envision is something like
> <availablelist property=myapp.requirements
> classes=needed1,needed2,needed3 resources=needed5>
> <notavailablelist property=myapp.abort classes=abort1,abort2
> file=abort3>
> <target ... if=myapp.requirements  unless=myapp.abort ...>

Errata:
1. If a target has both if and unless both need to pass for target to
be evaluated, right?
2. notavailablelist supports classes,files, and resources, NOT file.
Typo

----- Original Message -----
From: "Bill Barnhill" <bb...@twcny.rr.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, May 23, 2000 10:00 AM
Subject: Re: Call for patches


> An opposite of availablelist, notavailablelist  might be an idea as
> well.
>
> What I envision is something like
> <availablelist property=myapp.requirements
> classes=needed1,needed2,needed3 resources=needed5>
> <notavailablelist property=myapp.abort classes=abort1,abort2
> file=abort3>
> <target ... if=myapp.requirements  unless=myapp.abort ...>
>
> Bear in mind the above are all or nothing. All the items are
available
> or FALSE.  All the items are not available or FALSE. i.e. one
> available item cause notavailablelist  to set FALSE, one not
available
> item cause availablelist to set FALSE
> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@bost.de>
> To: <an...@jakarta.apache.org>
> Sent: Tuesday, May 23, 2000 9:08 AM
> Subject: Re: Call for patches
>
>
> > >>>>> "RB" == Ross Burton <ro...@lineone.net> writes:
> >
> >  RB> I wanted Ant to be able to deal with multiple "if"s in the
> >  RB> <target> block,
> >
> > I'm not convinced this is a good idea. If you open the box with
this
> > ANDing of properties, others will need ORing and even more fancy
> > operations.
> >
> > Then, your patch is going to collide with the announced patch to
add
> > an "unless" attribute to target by Brill Pappin.
> >
> > What would be the meaning of unless="prop1, prop2"? prop1 doesn't
> > exist OR prop2 doesn't exist (which would be the exact opposite of
> > your if) or neither prop1 nor prop2 exist?
> >
> > I see the need to change something with regard to the conditional
> > execution stuff but don't think adding boolean operations is the
> right
> > direction - although I cannot offer something better at the
moment.
> >
> > Stefan
> >
>
>


Re: Call for patches

Posted by Bill Barnhill <bb...@twcny.rr.com>.
An opposite of availablelist, notavailablelist  might be an idea as
well.

What I envision is something like
<availablelist property=myapp.requirements
classes=needed1,needed2,needed3 resources=needed5>
<notavailablelist property=myapp.abort classes=abort1,abort2
file=abort3>
<target ... if=myapp.requirements  unless=myapp.abort ...>

Bear in mind the above are all or nothing. All the items are available
or FALSE.  All the items are not available or FALSE. i.e. one
available item cause notavailablelist  to set FALSE, one not available
item cause availablelist to set FALSE
----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Tuesday, May 23, 2000 9:08 AM
Subject: Re: Call for patches


> >>>>> "RB" == Ross Burton <ro...@lineone.net> writes:
>
>  RB> I wanted Ant to be able to deal with multiple "if"s in the
>  RB> <target> block,
>
> I'm not convinced this is a good idea. If you open the box with this
> ANDing of properties, others will need ORing and even more fancy
> operations.
>
> Then, your patch is going to collide with the announced patch to add
> an "unless" attribute to target by Brill Pappin.
>
> What would be the meaning of unless="prop1, prop2"? prop1 doesn't
> exist OR prop2 doesn't exist (which would be the exact opposite of
> your if) or neither prop1 nor prop2 exist?
>
> I see the need to change something with regard to the conditional
> execution stuff but don't think adding boolean operations is the
right
> direction - although I cannot offer something better at the moment.
>
> Stefan
>


Re: Call for patches

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "RB" == Ross Burton <ro...@lineone.net> writes:

 RB> I wanted Ant to be able to deal with multiple "if"s in the
 RB> <target> block,

I'm not convinced this is a good idea. If you open the box with this
ANDing of properties, others will need ORing and even more fancy
operations.

Then, your patch is going to collide with the announced patch to add
an "unless" attribute to target by Brill Pappin.

What would be the meaning of unless="prop1, prop2"? prop1 doesn't
exist OR prop2 doesn't exist (which would be the exact opposite of
your if) or neither prop1 nor prop2 exist?

I see the need to change something with regard to the conditional
execution stuff but don't think adding boolean operations is the right
direction - although I cannot offer something better at the moment.

Stefan

Re: Call for patches

Posted by Eugene Bekker <eb...@powervision.com>.
I didn't notice the SCRIPT task, but that may be because I use an older
version of Ant that doesn't come with a lot of the recent optional tasks.

One thing to note, in my implementation I actually support script blocks in
terms of processing instructions (PI) instead of as <script> tags, because
it allows me to use the <, >, and & characters in the code without having
to escape them.  For example:

<?script
  var foo = 1;
  var bar = 2;
  var cond = (foo < bar) && (bar - foo > 0);
?>

instead of writing:

<script>
  var foo = 1;
  var bar = 2;
  var cond = (foo &lt; bar) &amp;&amp; (bar - foo &gt; 0);
</script>

To support the language attribute in your example, you could simply use a
composite PI tag like
  <?script:JavaScript  ... ?>

Finally, I exported into the JavaScript engine a couple of objects that
allows me to interface back and forth such as sysin, sysout, and syserr
which map to System.in, .out, and .err respectively, and sysprops which
maps to the Properties object from System.getProperties().  So something
similar can be done to interface to targets, tasks, and properties.


Stefan Bodewig wrote:
> 
> >>>>> "EB" == Eugene Bekker <eb...@powervision.com> writes:
> 
>  EB> I notice there are more and more requests to beef up the logic
>  EB> support for tasks, like IFNOT and multiple IFs.  One thing to
>  EB> consider is to drop in an existing logic parser, that would allow
>  EB> nested and more complicated boolean statements, such as Mozilla's
>  EB> Rhino JavaScript engine.
> 
> Did you notice the optional script task? It uses BSF as its framework
> and Rhino amongst others is supported by it.
> 
> Probably using scripts would make a lot of the conditional compilation
> stuff easier. Let's assume that project properties, targets and tasks
> are exposed to the scripting language in some way, so you could write
> 
> <script language="JavaScript">
>     target["targetid"].setCondition(cond1 || (cond2 && !cond3));
> </script>
> 
> where cond1 may have been calculated by other tasks executed before
> this one or set by command line properties or ...
> 
> The drawback of this is that Ant would start to depend on BSF (or any
> other scripting framework for that matter).
> 
> Stefan

-- 
Eugene Bekker
Chief Architect
PowerVision Corporation
http://www.powervision.com
tel://410/312.7243 cel://443/838.6330

Re: Call for patches

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "EB" == Eugene Bekker <eb...@powervision.com> writes:

 EB> I notice there are more and more requests to beef up the logic
 EB> support for tasks, like IFNOT and multiple IFs.  One thing to
 EB> consider is to drop in an existing logic parser, that would allow
 EB> nested and more complicated boolean statements, such as Mozilla's
 EB> Rhino JavaScript engine.

Did you notice the optional script task? It uses BSF as its framework
and Rhino amongst others is supported by it.

Probably using scripts would make a lot of the conditional compilation
stuff easier. Let's assume that project properties, targets and tasks
are exposed to the scripting language in some way, so you could write

<script language="JavaScript">
    target["targetid"].setCondition(cond1 || (cond2 && !cond3));
</script>

where cond1 may have been calculated by other tasks executed before
this one or set by command line properties or ...

The drawback of this is that Ant would start to depend on BSF (or any
other scripting framework for that matter).

Stefan

Re: Call for patches

Posted by John Pappin <jo...@jmonkey.com>.
> I notice there are more and more requests to beef up the logic support for
> tasks, like IFNOT and multiple IFs.  One thing to consider is to drop in
an
> existing logic parser, that would allow nested and more complicated
boolean
> statements, such as Mozilla's Rhino JavaScript engine.

I'm thinking I need to clear this up a little... I don't think another
attribute should be added (as in the case of IFNOT) its not needed... all I
want to be able to do, is invert the result of the property... I don't think
anything else is needed (I also use the multiple targets to do &&'s and ||'s
(I like how simple it is).

Anyway, this would look like:
<target name="name" if="!property"/>

- Brill Pappin



RE: Call for patches

Posted by Vitaly Stulsky <vi...@yahoo.com>.
> I notice there are more and more requests to beef up the logic support for
> tasks, like IFNOT and multiple IFs.  One thing to consider is to drop in an
> existing logic parser, that would allow nested and more complicated boolean
> statements, such as Mozilla's Rhino JavaScript engine.
>
> On a project of mine we had a need for doing something similar (not for
> Ant, but for an XML properties file).  Certain tags had an IF attribute
> that was evaluated as boolean JavaScript code.  It allows us to put
> arbitrarily complex boolean logic.
>
> On top of that it also gave more script power within the properties file
> such as computing values based on system properties, and parsing and
> manipulating strings, etc...
>
> Integrating Rhino into our XML parsing was extremely trivial and took about
> 10-15 lines of code.

I love this idea. Even more - I'll be glad to write script code for the
difficult
logic pieces. I think this ability allows ant to cover huge part of complex
scripts.
For some purposes I use them now and will be glad to avoid their usage as
far as it possible.

Vitaly


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: Call for patches

Posted by Eugene Bekker <eb...@powervision.com>.
I notice there are more and more requests to beef up the logic support for
tasks, like IFNOT and multiple IFs.  One thing to consider is to drop in an
existing logic parser, that would allow nested and more complicated boolean
statements, such as Mozilla's Rhino JavaScript engine.

On a project of mine we had a need for doing something similar (not for
Ant, but for an XML properties file).  Certain tags had an IF attribute
that was evaluated as boolean JavaScript code.  It allows us to put
arbitrarily complex boolean logic.

On top of that it also gave more script power within the properties file
such as computing values based on system properties, and parsing and
manipulating strings, etc...

Integrating Rhino into our XML parsing was extremely trivial and took about
10-15 lines of code.




Bill Barnhill wrote:
> 
> I am working on something similar, but from a different take. Instead
> of multiple if's, it is a task called availablelist which takes
> paramters classes, resources, and files, each of which are plural
> versions of the class, resource, and file parameters of the available
> task. Also it will handle all three parameters at once or in any
> combo. Not ready to submit this yet as it still has a bit to go.
> 
> ----- Original Message -----
> From: "Ross Burton" <ro...@lineone.net>
> To: <an...@jakarta.apache.org>
> Sent: Tuesday, May 23, 2000 7:50 AM
> Subject: Re: Call for patches
> 
> > > Over the next few weeks, I am going to try to commit a bunch of
> changes.
> > > I'm going to look at my personal archives for this mailing list,
> but quite
> > > frankly if you have something that you want added, the way to
> increase
> > your
> > > changes is to post it again.  Now.
> >
> > I wanted Ant to be able to deal with multiple "if"s in the <target>
> block,
> > so that I can do this:
> >
> >     <available property="jpeg.present"
> >         classname="com.sun.image.codec.jpeg.JPEGCodec"/>
> >     <available property="java2d.present"
> >         classname="java.awt.image.BufferedImage"/>
> >
> >     <target name="prepare-jpeg" if="jpeg.present, java2d.present">
> >         ...
> >     </target>
> >
> > I think it works fine although I haven't given it a comprehensive
> test.  It
> > did what I expected when I tested it for about 10 minutes.  :-)
> >
> > Regards,
> > Ross Burton
> >
> >
> >
> > Index: ProjectHelper.java
> > ===================================================================
> > RCS file:
> >
> /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelpe
> r.java
> > ,v
> > retrieving revision 1.11
> > diff -r1.11 ProjectHelper.java
> > 175d174
> > <             target.setCondition(targetCond);
> > 187a187,196
> > >                 }
> > >             }
> > >
> > >             // Take care of conditions
> > >
> > >             if (targetCond.length() > 0) {
> > >                 StringTokenizer tok =
> > >                     new StringTokenizer(targetCond, ",", false);
> > >                 while (tok.hasMoreTokens()) {
> > >                     target.addCondition(tok.nextToken().trim());
> > Index: Target.java
> > ===================================================================
> > RCS file:
> >
> /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Target.java,
> v
> > retrieving revision 1.3
> > diff -r1.3 Target.java
> > 68c68
> > <     private String condition = "";
> > ---
> > >     private Vector conditions = new Vector(2);
> > 111,112c111,121
> > <     public void setCondition(String property) {
> > <         this.condition = (property == null) ? "" : property;
> > ---
> > >     public void setConditions(String conds) {
> > >         if (conds.length() > 0) {
> > >             StringTokenizer tok = new StringTokenizer(conds, ",",
> false);
> > >             while (tok.hasMoreTokens()) {
> > >                 addCondition(tok.nextToken().trim());
> > >             }
> > >         }
> > >     }
> > >
> > >     public void addCondition(String condition) {
> > >  conditions.addElement(condition);
> > 116c125
> > <         if (("".equals(this.condition)) ||
> > (project.getProperty(this.condition) != null)) {
> > ---
> > >         if ((this.conditions.size() == 0) || checkConditions()) {
> > 123c132
> > <             project.log("Skipped because property '" +
> this.condition + "'
> > not set.", this.name, Project.MSG_VERBOSE);
> > ---
> > >             project.log("Skipped because property '" +
> this.conditions + "
> > not set.", this.name, Project.MSG_VERBOSE);
> > 124a134,150
> > >     }
> > >
> > >     private boolean checkConditions() {
> > >  if (this.conditions.size() == 0) {
> > >      // No conditions, so always build
> > >      return true;
> > >  } else {
> > >      // We have a vector of conditions, iterate through them and
> check
> > >      for (Enumeration e = this.conditions.elements();
> > e.hasMoreElements(); ) {
> > >   String condition = (String)e.nextElement();
> > >   if (project.getProperty(condition) == null) {
> > >       // A condition has not been met, so cancel this task
> > >       return false;
> > >   }
> > >      }
> > >      return true;
> > >  }
> >
> >
> >

-- 
Eugene Bekker
Chief Architect
PowerVision Corporation
http://www.powervision.com
tel://410/312.7243 cel://443/838.6330

Re: Call for patches

Posted by Bill Barnhill <bb...@twcny.rr.com>.
Thank you for stating that better than I did. :)
I originally thought of extending the available task to simply accept
files, classes, and resources attributes as well as file, class,
resource attributes, but decided that would probably be frowned upon
as it touched somebody else's code.  As I said, this is my first open
source project so I ahve no clue as to the etiquette of what is
touchable and what isn't.  It does seem to make more sense and then
notavailablelist would become notavailable, which is more readable.
You hit my intended behavior for availablelist and notavailable dead
on.

Would anybody mind if I code this into available, instead of creating
a new task availablelist?

----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Tuesday, May 23, 2000 11:01 AM
Subject: Re: Call for patches


> >>>>> "BB" == Bill Barnhill <bb...@twcny.rr.com> writes:
>
>  BB> Instead of multiple if's, it is a task called availablelist
>  BB> which takes paramters classes, resources, and files, each of
>  BB> which are plural versions of the class, resource, and file
>  BB> parameters of the available task.
>
> I'd prefer a solution like this as it wouldn't require a change to
> Ant's core but merely add a task.
>
> But wouldn't it be better to extend the functionality of available
> instead of adding a new task with overlapping concerns?
>
> As for the notavailablelist task you describe in a different mail,
you
> explicitely say this is not the opposite of availablelist so the
name
> is kind of misleading. What I gather from your description:
>
> * All resources are there => avalailablelist is true,
notavailablelist
> is false.
>
> * None of the resources are there => avalailablelist is false,
> notavailablelist is true.
>
> * Any one of the resources is there but not all of them => both
> availablelist and notavailablelist are false.
>
> This makes for powerfull combinations but looks tricky (read as
needs
> a bunch of good documentation to match the simplicity goal).
>
> Stefan
>


Re: Call for patches

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "BB" == Bill Barnhill <bb...@twcny.rr.com> writes:

 BB> Instead of multiple if's, it is a task called availablelist
 BB> which takes paramters classes, resources, and files, each of
 BB> which are plural versions of the class, resource, and file
 BB> parameters of the available task.

I'd prefer a solution like this as it wouldn't require a change to
Ant's core but merely add a task. 

But wouldn't it be better to extend the functionality of available
instead of adding a new task with overlapping concerns?

As for the notavailablelist task you describe in a different mail, you
explicitely say this is not the opposite of availablelist so the name
is kind of misleading. What I gather from your description:

* All resources are there => avalailablelist is true, notavailablelist
is false.

* None of the resources are there => avalailablelist is false,
notavailablelist is true.

* Any one of the resources is there but not all of them => both
availablelist and notavailablelist are false.

This makes for powerfull combinations but looks tricky (read as needs
a bunch of good documentation to match the simplicity goal).

Stefan

Re: Call for patches

Posted by Bill Barnhill <bb...@twcny.rr.com>.
I am working on something similar, but from a different take. Instead
of multiple if's, it is a task called availablelist which takes
paramters classes, resources, and files, each of which are plural
versions of the class, resource, and file parameters of the available
task. Also it will handle all three parameters at once or in any
combo. Not ready to submit this yet as it still has a bit to go.


----- Original Message -----
From: "Ross Burton" <ro...@lineone.net>
To: <an...@jakarta.apache.org>
Sent: Tuesday, May 23, 2000 7:50 AM
Subject: Re: Call for patches


> > Over the next few weeks, I am going to try to commit a bunch of
changes.
> > I'm going to look at my personal archives for this mailing list,
but quite
> > frankly if you have something that you want added, the way to
increase
> your
> > changes is to post it again.  Now.
>
> I wanted Ant to be able to deal with multiple "if"s in the <target>
block,
> so that I can do this:
>
>     <available property="jpeg.present"
>         classname="com.sun.image.codec.jpeg.JPEGCodec"/>
>     <available property="java2d.present"
>         classname="java.awt.image.BufferedImage"/>
>
>     <target name="prepare-jpeg" if="jpeg.present, java2d.present">
>         ...
>     </target>
>
> I think it works fine although I haven't given it a comprehensive
test.  It
> did what I expected when I tested it for about 10 minutes.  :-)
>
> Regards,
> Ross Burton
>
>
>
> Index: ProjectHelper.java
> ===================================================================
> RCS file:
>
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelpe
r.java
> ,v
> retrieving revision 1.11
> diff -r1.11 ProjectHelper.java
> 175d174
> <             target.setCondition(targetCond);
> 187a187,196
> >                 }
> >             }
> >
> >             // Take care of conditions
> >
> >             if (targetCond.length() > 0) {
> >                 StringTokenizer tok =
> >                     new StringTokenizer(targetCond, ",", false);
> >                 while (tok.hasMoreTokens()) {
> >                     target.addCondition(tok.nextToken().trim());
> Index: Target.java
> ===================================================================
> RCS file:
>
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Target.java,
v
> retrieving revision 1.3
> diff -r1.3 Target.java
> 68c68
> <     private String condition = "";
> ---
> >     private Vector conditions = new Vector(2);
> 111,112c111,121
> <     public void setCondition(String property) {
> <         this.condition = (property == null) ? "" : property;
> ---
> >     public void setConditions(String conds) {
> >         if (conds.length() > 0) {
> >             StringTokenizer tok = new StringTokenizer(conds, ",",
false);
> >             while (tok.hasMoreTokens()) {
> >                 addCondition(tok.nextToken().trim());
> >             }
> >         }
> >     }
> >
> >     public void addCondition(String condition) {
> >  conditions.addElement(condition);
> 116c125
> <         if (("".equals(this.condition)) ||
> (project.getProperty(this.condition) != null)) {
> ---
> >         if ((this.conditions.size() == 0) || checkConditions()) {
> 123c132
> <             project.log("Skipped because property '" +
this.condition + "'
> not set.", this.name, Project.MSG_VERBOSE);
> ---
> >             project.log("Skipped because property '" +
this.conditions + "
> not set.", this.name, Project.MSG_VERBOSE);
> 124a134,150
> >     }
> >
> >     private boolean checkConditions() {
> >  if (this.conditions.size() == 0) {
> >      // No conditions, so always build
> >      return true;
> >  } else {
> >      // We have a vector of conditions, iterate through them and
check
> >      for (Enumeration e = this.conditions.elements();
> e.hasMoreElements(); ) {
> >   String condition = (String)e.nextElement();
> >   if (project.getProperty(condition) == null) {
> >       // A condition has not been met, so cancel this task
> >       return false;
> >   }
> >      }
> >      return true;
> >  }
>
>
>


Re: Call for patches

Posted by Ross Burton <ro...@lineone.net>.
> Over the next few weeks, I am going to try to commit a bunch of changes.
> I'm going to look at my personal archives for this mailing list, but quite
> frankly if you have something that you want added, the way to increase
your
> changes is to post it again.  Now.

I wanted Ant to be able to deal with multiple "if"s in the <target> block,
so that I can do this:

    <available property="jpeg.present"
        classname="com.sun.image.codec.jpeg.JPEGCodec"/>
    <available property="java2d.present"
        classname="java.awt.image.BufferedImage"/>

    <target name="prepare-jpeg" if="jpeg.present, java2d.present">
        ...
    </target>

I think it works fine although I haven't given it a comprehensive test.  It
did what I expected when I tested it for about 10 minutes.  :-)

Regards,
Ross Burton



Index: ProjectHelper.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
,v
retrieving revision 1.11
diff -r1.11 ProjectHelper.java
175d174
<             target.setCondition(targetCond);
187a187,196
>                 }
>             }
>
>             // Take care of conditions
>
>             if (targetCond.length() > 0) {
>                 StringTokenizer tok =
>                     new StringTokenizer(targetCond, ",", false);
>                 while (tok.hasMoreTokens()) {
>                     target.addCondition(tok.nextToken().trim());
Index: Target.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Target.java,v
retrieving revision 1.3
diff -r1.3 Target.java
68c68
<     private String condition = "";
---
>     private Vector conditions = new Vector(2);
111,112c111,121
<     public void setCondition(String property) {
<         this.condition = (property == null) ? "" : property;
---
>     public void setConditions(String conds) {
>         if (conds.length() > 0) {
>             StringTokenizer tok = new StringTokenizer(conds, ",", false);
>             while (tok.hasMoreTokens()) {
>                 addCondition(tok.nextToken().trim());
>             }
>         }
>     }
>
>     public void addCondition(String condition) {
>  conditions.addElement(condition);
116c125
<         if (("".equals(this.condition)) ||
(project.getProperty(this.condition) != null)) {
---
>         if ((this.conditions.size() == 0) || checkConditions()) {
123c132
<             project.log("Skipped because property '" + this.condition + "'
not set.", this.name, Project.MSG_VERBOSE);
---
>             project.log("Skipped because property '" + this.conditions + "
not set.", this.name, Project.MSG_VERBOSE);
124a134,150
>     }
>
>     private boolean checkConditions() {
>  if (this.conditions.size() == 0) {
>      // No conditions, so always build
>      return true;
>  } else {
>      // We have a vector of conditions, iterate through them and check
>      for (Enumeration e = this.conditions.elements();
e.hasMoreElements(); ) {
>   String condition = (String)e.nextElement();
>   if (project.getProperty(condition) == null) {
>       // A condition has not been met, so cancel this task
>       return false;
>   }
>      }
>      return true;
>  }



Re: Call for patches

Posted by Bill Barnhill <bb...@twcny.rr.com>.
For those of us completely new to open source contributions, i.e. me
:)  What is the proper way to submit changes for review, once they
have been tested and we know they work?

I have a cvs repository which I created and imported in the sources
from the most recent release. I've been committing to this repository.
The release sources are tagged jakarta-ant-V1_00a and let's say my
version for review is wab-ant-V1_00b. Would the command to issue to
create the attachment to send be (on unix or Thompson toolkit-like sh)
        cvs diff -r jakarta-ant-V1_00a -r wab-ant-V1_00b >
wab0100b.pat  2<&1
?
.pat extension and filename format are my own convention, is there a
std for ant patch attachments?
If I understand the web site instructions the patch should be an
attachment, not in the body, and the subject line should be PATCH:
<insert short description here>. Is that right?

----- Original Message -----
From: "Conor MacNeill" <co...@cortexebusiness.com.au>
To: <an...@jakarta.apache.org>
Sent: Monday, May 22, 2000 10:51 PM
Subject: RE: Call for patches


> Sam,
>
> Can I send you one big diff? You would need to pick over the
entrails :-)
>
> Conor
>
> --
> Conor MacNeill
> conor@cortexebusiness.com.au
> Cortex eBusiness
>
>
>


RE: Call for patches

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Sam,

Can I send you one big diff? You would need to pick over the entrails :-)

Conor

--
Conor MacNeill 
conor@cortexebusiness.com.au
Cortex eBusiness