8295884: Implement IDE support for Eclipse
Reviewed-by: erikj
This commit is contained in:
parent
baf11e734f
commit
45809fd0c0
3
.gitignore
vendored
3
.gitignore
vendored
@ -18,3 +18,6 @@ NashornProfile.txt
|
||||
/src/utils/LogCompilation/target/
|
||||
/.project/
|
||||
/.settings/
|
||||
/.project
|
||||
/.classpath
|
||||
/.cproject
|
||||
|
62
doc/ide.html
62
doc/ide.html
@ -79,6 +79,45 @@ native source. After configuring, the project is generated using:</p>
|
||||
<code>ide\hotspot-visualstudio</code> subfolder of the build output
|
||||
folder. The file can be opened in Visual Studio via
|
||||
<code>File -> Open -> Project/Solution</code>.</p>
|
||||
<h4 id="eclipse-cdt">Eclipse CDT</h4>
|
||||
<p>The make system can generate an Eclipse CDT Workspace that enables
|
||||
Eclipse indexing for the C and C++ sources throughout the entire
|
||||
codebase, as well as registering all common make targets to be runnable
|
||||
from the Eclipse explorer. This can be done after configuring by
|
||||
running:</p>
|
||||
<pre><code>make eclipse-native-env</code></pre>
|
||||
<p>After this is run, simply open and import the workspace in Eclipse
|
||||
through
|
||||
<code>File -> Import -> Projects from Folder or Archive</code> and
|
||||
at <code>Import source</code> click on the directory
|
||||
<code>ide\eclipse</code>, which can be found in the build output
|
||||
folder.</p>
|
||||
<p>If this doesn't work, you can also try
|
||||
<code>File -> Import -> Existing Projects into Workspace</code>
|
||||
instead.</p>
|
||||
<p>Setting up an Eclipse Workspace is relatively lightweight compared to
|
||||
other supported IDEs, but requires that your CDT installation has Cross
|
||||
GCC support enabled at the moment, even if you aren't cross compiling.
|
||||
The Visual C++ compiler is, at present, not supported as an indexer.</p>
|
||||
<p>If desired, you can instead request make to only include indexing
|
||||
support for just the Java Virtual Machine instead of the entire native
|
||||
codebase, by running:</p>
|
||||
<pre><code>make eclipse-hotspot-env</code></pre>
|
||||
<p>If you think your particular Eclipse installation can handle the
|
||||
strain, the make system also supports generating a combined Java and
|
||||
C/C++ Workspace for Eclipse which can then conveniently switch between
|
||||
Java and C/C++ natures during development by running:</p>
|
||||
<pre><code>make eclipse-mixed-env</code></pre>
|
||||
<p>Do note that this generates all features that come with both Java and
|
||||
C/C++ natures.</p>
|
||||
<p>By default, the Eclipse Workspace is located in the ide subdirectory
|
||||
in the build output. To share the JDK's source directory with the
|
||||
Eclipse Workspace, you can instead run:</p>
|
||||
<pre><code>make eclipse-shared-<ENV>-env</code></pre>
|
||||
<p>Eclipse support in the JDK is relatively new, so do keep in mind that
|
||||
not everything may work at the moment. As such, the resulting Workspace
|
||||
also has compilation database parsing support enabled, so you can pass
|
||||
Eclipse the compile commands file (see below) if all else fails.</p>
|
||||
<h4 id="compilation-database">Compilation Database</h4>
|
||||
<p>The make system can generate generic native code indexing support in
|
||||
the form of a <a
|
||||
@ -105,5 +144,28 @@ select the folder where you ran the above script.</p>
|
||||
<p>In order to run the tests from the IDE, you can use the JTReg plugin.
|
||||
Instructions for building and using the plugin can be found <a
|
||||
href="https://github.com/openjdk/jtreg/tree/master/plugins/idea">here</a>.</p>
|
||||
<h4 id="eclipse">Eclipse</h4>
|
||||
<p>Eclipse JDT is a widely used Java IDE and has been for a very long
|
||||
time, being a popular choice alongside IntelliJ IDEA for Java
|
||||
development. Likewise, the JDK now includes support for developing its
|
||||
Java sources with Eclipse, which can be achieved by setting up a Java
|
||||
Workspace by running:</p>
|
||||
<pre><code>make eclipse-java-env</code></pre>
|
||||
<p>After the workspace has been generated you can import it in the same
|
||||
way as you would with Eclipse CDT:</p>
|
||||
<p>Follow
|
||||
<code>File -> Import -> Projects from Folder or Archive</code> and
|
||||
select the <code>ide\eclipse</code> directory in the build output folder
|
||||
to import the newly created Java Workspace.</p>
|
||||
<p>If doing so results in an error, you can also import the JDK via
|
||||
<code>File -> Import -> Existing Projects into Workspace</code> as
|
||||
a last resort.</p>
|
||||
<p>Alternatively, if you want a Java Workspace inside the JDK's source
|
||||
directory, you can instead run:</p>
|
||||
<pre><code>make eclipse-shared-java-env</code></pre>
|
||||
<p>As mentioned above for Eclipse CDT, you can create a combined Java
|
||||
and C/C++ Workspace which can conveniently switch between Java and C/C++
|
||||
natures during development by running:</p>
|
||||
<pre><code>make eclipse-mixed-env</code></pre>
|
||||
</body>
|
||||
</html>
|
||||
|
94
doc/ide.md
94
doc/ide.md
@ -56,6 +56,63 @@ This creates a file named `jvm.vcxproj` in `ide\hotspot-visualstudio`
|
||||
subfolder of the build output folder. The file can be opened in Visual Studio
|
||||
via `File -> Open -> Project/Solution`.
|
||||
|
||||
#### Eclipse CDT
|
||||
|
||||
The make system can generate an Eclipse CDT Workspace that enables Eclipse
|
||||
indexing for the C and C++ sources throughout the entire codebase, as well as
|
||||
registering all common make targets to be runnable from the Eclipse explorer.
|
||||
This can be done after configuring by running:
|
||||
|
||||
```
|
||||
make eclipse-native-env
|
||||
```
|
||||
|
||||
After this is run, simply open and import the workspace in Eclipse through
|
||||
`File -> Import -> Projects from Folder or Archive` and at
|
||||
`Import source` click on the directory `ide\eclipse`, which can be
|
||||
found in the build output folder.
|
||||
|
||||
If this doesn't work, you can also try
|
||||
`File -> Import -> Existing Projects into Workspace`
|
||||
instead.
|
||||
|
||||
Setting up an Eclipse Workspace is relatively lightweight compared to other
|
||||
supported IDEs, but requires that your CDT installation has Cross GCC support
|
||||
enabled at the moment, even if you aren't cross compiling. The Visual C++
|
||||
compiler is, at present, not supported as an indexer.
|
||||
|
||||
If desired, you can instead request make to only include indexing support for
|
||||
just the Java Virtual Machine instead of the entire native codebase, by running:
|
||||
|
||||
```
|
||||
make eclipse-hotspot-env
|
||||
```
|
||||
|
||||
If you think your particular Eclipse installation can handle the strain, the
|
||||
make system also supports generating a combined Java and C/C++ Workspace for
|
||||
Eclipse which can then conveniently switch between Java and C/C++ natures
|
||||
during development by running:
|
||||
|
||||
```
|
||||
make eclipse-mixed-env
|
||||
```
|
||||
|
||||
Do note that this generates all features that come with both Java and C/C++
|
||||
natures.
|
||||
|
||||
By default, the Eclipse Workspace is located in the ide subdirectory in the
|
||||
build output. To share the JDK's source directory with the Eclipse Workspace,
|
||||
you can instead run:
|
||||
|
||||
```
|
||||
make eclipse-shared-<ENV>-env
|
||||
```
|
||||
|
||||
Eclipse support in the JDK is relatively new, so do keep in mind that not
|
||||
everything may work at the moment. As such, the resulting Workspace also
|
||||
has compilation database parsing support enabled, so you can pass Eclipse
|
||||
the compile commands file (see below) if all else fails.
|
||||
|
||||
#### Compilation Database
|
||||
|
||||
The make system can generate generic native code indexing support in the form of
|
||||
@ -96,3 +153,40 @@ as the SDK to use.
|
||||
In order to run the tests from the IDE, you can use the JTReg plugin.
|
||||
Instructions for building and using the plugin can be found
|
||||
[here](https://github.com/openjdk/jtreg/tree/master/plugins/idea).
|
||||
|
||||
#### Eclipse
|
||||
|
||||
Eclipse JDT is a widely used Java IDE and has been for a very long time, being
|
||||
a popular choice alongside IntelliJ IDEA for Java development. Likewise, the
|
||||
JDK now includes support for developing its Java sources with Eclipse, which
|
||||
can be achieved by setting up a Java Workspace by running:
|
||||
|
||||
```
|
||||
make eclipse-java-env
|
||||
```
|
||||
|
||||
After the workspace has been generated you can import it in the same way as
|
||||
you would with Eclipse CDT:
|
||||
|
||||
Follow `File -> Import -> Projects from Folder or Archive` and select the
|
||||
`ide\eclipse` directory in the build output folder to import the newly created
|
||||
Java Workspace.
|
||||
|
||||
If doing so results in an error, you can also import the JDK via
|
||||
`File -> Import -> Existing Projects into Workspace`
|
||||
as a last resort.
|
||||
|
||||
Alternatively, if you want a Java Workspace inside the JDK's source directory,
|
||||
you can instead run:
|
||||
|
||||
```
|
||||
make eclipse-shared-java-env
|
||||
```
|
||||
|
||||
As mentioned above for Eclipse CDT, you can create a combined Java and C/C++
|
||||
Workspace which can conveniently switch between Java and C/C++ natures during
|
||||
development by running:
|
||||
|
||||
```
|
||||
make eclipse-mixed-env
|
||||
```
|
||||
|
@ -257,6 +257,46 @@ $(eval $(call SetupTarget, hotspot-ide-project, \
|
||||
ARGS := -I$(TOPDIR)/make/hotspot, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-java-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make WORKSPACE=java SHARED=false, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-hotspot-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make WORKSPACE=hotspot SHARED=false, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-native-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make WORKSPACE=native SHARED=false, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-mixed-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make SHARED=false, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-shared-java-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make WORKSPACE=java SHARED=true, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-shared-hotspot-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make WORKSPACE=hotspot SHARED=true, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-shared-native-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make WORKSPACE=native SHARED=true, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, eclipse-shared-mixed-env, \
|
||||
MAKEFILE := ide/eclipse/CreateWorkspace, \
|
||||
ARGS := --always-make SHARED=true, \
|
||||
))
|
||||
|
||||
ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
|
||||
$(HOTSPOT_VARIANT_LIBS_TARGETS)
|
||||
|
||||
|
390
make/ide/eclipse/CreateWorkspace.gmk
Normal file
390
make/ide/eclipse/CreateWorkspace.gmk
Normal file
@ -0,0 +1,390 @@
|
||||
#
|
||||
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include TextFileProcessing.gmk
|
||||
include Utils.gmk
|
||||
include Modules.gmk
|
||||
|
||||
JVM_VARIANT := $(JVM_VARIANT_MAIN)
|
||||
include hotspot/HotspotCommon.gmk
|
||||
include hotspot/lib/JvmFeatures.gmk
|
||||
include hotspot/lib/JvmOverrideFiles.gmk
|
||||
include hotspot/lib/JvmFlags.gmk
|
||||
|
||||
# Random number generation, with the amount of specified digits
|
||||
# No need to check if the parameter passed is a valid number, the shell will
|
||||
# be more than happy to complain if it isn't ;)
|
||||
RandomDigits = \
|
||||
$(shell od -An -N8 -d /dev/urandom | sed -e 's| ||g' -e 's|\(.\{$(strip $1)\}\).*|\1|')
|
||||
|
||||
# Modified version of utility from JdkNativeCompilation.gmk
|
||||
# The full path could be omitted, but it was chosen not to so wildcard
|
||||
# can work properly for existing directories. The pathsubst below that
|
||||
# this necessitates is a relatively small price to pay.
|
||||
FindModuleNativeDirs = \
|
||||
$(call uniq, $(wildcard \
|
||||
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native \
|
||||
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native \
|
||||
$(TOPDIR)/src/$(strip $1)/share/native))
|
||||
|
||||
# Taken from JdkNativeCompilation.gmk
|
||||
FindJavaHeaderDir = \
|
||||
$(if $(strip $1),$(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)))
|
||||
|
||||
JAVA_DIRS := $(strip $(foreach module, $(call FindAllModules), \
|
||||
$(patsubst $(TOPDIR)/%,%,$(filter-out $(OUTPUTDIR)%, \
|
||||
$(call FindModuleSrcDirs, $(module))))))
|
||||
|
||||
NATIVE_DIRS := $(strip $(foreach module, $(call FindAllModules), \
|
||||
$(patsubst $(TOPDIR)/%,%,$(call FindModuleNativeDirs, $(module)))))
|
||||
|
||||
# Emit the defines extracted from the list of options specified in the first parameter into
|
||||
# the language settings file, in Eclipse format.
|
||||
EmitExtractedDefines = \
|
||||
$(shell echo $(1) | grep -o "\-D\s\?")
|
||||
|
||||
################################################################################
|
||||
# Create an Eclipse Workspace with the specified nature
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
||||
# and the targets generated are listed in a variable by that name.
|
||||
#
|
||||
# Remaining parameter(s) are named arguments:
|
||||
# NATURE - Which Eclipse Workspace nature to generate for the Workspace. Can
|
||||
# be one of JAVA, HOTSPOT, NATIVE, or MIXED.
|
||||
# SHARED - Workspace will share the same directory as the JDK if true. Can be
|
||||
# either true or false. Defaults to false if not specified.
|
||||
SetupEclipseWorkspace = $(NamedParamsMacroTemplate)
|
||||
define SetupEclipseWorkspaceBody
|
||||
|
||||
$1_NATURES :=
|
||||
$1_BUILD_MANAGERS :=
|
||||
$1_LINKED_RESOURCES :=
|
||||
|
||||
ifeq ($$($1_NATURE), )
|
||||
$$(error No nature specified for Eclipse Workspace, cannot continue)
|
||||
endif
|
||||
|
||||
ifeq ($$(findstring $$($1_NATURE), JAVA HOTSPOT NATIVE MIXED), )
|
||||
$$(error Unrecognised nature $$($1_NATURE) specified for Eclipse Workspace)
|
||||
endif
|
||||
|
||||
ifeq ($$($1_SHARED), )
|
||||
$$(info Workspace sharing option not given, assuming non-shared Eclipse Workspace)
|
||||
$1_SHARED := false
|
||||
else ifeq ($$(findstring $$($1_SHARED), true false), )
|
||||
$$(error $$($1_NATURE) is not a boolean word)
|
||||
endif
|
||||
|
||||
ifeq ($$($1_SHARED), true)
|
||||
$1_CLASSPATH_FILE := $(TOPDIR)/.classpath
|
||||
$1_WORKSPACE_FILE := $(TOPDIR)/.project
|
||||
$1_NATIVE_FILE := $(TOPDIR)/.cproject
|
||||
$1_SETTINGS_FILE := $(TOPDIR)/.settings/language.settings.xml
|
||||
else
|
||||
$1_IDE_OUTPUTDIR := $(OUTPUTDIR)/ide/eclipse
|
||||
$1_CLASSPATH_FILE := $$($1_IDE_OUTPUTDIR)/.classpath
|
||||
$1_WORKSPACE_FILE := $$($1_IDE_OUTPUTDIR)/.project
|
||||
$1_NATIVE_FILE := $$($1_IDE_OUTPUTDIR)/.cproject
|
||||
$1_SETTINGS_FILE := $$($1_IDE_OUTPUTDIR)/.settings/language.settings.xml
|
||||
$$(call MakeDir, $$($1_IDE_OUTPUTDIR))
|
||||
endif
|
||||
|
||||
ifneq ($$(findstring $$($1_NATURE), HOTSPOT NATIVE MIXED), )
|
||||
ifeq ($$(call isCompiler, microsoft), true)
|
||||
$$(error Visual C++ is not yet supported as an indexer for Native Workspaces!)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($$(findstring $$($1_NATURE), JAVA MIXED), )
|
||||
|
||||
$1_CLASSPATH :=
|
||||
|
||||
# Eclipse crashes when processing multiple module-info.java files
|
||||
# This is an annoying bug that has not been fixed for some time now
|
||||
$1_CLASSPATH += $$(foreach src,$(JAVA_DIRS), \
|
||||
<classpathentry excluding="module-info.java|module-info.java.extra" kind="src" path="$$(src)"/>$$(NEWLINE))
|
||||
|
||||
$$(eval $$(call SetupTextFileProcessing, $1_CREATE_CLASSPATH_FILE, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/ide/eclipse/classpath.template, \
|
||||
OUTPUT_FILE := $$($1_CLASSPATH_FILE), \
|
||||
REPLACEMENTS := \
|
||||
@@CLASSPATH@@ => $$($1_CLASSPATH), \
|
||||
))
|
||||
|
||||
TARGETS += $$($1_CREATE_CLASSPATH_FILE)
|
||||
|
||||
$1_NATURES += <nature>org.eclipse.jdt.core.javanature</nature>$$(NEWLINE)
|
||||
|
||||
endif
|
||||
|
||||
ifneq ($$(findstring $$($1_NATURE), HOTSPOT NATIVE MIXED), )
|
||||
|
||||
$1_NATIVE_SRCS :=
|
||||
|
||||
$1_BUILD_MANAGERS += \
|
||||
<buildCommand> \
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> \
|
||||
<triggers>clean$$(COMMA)full$$(COMMA)incremental$$(COMMA)</triggers> \
|
||||
<arguments> \
|
||||
</arguments> \
|
||||
</buildCommand> \
|
||||
<buildCommand> \
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> \
|
||||
<triggers>full$$(COMMA)incremental$$(COMMA)</triggers> \
|
||||
<arguments> \
|
||||
</arguments> \
|
||||
</buildCommand>$$(NEWLINE)
|
||||
|
||||
$1_NATURES += \
|
||||
<nature>org.eclipse.cdt.core.cnature</nature> \
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature> \
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> \
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>$$(NEWLINE)
|
||||
|
||||
# This is always emitted, no matter which of the 3 natures were selected
|
||||
$1_NATIVE_SRCS += \
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/hotspot"/>$$(NEWLINE)
|
||||
|
||||
ifneq ($$(findstring $$($1_NATURE), NATIVE MIXED), )
|
||||
$1_NATIVE_SRCS += $$(foreach src,$(NATIVE_DIRS), \
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="$$(strip $$(src))"/>$$(NEWLINE))
|
||||
endif
|
||||
|
||||
$1_WORKSPACE_MAJOR := $$(call RandomDigits, 10)
|
||||
$1_WORKSPACE_MINOR := $$(call RandomDigits, 9)
|
||||
|
||||
# FixPath already removes $(FIXPATH) automatically, but if we rely on FixPath
|
||||
# to do it for us dir won't be able to handle the converted path (if on Windows).
|
||||
# Reversing the order causes dir to mangle the preceeding $(FIXPATH) which breaks
|
||||
# the ability of FixPath to remove it, so it has to be manually removed here.
|
||||
#
|
||||
# Note that the workspace setup system currently does not support Visual C++ when
|
||||
# extracting compiler and/or system headers vital to the build!
|
||||
$1_ENV := $$(call FixPath, $$(dir $$(patsubst $(FIXPATH), , $(CC))))
|
||||
|
||||
# Sidestep annoying issue of WSL path conversion not working properly with true
|
||||
# Unix paths. Eclipse can't run the WSL make by itself anyway, even if we could
|
||||
# properly convert the path.
|
||||
ifeq ($$(call isBuildOsEnv, windows.wsl1 windows.wsl2), true)
|
||||
$1_MAKE := wsl.exe $(MAKE)
|
||||
else
|
||||
$1_MAKE := $$(call FixPath, $(MAKE))
|
||||
endif
|
||||
|
||||
$1_MATCHING_MAKE_TARGETS :=
|
||||
$1_PLAIN_MAKE_TARGETS := update-build-docs docs gensrc gendata \
|
||||
copy java launchers libs hotspot jdk product-images all-images test-image clean
|
||||
|
||||
# make reconfigure omitted since it is sensitive to which make was used
|
||||
ifeq ($$($1_SHARED), true)
|
||||
$1_PLAIN_MAKE_TARGETS += dist-clean
|
||||
endif
|
||||
|
||||
$1_MATCHING_MAKE_TARGETS += $$(foreach name,$$($1_PLAIN_MAKE_TARGETS), \
|
||||
<target name="$$(strip $$(name))" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> \
|
||||
<buildCommand>$$($1_MAKE)</buildCommand> \
|
||||
<buildArguments>-C $$(call FixPath, $(TOPDIR))</buildArguments> \
|
||||
<buildTarget>$$(strip $$(name))</buildTarget> \
|
||||
<stopOnError>true</stopOnError> \
|
||||
<useDefaultCommand>false</useDefaultCommand> \
|
||||
<runAllBuilders>true</runAllBuilders> \
|
||||
</target>$$(NEWLINE))
|
||||
|
||||
$$(eval $$(call SetupTextFileProcessing, $1_CREATE_NATIVE_FILE, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/ide/eclipse/native.template, \
|
||||
OUTPUT_FILE := $$($1_NATIVE_FILE), \
|
||||
REPLACEMENTS := \
|
||||
@@DIR@@ => $$(call FixPath, $(TOPDIR)) ; \
|
||||
@@ENV@@ => $$($1_ENV) ; \
|
||||
@@WORKSPACE@@ => $$($1_WORKSPACE_MAJOR) ; \
|
||||
@@MINOR@@ => $$($1_WORKSPACE_MINOR) ; \
|
||||
@@MAKE@@ => $$($1_MAKE) ; \
|
||||
@@SRC@@ => $$($1_NATIVE_SRCS) ; \
|
||||
@@MAKE_TARGETS@@ => $$($1_MATCHING_MAKE_TARGETS), \
|
||||
))
|
||||
|
||||
TARGETS += $$($1_CREATE_NATIVE_FILE)
|
||||
|
||||
ifeq ($$($1_SHARED), true)
|
||||
$$(call MakeDir, $(TOPDIR)/.settings)
|
||||
else
|
||||
$$(call MakeDir, $$($1_IDE_OUTPUTDIR)/.settings)
|
||||
endif
|
||||
|
||||
$1_CSETTINGS :=
|
||||
$1_CXXSETTINGS :=
|
||||
|
||||
ifneq ($$(findstring $$($1_NATURE), NATIVE MIXED), )
|
||||
$1_CSETTINGS += $$(foreach module, $$(call FindAllModules), $$(if $$(call FindJavaHeaderDir, $$(module)), \
|
||||
$$(foreach dirs, $$(strip $$(patsubst $(TOPDIR)/%,%,$$(call FindModuleNativeDirs, $$(module)))), \
|
||||
<resource project-relative-path="$$(dirs)"> \
|
||||
<entry flags="LOCAL" kind="includePath" name="$$(call FixPath, $$(call FindJavaHeaderDir, $$(module)))"/> \
|
||||
$$(if $$(findstring jdk.sctp,$$(module)), <entry flags="LOCAL" kind="includePath" name="$$(call FixPath, $$(call FindJavaHeaderDir, java.base))"/>) \
|
||||
</resource>$$(NEWLINE))))
|
||||
|
||||
# main.c source file used for generic launchers
|
||||
$1_CSETTINGS += \
|
||||
<resource project-relative-path="src/java.base/share/native/launcher/main.c"> \
|
||||
<entry kind="macro" name="LAUNCHER_NAME" value=""$(LAUNCHER_NAME)""/> \
|
||||
</resource>$$(NEWLINE)
|
||||
endif
|
||||
|
||||
# HotSpot first
|
||||
$1_CXXSETTINGS += <resource project-relative-path="src/hotspot">$$(NEWLINE)
|
||||
|
||||
# If only the Java Virtual Machine sources were requested, headers from other parts of
|
||||
# the native source that it needs will not be available. Add them as include paths here
|
||||
# instead.
|
||||
ifeq ($$($1_NATURE), HOTSPOT)
|
||||
$1_CXXSETTINGS += $$(foreach src, $$(strip $$(patsubst %,%/include,$$(call FindModuleNativeDirs, java.base))), \
|
||||
$(X) $(X)<entry flags="LOCAL" kind="includePath" name="$$(call FixPath, $$(src))"/>$$(NEWLINE))
|
||||
$1_CXXSETTINGS += $(X) $(X)<entry flags="LOCAL" kind="includePath" name="$$(call FixPath, $(TOPDIR)/src/java.base/share/native/libjimage)"/>$$(NEWLINE)
|
||||
endif
|
||||
|
||||
$1_CXXSETTINGS += $(X) $(X)<entry flags="LOCAL" kind="includePath" name="$$(call FixPath, $(JVM_VARIANT_OUTPUTDIR)/gensrc)"/>$$(NEWLINE)
|
||||
|
||||
ifeq ($$(call check-jvm-feature, compiler2), true)
|
||||
$1_CXXSETTINGS += $(X) $(X)<entry flags="LOCAL" kind="includePath" name="$$(call FixPath, $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles)"/>$$(NEWLINE)
|
||||
endif
|
||||
|
||||
$1_CXXSETTINGS += </resource>$$(NEWLINE)
|
||||
|
||||
$1_CXXSETTINGS += \
|
||||
<resource project-relative-path="src/hotspot/share/runtime/abstract_vm_version.cpp"> \
|
||||
<entry kind="macro" name="HOTSPOT_VERSION_STRING" value=""$(VERSION_STRING)""/> \
|
||||
<entry kind="macro" name="DEBUG_LEVEL" value=""$(DEBUG_LEVEL)""/> \
|
||||
<entry kind="macro" name="HOTSPOT_BUILD_USER" value=""$(USERNAME)""/> \
|
||||
<entry kind="macro" name="HOTSPOT_VM_DISTRO" value=""$(HOTSPOT_VM_DISTRO)""/> \
|
||||
<entry kind="macro" name="CPU" value=""$(OPENJDK_TARGET_CPU_VM_VERSION)""/> \
|
||||
<entry kind="macro" name="HOTSPOT_BUILD_TIME" value=""$(if $(HOTSPOT_BUILD_TIME),$(HOTSPOT_BUILD_TIME),$(call EpochToISO8601,$(shell $(DATE) +"%s")))""/> \
|
||||
</resource> \
|
||||
<resource project-relative-path="src/hotspot/share/runtime/arguments.cpp"> \
|
||||
<entry kind="macro" name="HOTSPOT_VERSION_STRING" value=""$(VERSION_STRING)""/> \
|
||||
<entry kind="macro" name="DEBUG_LEVEL" value=""$(DEBUG_LEVEL)""/> \
|
||||
<entry kind="macro" name="HOTSPOT_BUILD_USER" value=""$(USERNAME)""/> \
|
||||
<entry kind="macro" name="HOTSPOT_VM_DISTRO" value=""$(HOTSPOT_VM_DISTRO)""/> \
|
||||
<entry kind="macro" name="CPU" value=""$(OPENJDK_TARGET_CPU_VM_VERSION)""/> \
|
||||
<entry kind="macro" name="HOTSPOT_BUILD_TIME" value=""$(if $(HOTSPOT_BUILD_TIME),$(HOTSPOT_BUILD_TIME),$(call EpochToISO8601,$(shell $(DATE) +"%s")))""/> \
|
||||
</resource>$$(NEWLINE)
|
||||
|
||||
# Now the rest of the C++ sources in the codebase
|
||||
ifneq ($$(findstring $$($1_NATURE), NATIVE MIXED), )
|
||||
$1_CXXSETTINGS += $$(foreach module, $$(call FindAllModules), $$(if $$(call FindJavaHeaderDir, $$(module)), \
|
||||
$$(foreach dirs, $$(strip $$(patsubst $(TOPDIR)/%,%,$$(call FindModuleNativeDirs, $$(module)))), \
|
||||
<resource project-relative-path="$$(dirs)"> \
|
||||
<entry flags="LOCAL" kind="includePath" name="$$(call FixPath, $$(call FindJavaHeaderDir, $$(module)))"/> \
|
||||
</resource>$$(NEWLINE))))
|
||||
endif
|
||||
|
||||
$$(eval $$(call SetupTextFileProcessing, $1_CREATE_SETTINGS_FILE, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/ide/eclipse/settings.template, \
|
||||
OUTPUT_FILE := $$($1_SETTINGS_FILE), \
|
||||
REPLACEMENTS := \
|
||||
@@WORKSPACE@@ => $$($1_WORKSPACE_MAJOR) ; \
|
||||
@@CSETTINGS@@ => $$($1_CSETTINGS) ; \
|
||||
@@CXXSETTINGS@@ => $$($1_CXXSETTINGS), \
|
||||
))
|
||||
|
||||
TARGETS += $$($1_CREATE_SETTINGS_FILE)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($$($1_SHARED), false)
|
||||
ifneq ($$(findstring $$($1_NATURE), JAVA MIXED), )
|
||||
$1_LINKED_RESOURCES += $$(foreach src,$(JAVA_DIRS), \
|
||||
<link> \
|
||||
<name>$$(strip $$(src))</name> \
|
||||
<type>2</type> \
|
||||
<location>$$(subst \\,/,$$(call FixPath, $(TOPDIR)/$$(src)))</location> \
|
||||
</link>$$(NEWLINE))
|
||||
endif
|
||||
|
||||
ifneq ($$(findstring $$($1_NATURE), HOTSPOT NATIVE MIXED), )
|
||||
# CDT includes a Makefile editor, so if CDT support was indicated there's no harm in
|
||||
# including the make sources as well, since the cost of indexing them is miniscule
|
||||
$1_LINKED_RESOURCES += \
|
||||
<link> \
|
||||
<name>make</name> \
|
||||
<type>2</type> \
|
||||
<location>$$(subst \\,/,$$(call FixPath, $(TOPDIR)/make))</location> \
|
||||
</link> \
|
||||
<link> \
|
||||
<name>src/hotspot</name> \
|
||||
<type>2</type> \
|
||||
<location>$$(subst \\,/,$$(call FixPath, $(TOPDIR)/src/hotspot))</location> \
|
||||
</link>$$(NEWLINE)
|
||||
endif
|
||||
|
||||
ifneq ($$(findstring $$($1_NATURE), NATIVE MIXED), )
|
||||
$1_LINKED_RESOURCES += $$(foreach src,$(NATIVE_DIRS), \
|
||||
<link> \
|
||||
<name>$$(strip $$(src))</name> \
|
||||
<type>2</type> \
|
||||
<location>$$(subst \\,/,$$(call FixPath, $(TOPDIR)/$$(src)))</location> \
|
||||
</link>$$(NEWLINE))
|
||||
endif
|
||||
endif
|
||||
|
||||
$$(eval $$(call SetupTextFileProcessing, $1_CREATE_WORKSPACE_FILE, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/ide/eclipse/workspace.template, \
|
||||
OUTPUT_FILE := $$($1_WORKSPACE_FILE), \
|
||||
REPLACEMENTS := \
|
||||
@@BUILD_MANAGERS@@ => $$($1_BUILD_MANAGERS) ; \
|
||||
@@NATURES@@ => $$($1_NATURES) ; \
|
||||
@@LINKED_RESOURCES@@ => $$($1_LINKED_RESOURCES), \
|
||||
))
|
||||
|
||||
TARGETS += $$($1_CREATE_WORKSPACE_FILE)
|
||||
|
||||
endef
|
||||
|
||||
ifeq ($(WORKSPACE), java)
|
||||
$(eval $(call SetupEclipseWorkspace, SETUP_WORKSPACE, \
|
||||
NATURE := JAVA, \
|
||||
SHARED := $(SHARED), \
|
||||
))
|
||||
else ifeq ($(WORKSPACE), hotspot)
|
||||
$(eval $(call SetupEclipseWorkspace, SETUP_WORKSPACE, \
|
||||
NATURE := HOTSPOT, \
|
||||
SHARED := $(SHARED), \
|
||||
))
|
||||
else ifeq ($(WORKSPACE), native)
|
||||
$(eval $(call SetupEclipseWorkspace, SETUP_WORKSPACE, \
|
||||
NATURE := NATIVE, \
|
||||
SHARED := $(SHARED), \
|
||||
))
|
||||
else
|
||||
$(eval $(call SetupEclipseWorkspace, SETUP_WORKSPACE, \
|
||||
NATURE := MIXED, \
|
||||
SHARED := $(SHARED), \
|
||||
))
|
||||
endif
|
||||
|
||||
all: $(TARGETS)
|
4
make/ide/eclipse/classpath.template
Normal file
4
make/ide/eclipse/classpath.template
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
@@CLASSPATH@@
|
||||
</classpath>
|
56
make/ide/eclipse/native.template
Normal file
56
make/ide/eclipse/native.template
Normal file
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping">
|
||||
<project-mappings>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="org.eclipse.cdt.core.c"/>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="org.eclipse.cdt.core.c"/>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="org.eclipse.cdt.core.c++"/>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="org.eclipse.cdt.core.c++"/>
|
||||
</project-mappings>
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.cross.base.@@WORKSPACE@@">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.@@WORKSPACE@@" moduleId="org.eclipse.cdt.core.settings" name="C/C++">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.cross.base.@@WORKSPACE@@" name="C/C++" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.@@WORKSPACE@@.@@MINOR@@" name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.@@MINOR@@" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.@@MINOR@@" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" value="@@ENV@@" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="" id="cdt.managedbuild.targetPlatform.gnu.cross.@@WORKSPACE@@" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder command="@@MAKE@@" arguments="-C @@DIR@@" id="cdt.managedbuild.builder.gnu.cross.@@MINOR@@" incrementalBuildTarget="jdk" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="false" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
@@SRC@@
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
@@MAKE_TARGETS@@
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
</cproject>
|
22
make/ide/eclipse/settings.template
Normal file
22
make/ide/eclipse/settings.template
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.@@WORKSPACE@@" name="C/C++">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider build-parser-id="" cdb-modified-time="" class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.CompilationDatabaseParser" id="org.eclipse.cdt.managedbuilder.core.CompilationDatabaseParser" name="Compilation Database Parser" prefer-non-shared="true" store-entries-with-project="true"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="([^/\\\\]*)((g?cc)|([gc]\+\+)|(clang))" prefer-non-shared="true" store-entries-with-project="true"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="true" env-hash="" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true" store-entries-with-project="true">
|
||||
<language-scope id="org.eclipse.cdt.core.c"/>
|
||||
<language-scope id="org.eclipse.cdt.core.c++"/>
|
||||
</provider>
|
||||
<provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true" store-entries-with-project="true">
|
||||
<language id="org.eclipse.cdt.core.c">
|
||||
@@CSETTINGS@@
|
||||
</language>
|
||||
|
||||
<language id="org.eclipse.cdt.core.c++">
|
||||
@@CXXSETTINGS@@
|
||||
</language>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
16
make/ide/eclipse/workspace.template
Normal file
16
make/ide/eclipse/workspace.template
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>jdk</name>
|
||||
<comment>The HotSpot Virtual Machine, Runtime Environment, and Development Kit</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
@@BUILD_MANAGERS@@
|
||||
</buildSpec>
|
||||
<natures>
|
||||
@@NATURES@@
|
||||
</natures>
|
||||
<linkedResources>
|
||||
@@LINKED_RESOURCES@@
|
||||
</linkedResources>
|
||||
</projectDescription>
|
Loading…
Reference in New Issue
Block a user