ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: Speaking of deprecation...
Date Tue, 12 Feb 2002 06:32:30 GMT

----- Original Message -----
From: "Magesh Umasankar" <umagesh@apache.org>
To: "Ant Developers List" <ant-dev@jakarta.apache.org>
Sent: Monday, February 11, 2002 8:13 PM
Subject: Re: Speaking of deprecation...



> Please find attached a patch that introduces
> -deprecation to the command line.  Project.MSG_DEPRECATED
> is introduced between INFO & VERBOSE.
>
> When Ant is invoked without the -deprecation flag and
> if deprecated features are used, only a single line is
> output in the end saying Deprecated features have been
> used.  If -deprecation, -verbose or -debug is used and
> deprecated features are used as well, deprecated
> messages show up.
>
> As I have modified the value of some public static finals,
> viz. Project.DEBUG and Project.VERBOSE, mandatory
> recompiling of all of Ant's source code is needed.
> If you can suggest a cleaner way to do this and avoid
> this penalty, I am all ears.

This breaks every existing external task out there, right?

>
> If there are no objections raised against this patch,
> I will go ahead and change all the necessary code
> to use this new logging level as appropriate.

I am concerned with the risk it presents to all those external apps; it is
one of those subtle compatibility killers which stops you compiling a single
task compatible between ant 1.4 and ant 1.5. Any ant1.4 task with debug
messages gets mistaken for deprecation warnings

Here is some of what I think we could do

1. use a deprecated(text) method (preferably with a since flag), implemented
in Task
This means that tasks themselves do not need to log at the deprecation
level.

2. have that base implementation hand off to Project.deprecated()

3. Project.deprecated() can have its implementation changed over time. It
could be set to throw an exception in the -strict mode I have just invented;
it could print warnings, it could be silent

4. If it needs to print warnings, then they do have to go through the
listener chain, which means it needs a logging level. It could just go out
as info, like this

class Project

public void deprecated(Task task, String text) {
    if(deprecation_mode==DEPRECATION_FAIL) {
        //TODO: get line number &c from task
        throw new BuildException(text);
    }
    if(deprecation_mode==DEPRECATION_WARN) {
        log(text,MSG_WARN);
    }
    deprecations++;
  }











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