Is there any way in an Ant script to use the <copy> task (replaceTokens) to preprocess Java files and replace a "__FILE__" string with the file name of the copied file and "__LINE__" with the line number in that file? This would go a long way toward solving Java’s lack of a preprocessor.
The docs on replaceTokens show examples of fixed replacement strings, but I can’t find any way to have Ant put in the file name and line number, respectively.
Do I need to write my own task handler?
Here’s what I came up with. It does
__LINE__, but not__FILE__. Oh well :-(.