RFR: 8295884: Implement IDE support for Eclipse [v30]

Magnus Ihse Bursie ihse at openjdk.org
Thu Jan 12 13:11:22 UTC 2023


On Wed, 4 Jan 2023 13:06:37 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> Eclipse is a popular and very well-known IDE in the world of Java development, utilized widely in many contexts, by beginners and experienced teams alike. Although a relatively lightweight IDE, it features surprisingly powerful indexing and code analysis capabilities, as well as useful tools, among which are make integration. While the tools it provides are not always as sophisticated as other IDEs (IntelliJ IDEA will likely come to mind as one such competitor), the simplicity of using it, as well as the reliability of this rugged IDE makes up greatly for the slightly less advanced tooling. Eclipse requires very little starting infrastructure in the workspace for all these features and indexing support as well, which makes it a good candidate for developing on the JDK.
>> 
>> This enhancement adds 4 extra targets to the make system for generating a basic Eclipse Workspace that provides almost full indexing support for the JDK, with varying levels as desired, from a minimalistic option only including the Java Virtual Machine's source code, to generating a workspace with both Java and C/C++ natures included, which allows for using Eclipse's unique ability to quickly swap between Java and C/C++ mode to work on both native and Java sources at the same time. Cross Compiling support is available, and in its entirety the change touches very little of the existing make system, barring its own Makefile within the ide subdirectory.
>> 
>> Indexing capabilities utilizing the enhancement:
>> <img width="960" alt="java" src="https://user-images.githubusercontent.com/32636402/197784819-67ec7de4-7e27-4f33-b738-59b75a9e4403.PNG">
>> <img width="787" alt="escape" src="https://user-images.githubusercontent.com/32636402/197784843-df8621a8-7b0a-42da-86f4-3afb92de0f71.PNG">
>
> Julian Waters has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 38 commits:
> 
>  - Merge remote-tracking branch 'upstream/master' into eclipse
>  - Progress
>  - Merge remote-tracking branch 'upstream/master' into eclipse
>  - Formatting Cleanup
>  - Proper Checks
>  - Merge remote-tracking branch 'upstream/master' into eclipse
>  - Include Files for C/C++ code now work properly
>  - Merge remote-tracking branch 'upstream/master' into eclipse
>  - Merge remote-tracking branch 'upstream/master' into eclipse
>  - Merge remote-tracking branch 'upstream/master' into eclipse
>  - ... and 28 more: https://git.openjdk.org/jdk/compare/82deb5ca...5745a0df

If you want to go down that route, the function you'll need is `SetupTextFileProcessing`. It has two relevant arguments:
* `REPLACEMENTS`, which takes a kind of a special syntax argument, like this:

          REPLACEMENTS := \
              @@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
              @@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
              @@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \


The stuff to the left of the arrow is the literal pattern to search for. By tradition, we have used the `@@...@@` to mark our patterns. It is not required, but it is recommended since it is easy to spot and low chance of collision with any real text. It is also recommend as in the example above to name the pattern after the variable it will replace.

* `INCLUDES`, which similarly has this syntax:

INCLUDES := \
@@DEBUG_PARTIAL_XML@@ => $(OUTPUT)/$(DEBUG_PARTIAL).xml


The placeholder (i.e. `@@DEBUG_PARTIAL_XML@@`) will need to be alone on a single line. This line will be removed and replaced with the contents of the given file. 

(There are currently no usages of this functionality in the JDK build, but I don't think it has bit-rotted away)

-------------

PR: https://git.openjdk.org/jdk/pull/10853



More information about the build-dev mailing list