You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@locus.apache.org on 2000/06/26 12:47:37 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

bodewig     00/06/26 03:47:37

  Modified:    src/main/org/apache/tools/ant/taskdefs Exec.java
  Log:
  Propagate a caught Exception inside the thrown BuildException.
  Suggested by:	Julien Couvreur <jc...@redcart.com>
  
  Revision  Changes    Path
  1.10      +2 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
  
  Index: Exec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Exec.java	2000/04/01 14:25:07	1.9
  +++ Exec.java	2000/06/26 10:47:36	1.10
  @@ -97,7 +97,7 @@
                   command = "cmd /c cd " + dir + " && " + command;
           } else {
               String ant = project.getProperty("ant.home");
  -            if (ant == null) throw new BuildException("Property 'ant.home' not found");
  +            if (ant == null) throw new BuildException("Property 'ant.home' not found", location);
               String antRun = project.resolveFile(ant + "/bin/antRun").toString();
   
               command = antRun + " " + dir + " " + command;
  @@ -141,7 +141,7 @@
                   project.log("Result: " + err, "exec", Project.MSG_ERR);
               }
           } catch (IOException ioe) {
  -            throw new BuildException("Error exec: " + command );
  +            throw new BuildException("Error exec: " + command, ioe, location);
           } catch (InterruptedException ex) {}
   
           return err;
  
  
  

Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "TH" == Thomas Haas <th...@softwired-inc.com> writes:

 TH> Are you planning to redo Exec?

Not in the short term. Time to write down my thoughts I guess.

Stefan

Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

Posted by Thomas Haas <th...@softwired-inc.com>.
mariusz@marni.otago.ac.nz (Mariusz Nowostawski) wrote:
> 
> tom,
> 
> could you elaborate how functionality of Exec being a Matching Task can be
> achieved without Exec being a Matching Task? I mean 'how you can see it'..
> 
> Is such functionality necessary? I believe so. In my personal case, from
> "real life" I can give you straight away three examples, in all of those I
> use modified Exec which appends all matching files as last argument to the
> exec'ed executable call, as parameters of the call:

I think we agree and therefor deleted your explanation, why the two 
should available. To me the exec funtionality should be used instead of 
inherited. Doing so other tasks neither being Exec nor MatchingTask but 
something else can profit.

I even beleive all functionality should be implemented outside of task 
classes. Task classes should access the functions through uses 
relations. This would ease reuse of code.

Part of the framework is written and is almost ready to be committed. 
You will find some in another mail just send to the list.

- tom





Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

Posted by Stefan Bodewig <bo...@bost.de>.
Mariusz, 

just a few comments as I've laid out my opinion in another post - that
I've been busy writing when your article arrived.

All of your examples could be resolved by a WorkOn task or something
like that, which would be a subclass of Exec that implements
MatchingTaskBehavior.

I don't know whether we'd use different subclasses for "all files at
once" and "one file at a time" or use a flag for this - I'd opt for
the latter.

Stefan

Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

Posted by Mariusz Nowostawski <ma...@marni.otago.ac.nz>.
tom,

could you elaborate how functionality of Exec being a Matching Task can be
achieved without Exec being a Matching Task? I mean 'how you can see it'..

Is such functionality necessary? I believe so. In my personal case, from
"real life" I can give you straight away three examples, in all of those I
use modified Exec which appends all matching files as last argument to the
exec'ed executable call, as parameters of the call:

1. compiling set of .idl files to .java sources via call to appropriate
   jidl compiler (it happens it is binary executable)
2. compiling a set of .grammar files to .java sources i.e. generating
   parsers for several grammar files, via call to appropriate parser
   generator
3. processing set of .java files into other .java files (for example
   autoformatting of the source) via call to appropriate formatter (for
   example for preparing the source to be formatted according to the same 
   formatting style for source distribution - in CVS different people work
   on different modules and have slightly different formatting taste)

I am planning to use it also for autogenerating @version in all my
source files for the source distribution jar, etc.  I really think
including each file being processed in seperate <exec> line in my build
file is not an option. 
All tools I use for all those examples work fine with list of files as
arguments. I am aware it might be not always the case, but in such case
somewhere, somebody has to make all the individual calls,
which I would be happy to do inside Exec itself as well (via some switch
in the Exec task itself).   In fact, some of those tools are Java based,
but I have been using Exec instead as I was too lazy to patch Java task
itself, which in fact I would like to see as Matching Task itself as well 
`;o)  
By saying all the above I do not claim Exec and Java _should_ be Matching
Tasks, all I am saying is that in ANT there is a need for such
functionality, and there should be a way to achive it, either via Java and
Exec being Matching Tasks or any other way.  Proposals?


What about Chmod being matching task?  Others?



> >  MN> What about Exec being a Matching Task?
> > 
> > It's on my TODO list - I'm going to start a new thread on this though
> > as I don't really like the idea to make Exec a MatchingTask.
> > 
> > Stefan
> 
> I would not appreciate this neither. Are you planning to redo Exec?


Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

Posted by Thomas Haas <th...@softwired-inc.com>.
bodewig@bost.de (Stefan Bodewig) wrote:
> 
> >>>>> "MN" == Mariusz Nowostawski <ma...@marni.otago.ac.nz> writes:
> 
>  MN> What about Exec being a Matching Task?
> 
> It's on my TODO list - I'm going to start a new thread on this though
> as I don't really like the idea to make Exec a MatchingTask.
> 
> Stefan

I would not appreciate this neither. Are you planning to redo Exec?

- tom



Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "MN" == Mariusz Nowostawski <ma...@marni.otago.ac.nz> writes:

 MN> What about Exec being a Matching Task?

It's on my TODO list - I'm going to start a new thread on this though
as I don't really like the idea to make Exec a MatchingTask.

Stefan

Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java

Posted by Mariusz Nowostawski <ma...@marni.otago.ac.nz>.
Hi,
What about Exec being a Matching Task?

Stefan,
What about Exec being a Matching Task?


Mariusz



On 26 Jun 2000 bodewig@locus.apache.org wrote:
> bodewig     00/06/26 03:47:37
> 
>   Modified:    src/main/org/apache/tools/ant/taskdefs Exec.java
>   Log:
>   Propagate a caught Exception inside the thrown BuildException.
>   Suggested by:	Julien Couvreur <jc...@redcart.com>