ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@ebinteractive.com.au>
Subject RE: Question on builds that fail
Date Wed, 03 Jan 2001 22:14:16 GMT
I've moved this over from ant-user.

OK, I can see that there is some demand for this behaviour and it does not
seem unreasonable, especially defaulting to off. I agree with Ken's original
comment that failing fast is good but there may be occasions where you do
want to struggle onwards.

Of course, once we add this to javac, the question is why not add it to
other tasks, say the <ant> task for example. I think that was perhaps the
thrust of David Bailey's fail fast post. Therefore, perhaps this should be a
general attribute of all tasks. That would move "proceed" processing into
the ant core and I'm pretty sure Duncan has expressed an opinion that this
is a task responsibility.

Thoughts?

Conor


--
Conor MacNeill
conor@cortexebusiness.com.au
Cortex eBusiness
http://www.cortexebusiness.com.au

> -----Original Message-----
> From: Diane Holt [mailto:holtdl@yahoo.com]
> Sent: Thursday, 4 January 2001 8:22
> To: ant-user@jakarta.apache.org
> Subject: Re: Question on builds that fail
>
>
> I can't think of any reason why it shouldn't be included in the CVS
> version of Javac.java -- it's off by default, so it's not going to
> interfere with anyone who doesn't want to set it.
>
> In looking at the file Ken sent me, it looks like it's a relatively old
> revision (maybe 1.54 or 1.55), so, since I don't know what rev other
> people are at, it's probably easiest for me to just explain what you'd
> need to add to your own Javac.java for now (I'll integrate the change with
> the latest rev and offer it to ant-dev later).
>
> To change Javac.java to include this functionality, just add the
> following:
>   1. Add it to the list of booleans at the beginning of the class --
>      ie., after "private boolean verbose = false ;", add:
>          private boolean proceed = false ;
>   2. Add the "setter" for it -- ie., after the one for verbose, add:
>          /**
>           * Set the proceed flag.
>           */
>          public void setProceed(boolean proceed) {
>              this.proceed = proceed;
>          }
>   3. This one gets a bit stickier, since you'll need to add in the test
>      for "if( !proceed )" in various places, and according to which
>      compilers you use. For myself, since I never use 'javac', I added it
>      after the if on executeJikesCompile() (and my one for 'sj'), but Ken
>      had it in the doClassicCompile(), before the if on
>      ok.booleanValue() that comes after the "Boolean ok = ..." line.
>      Basically, you're just trying to allow a different behaviour rather
>      than just the BuildException being thrown when a compile fails. For
>      example, here's the one for the doClassicCompile():
>             Boolean ok = (Boolean)compile.invoke(compiler, new Object[]
>                            {cmd.get Arguments()});
>             if (!proceed) {
>                 if (!ok.booleanValue()) {
>                     throw new BuildException(FAIL_MSG, location);
>                 }
>             } else {
>                 if (!ok.booleanValue()) {
>                     log("Warning: Errors reported, continuing ... ",
>                           Project.MSG_WARN);
>                 }
>             }
>      And here's the one for Jikes:
>         if (executeJikesCompile(cmd.getCommandline(), firstFileName) != 0)
>         {
>             if (!proceed) {
>                     throw new BuildException(FAIL_MSG, location);
>             } else {
>                 log("*** Warning: Errors reported -- continuing ... ",
>                       Project.MSG_WARN);
>             }
>         }
>
> Once you have your modified Javac.java, recompile it, rebuild ant.jar,
> then modify your <javac> tasks to include the "proceed" attribute. I have
> all my <javac> tasks include it, with its value defined as "${proceed}",
> which is defined as "false" in my standard-defaults properties file that
> gets read in when Ant runs. That way, if a user wants to run with proceed
> turned on, it can get defined as "true" on the 'ant' command-line, which
> takes precedence over the define in the properties file. (If a user always
> wants to run with proceed=true, they can define $PROCEED in their user
> env, and my 'ant' script will translate it into a command-line define --
> or, they can just specify it manually with 'ant -Dproceed=true ...' if
> they only want it defined for a particular run.)
>
> Hope this all helps -- if it was too weird having it not be the actual
> modified file, let me know, and I can still forward that.
>
> Diane
>
> --- Mike Pedersen <michael.pedersen@oracle.com> wrote:
> > Hello Diane, that would be great if you could forward it.  I wonder,
> > would
> > it make sense for this functionality to be integrated into  the javac
> > task
> > of ant as a parameter.  Does anyone know if this is planned for 1.3?
> > Thanks much
> >
> > At 11:37 AM 1/3/2001 -0800, you wrote:
> > >Ken Wood wrote a mod for Javac.java that allows for a "proceed"
> > attribute,
> > >which when set to true will cause a compile failure to only issue a
> > >warning, not throw a BuildException. I don't think it was ever posted
> > to
> > >the list, but I have it (and use it), so if you'd like me to forward it
> > to
> > >you, I can.
> > >
> > >Diane
> > >
> > >--- Mike Pedersen <michael.pedersen@oracle.com> wrote:
> > > > Hello all, I am currently using ant to build several good sized
> > > > projects.  My team wishes to have access to builds that fail as well
> > as
> > > > builds that complete successfully.  My question: is it possible to
> > have
> > > > ant
> > > > continue even if the "javac" task fails?  The purpose of this would
> > be
> > > > to
> > > > copy the source and zips of the failed build to our ftp site to give
> > > > others
> > > > access.
> > > > What kinds of problems will I create for myself if I remove the
> > "javac"
> > > > task dependency from the subsequent task?
> > > > Thanks much
> > > >
> > > > .
> > > > hanks much
> > > >
> > > > .
> > > >
> > >
> > >
> > >=====
> > >(holtdl@yahoo.com)
> > >
> > >
> > >
> > >__________________________________________________
> > >Do You Yahoo!?
> > >Yahoo! Photos - Share your holiday photos online!
> > >http://photos.yahoo.com/
> >
>
>
> =====
> (holtdl@yahoo.com)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos - Share your holiday photos online!
> http://photos.yahoo.com/
>


Mime
View raw message