ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types
Date Sun, 30 Dec 2001 11:25:29 GMT
On Sun, 30 Dec 2001 18:15, Steve Loughran wrote:
> I am +1 on metadata. Personally I think the md. associated with an attr
> should be very detailed:
>
>  /**
>   * @since 1.9
>   * @ant:attribute set the dir to use
>   * @ant:default current dir
>   * @ant:optional
>   * @ant:validator org.apache.ant.validators.SourceDirValidator
>   */
>  void setSrcDir( File src )
>  {
>  }

looks good to me. You could also specify relationships between 
attributes/elements. ie Dont set this attribute if attribute foo is set or 
element bar has been added etc.

> However, the metadata derived validators still cant
>  -probe failonerror status

failonerror has to go away in Ant2 or I gonna scream ;)

I have actually been playing with something like try-catch-finally in ant 
tasks recently. It is a bit verbose

<tblock>
  <try>
   ...insert tasks here...
  </try>
  <catch>
   ...insert error response code here or have empty if want failonerror=true  
  </catch>
  <finally>
    ..general cleanup here...
  </finally>
</tblock>

It seems to cover all the situations I have tried but has an ugly name (can 
anyone think of a better one?). Is there a better "declarative" way of doing 
this?

Anyways what do you think of a construct like that ?

>  -let the task spec their own error message
> and any other task specific stuff

yep - but that could be an advantage ;) Worst case you can just turn off all 
validation and do it like we do it today. Alternatively you could pass in 
parameters to your validator that specify the error strings etc.

> So the effort of a task is fairly minimal, you state in code what you want,
> not metadata but get to pass in current state in the process.
>
> This is *very* easy to start adding...

It would be great to at least start extracting the validation code into 
separate classes...

-- 
Cheers,

Pete

"Artists can color the sky red because they know it's blue.  Those of us who
 aren't artists must color things the way they really are or people might 
 think we're stupid." -- Jules Feiffer 

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message