DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19220>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19220

Enhance the <fail> and/or <available> and <condition> tasks to abort when 
specified files are absent

           Summary: Enhance the <fail> and/or <available> and <condition>
                    tasks to abort when specified files are absent
           Product: Ant
           Version: 1.5.3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Currently, each time we want to check the existence of a list of files before 
continuing, we have to write something very repetitive like :
    
    <available  property="exists.myLib1.jar"  file="myLib1.jar">
      <filepath refid="myPath"/>
    </available>
    <fail  unless="exists.myLib1.jar"
           message="*****  'myLib1.jar' not found  *****"/>
    
    <available  property="exists.myLib2.jar"  file="myLib2.jar">
      <filepath refid="myPath"/>
    </available>
    <fail  unless="exists.myLib2.jar"
           message="*****  'myLib2.jar' not found  *****"/>

...


I suggest that the <fail> task should accept the 'ifFile', 'unlessFile' and 
'filepathref' attributes and nested elements (plus others, like <available>), 
so 
that the test of failure could be shortened as :
    
<fail  filepathref="myPath">
  <unlessFile name="myLib1.jar"/>
  <unlessFile name="myLib2.jar"/>
  ...
</fail>

with "'value of name attribute' not found" as the dynamic default value for the 
'message' attribute.


An alternative enhancement (not excluding the first one) would be that the 
<available> and <condition> tasks both accept the 'filepathref', 'failonerror' 
and 'failMessage' attributes and nested elements, with "'value of first absent 
object' not found" as the dynamic default value for the 'failMessage' 
attribute, 
so that the test of failure could be shortened as :

  <condition  failonerror="true"  filepathref="myPath">
    <and>
      <available file="myLib1.jar"/>
      <available file="myLib2.jar"/>
      ...
    </and>
  </condition>

Reply via email to