ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 14392] - Make version information more available
Date Mon, 11 Nov 2002 13:43:07 GMT
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=14392>.
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=14392

Make version information more available





------- Additional Comments From thierry.lach@bbdodetroit.com  2002-11-11 13:43 -------
With the capabilities of <condition> it would be rather simple to write the 
equivalent of a "minimal_ant_version".  And making the version information 
available as properties would still allow older ants to cleanly run and abort 
with a fully qualified message.

See the following example (please look only at the logic - I'm writing this out 
of my head and it may not be completely syntactically correct - and yes I know 
it will abort with ant 1.4.1 because of the <fail if>):


<project default="compile">
  <target name="checkversion-init" unless="ant.version.major">

    <condition property="ant.is.ok">
        ...
    </condition>  
  </target>

  <target name="checkversion" depends="checkversion-init" unless="ant.is.ok">
    <fail>
The version of ant you are using is not recent enough to execute this build.xml 
file.  You must use a version of ant that is at least 1.6.1.
    </fail>
  </target>


  <target name="init" depends="checkversion">
    ...
  </target>

  <target name="compile" depends="init">
     ...
  </target>

</project>

This should run as is (once the ... are filled in) even with ant older than 
1.4.1, and at least display the full text of the fail message.

This does point out that there would probably have to be enhancements made to 
the <condition> task to allow for inequality checking, as there doesn't 
currently seem to be a way to say

    if version.major = 1 then
        if version.minor >= 6 then
            if version.revision >= 1 then
                set ok
            else
                set error
            endif
        else
            set error
        endif
    else
        if version.major > 1 then
            set ok
        else
            set error
        end if    
    endif

A <version> test as part of <condition> might be very useful - a generic method

for inequality checking of a dot-separated (probably should be configurable as 
to the separator) list of numbers.

For example:

  <condition property="within.range">
    <and>
      <version minimum="1.6.1" value="${ant.version.full}"/>
      <version maximum="1.6.3" value="${ant.version.full}"/>
    </and>
  <condition>

--
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