Hello all,

I have come across the following problem and I am looking for a nice solution to 
address it.

What I need to to is command similiar to <echo> with a option to pre-append the echo 
string to the beginning of the file. 

Note: I need this tool since some of our Java code is automatically generated and the 
tool that generates the code has no concepts of packages.  What I need to do is add a 
package statement to the beginning of the file.  Unfortunately, changing the routine 
that generates the code is not an option.

I see three possible solutions:

1) Write an external tool class that would be called by Ant to prepend the string.

2) Modify Ant with a new option for prepending the data.  Unfortunately, it would be a 
local modification would need to be re-implemented each time we update Ant with the 
latest revision. 

3) Use existing Ant command to accomplish this task.

I would like to use option 3, but being relatively new to the Ant environment, I am 
unsure of the best way of doing this.  Note: All of the files to be modified will be 
contained in thier own directory.

One possible algorithm that I thought of was to:
1) Copy all of the *.java files to another temporary directory
2) For each *.java in the original directory replace the contents with the package 
information.
3) For each of the files in the temporary directory, concatenate it with its 
original's file name in the original directory.

Thanks ahead of time for any help.


Regards,


Stephen
  



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to