Bug 37225 - [msic] Allow for Ant-like Dynamic Text Replace
Summary: [msic] Allow for Ant-like Dynamic Text Replace
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P5 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-05 11:46 EDT by Marcus Malcom CLA
Modified: 2007-06-22 10:01 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Malcom CLA 2003-05-05 11:46:52 EDT
Ant has a very nice feature that allows dynamic replacement of text. It would be
nice if there was support for this in Eclipse (for .java's and possibly other
files as well). This would happen before the resource is built. For example:

class VersionManager {
  public static final MAJOR = "@major@";
  public static final MINOR = "@minor@";

  ...
}

The @@'s would be dynamically replaced; in other words the @@'s would stay that
way in the source, but the compiler would be sent something meaningful.

In addition, it would be extremely useful to add in support to manage build
version numbers. Being able to increment the major, minor ... etc. in the
example above would be very useful.

Thanks,

Marcus
Comment 1 Michael R Head CLA 2003-05-05 13:00:34 EDT
What about making an ant targer for it and calling out to that target in an ant
builder in the external tools builder? Would that be enough (for the first
part)? Or are you looking for something that would obviate the need for a build
script for this?

mike
Comment 2 Marcus Malcom CLA 2003-05-22 11:17:01 EDT
Well the problem with just relying on ANT to do this, gets us on a slippery
slope pretty quick. For ANT to really handle this, it would need to take over
compiling the .java, because simply allowing ANT to do the replace in the .java
isn't what I'm looking for (because these @@'s should stay in the source and not
cause a compile error). So if ANT is doing this, a developer has to, 1) maintain
that build script, 2) manually add it to run this ANT script before Eclipse. If
this is done, then how does the ANT script work? Well, it would have to look
through all the source trees and find any .java w/ @@ ... it would then need to
compile these ... but what about dependencies? So now you'd have to compile not
only these files but also a good portion of the source tree (in the average
case). Seems rather expensive and highly prone to "I just can?t be bothered"
syndrome.

I still think it is warranted to provide support for this.

--
Marcus
Comment 3 Dani Megert CLA 2003-09-24 08:11:44 EDT
Since you want to keep the variables/tags (@@) in the source this looks like
asking for preprocessor support. It's not just JDT Text. The compiler would have
to know about the variables/tags without any (text) editor knowledge.

There are no plans to add this (at least in 3.0 stream).
Comment 4 Dani Megert CLA 2007-06-22 09:59:15 EDT
Get rid of deprecated state.