From 45d3cbbb2ea14d135222cda4bc372c15716884ef Mon Sep 17 00:00:00 2001 From: simonis Date: Mon, 3 Jun 2019 10:28:03 +0200 Subject: [PATCH] 8223678: Add Visual Studio Code workspace generation support (for native code) Reviewed-by: andrew, sgehwolf, clanger --- doc/ide.html | 54 +++++++++ doc/ide.md | 73 ++++++++++++ make/Main.gmk | 26 +++++ make/UpdateBuildDocs.gmk | 8 ++ make/common/MakeBase.gmk | 19 +++- make/vscode/CreateVSCodeProject.gmk | 113 +++++++++++++++++++ make/vscode/indexers/ccls-extensions.txt | 2 + make/vscode/indexers/ccls-notes.txt | 3 + make/vscode/indexers/ccls-settings.txt | 28 +++++ make/vscode/indexers/clangd-extensions.txt | 2 + make/vscode/indexers/clangd-notes.txt | 4 + make/vscode/indexers/clangd-settings.txt | 17 +++ make/vscode/indexers/cpptools-extensions.txt | 1 + make/vscode/indexers/cpptools-settings.txt | 5 + make/vscode/indexers/rtags-extensions.txt | 2 + make/vscode/indexers/rtags-settings.txt | 14 +++ make/vscode/template-launch.jsonc | 55 +++++++++ make/vscode/template-tasks.jsonc | 55 +++++++++ make/vscode/template-workspace-folder.txt | 4 + make/vscode/template-workspace.jsonc | 63 +++++++++++ test/make/TestMakeBase.gmk | 12 ++ 21 files changed, 559 insertions(+), 1 deletion(-) create mode 100644 doc/ide.html create mode 100644 doc/ide.md create mode 100644 make/vscode/CreateVSCodeProject.gmk create mode 100644 make/vscode/indexers/ccls-extensions.txt create mode 100644 make/vscode/indexers/ccls-notes.txt create mode 100644 make/vscode/indexers/ccls-settings.txt create mode 100644 make/vscode/indexers/clangd-extensions.txt create mode 100644 make/vscode/indexers/clangd-notes.txt create mode 100644 make/vscode/indexers/clangd-settings.txt create mode 100644 make/vscode/indexers/cpptools-extensions.txt create mode 100644 make/vscode/indexers/cpptools-settings.txt create mode 100644 make/vscode/indexers/rtags-extensions.txt create mode 100644 make/vscode/indexers/rtags-settings.txt create mode 100644 make/vscode/template-launch.jsonc create mode 100644 make/vscode/template-tasks.jsonc create mode 100644 make/vscode/template-workspace-folder.txt create mode 100644 make/vscode/template-workspace.jsonc diff --git a/doc/ide.html b/doc/ide.html new file mode 100644 index 0000000000..1730eb0bef --- /dev/null +++ b/doc/ide.html @@ -0,0 +1,54 @@ + + + + + + + IDE support in the JDK + + + + + +
+

IDE support in the JDK

+
+ +

Introduction

+

When you are familiar with building and testing the JDK, you may want to configure an IDE to work with the source code. The instructions differ a bit depending on whether you are interested in working with the native (C/C++) or the Java code.

+

IDE support for native code

+

There are a few ways to generate IDE configuration for the native sources, depending on which IDE to use.

+

Visual Studio Code

+

The make system can generate a Visual Studio Code workspace that has C/C++ source indexing configured correctly, as well as launcher targets for tests and the Java launcher. After configuring, a workspace for the configuration can be generated using:

+
make vscode-project
+

This creates a file called jdk.code-workspace in the build output folder. The full location will be printed after the workspace has been generated. To use it, choose File -> Open Workspace... in Visual Studio Code.

+
Alternative indexers
+

The main vscode-project target configures the default C++ support in Visual Studio Code. There are also other source indexers that can be installed, that may provide additional features. It's currently possible to generate configuration for two such indexers, clangd and rtags. These can be configured by appending the name of the indexer to the make target, such as:

+
make vscode-project-clangd
+

Additional instructions for configuring the given indexer will be displayed after the workspace has been generated.

+

Visual Studio

+

This section is a work in progress.

+
make ide-project
+

Compilation Database

+

The make system can generate generic native code indexing support in the form of a Compilation Database that can be used by many different IDEs and source code indexers.

+
make compile-commands
+

It's also possible to generate the Compilation Database for the HotSpot source code only, which is a bit faster as it includes less information.

+
make compile-commands-hotspot
+

IDE support for Java code

+

This section is a work in progress.

+ + diff --git a/doc/ide.md b/doc/ide.md new file mode 100644 index 0000000000..4a692efd22 --- /dev/null +++ b/doc/ide.md @@ -0,0 +1,73 @@ +% IDE support in the JDK + +## Introduction + +When you are familiar with building and testing the JDK, you may want to +configure an IDE to work with the source code. The instructions differ a bit +depending on whether you are interested in working with the native (C/C++) or +the Java code. + +### IDE support for native code + +There are a few ways to generate IDE configuration for the native sources, +depending on which IDE to use. + +#### Visual Studio Code + +The make system can generate a [Visual Studio Code](https://code.visualstudio.com) +workspace that has C/C++ source indexing configured correctly, as well as +launcher targets for tests and the Java launcher. After configuring, a workspace +for the configuration can be generated using: + +```shell +make vscode-project +``` + +This creates a file called `jdk.code-workspace` in the build output folder. The +full location will be printed after the workspace has been generated. To use it, +choose `File -> Open Workspace...` in Visual Studio Code. + +##### Alternative indexers + +The main `vscode-project` target configures the default C++ support in Visual +Studio Code. There are also other source indexers that can be installed, that +may provide additional features. It's currently possible to generate +configuration for two such indexers, [clangd](https://clang.llvm.org/extra/clangd/) +and [rtags](https://github.com/Andersbakken/rtags). These can be configured by +appending the name of the indexer to the make target, such as: + +```shell +make vscode-project-clangd +``` + +Additional instructions for configuring the given indexer will be displayed +after the workspace has been generated. + +#### Visual Studio + +This section is a work in progress. + +```shell +make ide-project +``` + +#### Compilation Database + +The make system can generate generic native code indexing support in the form of +a [Compilation Database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) +that can be used by many different IDEs and source code indexers. + +```shell +make compile-commands +``` + +It's also possible to generate the Compilation Database for the HotSpot source +code only, which is a bit faster as it includes less information. + +```shell +make compile-commands-hotspot +``` + +### IDE support for Java code + +This section is a work in progress. \ No newline at end of file diff --git a/make/Main.gmk b/make/Main.gmk index 32f52fa342..f84d696606 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -291,6 +291,27 @@ compile-commands compile-commands-hotspot: ALL_TARGETS += $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK) ALL_TARGETS += compile-commands compile-commands-hotspot +################################################################################ +# VS Code projects +vscode-project: + +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \ + VSCODE_INDEXER=cpptools) + +vscode-project-clangd: + +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \ + VSCODE_INDEXER=clangd) + +vscode-project-rtags: + +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \ + VSCODE_INDEXER=rtags) + +vscode-project-ccls: + +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \ + VSCODE_INDEXER=ccls) + +ALL_TARGETS += vscode-project vscode-project-clangd vscode-project-rtags \ + vscode-project-ccls + ################################################################################ # Build demos targets @@ -786,6 +807,11 @@ else compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK) + vscode-project: compile-commands + vscode-project-clangd: compile-commands + vscode-project-rtags: compile-commands + vscode-project-ccls: compile-commands + # Jmods cannot be created until we have the jmod tool ready to run. During # a normal build we run it from the exploded image, but when cross compiling # it's run from the buildjdk, which is either created at build time or user diff --git a/make/UpdateBuildDocs.gmk b/make/UpdateBuildDocs.gmk index 51f7a6588c..6d84690c93 100644 --- a/make/UpdateBuildDocs.gmk +++ b/make/UpdateBuildDocs.gmk @@ -61,6 +61,14 @@ $(eval $(call SetupProcessMarkdown, testing, \ )) TARGETS += $(testing) +$(eval $(call SetupProcessMarkdown, ide, \ + FILES := $(DOCS_DIR)/ide.md, \ + DEST := $(DOCS_DIR), \ + CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ + OPTIONS := --toc, \ +)) +TARGETS += $(ide) + ################################################################################ $(eval $(call IncludeCustomExtension, UpdateBuildDocs.gmk)) diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index aa509c7f7e..51aaa286b9 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -613,7 +613,8 @@ DirToDotDot = \ # $2 - Directory to compute the relative path from RelativePath = \ $(eval $1_prefix := $(call FindCommonPathPrefix, $1, $2)) \ - $(eval $1_dotdots := $(call DirToDotDot, $(patsubst $($(strip $1)_prefix)/%, %, $2))) \ + $(eval $1_dotdots := $(call DirToDotDot, $(patsubst $($(strip $1)_prefix)%, %, $2))) \ + $(eval $1_dotdots := $(if $($(strip $1)_dotdots),$($(strip $1)_dotdots),.)) \ $(eval $1_suffix := $(patsubst $($(strip $1)_prefix)/%, %, $1)) \ $($(strip $1)_dotdots)/$($(strip $1)_suffix) @@ -982,6 +983,22 @@ else $(shell $(PRINTF) "%s" $(call ShellQuote, $1) >> $2) endif +################################################################################ +# FixPathList +# +# On Windows, converts a cygwin/unix style path list (colon-separated) into +# the native format (mixed mode, semicolon-separated). On other platforms, +# return the path list unchanged. +################################################################################ +ifeq ($(OPENJDK_TARGET_OS), windows) + FixPathList = \ + $(subst @,$(SPACE),$(subst $(SPACE),;,$(foreach entry,$(subst :,$(SPACE),\ + $(subst $(SPACE),@,$(strip $1))),$(call FixPath, $(entry))))) +else + FixPathList = \ + $1 +endif + ################################################################################ # DependOnVariable # diff --git a/make/vscode/CreateVSCodeProject.gmk b/make/vscode/CreateVSCodeProject.gmk new file mode 100644 index 0000000000..8583225f63 --- /dev/null +++ b/make/vscode/CreateVSCodeProject.gmk @@ -0,0 +1,113 @@ +# +# Copyright (c) 2019, 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. +# + +# This must be the first rule +default: all + +include $(SPEC) +include MakeBase.gmk + +################################################################################ +# Return the full path to an indexer-specific file fragment. +# +# Param 1: Fragment name +################################################################################ +GetIndexerFragment = \ + $(TOPDIR)/make/vscode/indexers/$(VSCODE_INDEXER)-$(1).txt + +################################################################################ +# Show indexer-specific notes if they exist, otherwise do nothing +################################################################################ +ifneq (,$(wildcard $(call GetIndexerFragment,notes))) + ShowIndexerNotes = $(CAT) $(call GetIndexerFragment,notes) +else + ShowIndexerNotes = +endif + +################################################################################ +# Return the platform-dependent preferred debug engine name. +################################################################################ +ifeq ($(OPENJDK_TARGET_OS), windows) + DebugEngineName = cppvsdbg +else + DebugEngineName = cppdbg +endif + +################################################################################ +# Return an additional configuration fragment if the WORKSPACE_ROOT is different +# from TOPDIR. +################################################################################ +ifneq ($(WORKSPACE_ROOT),$(TOPDIR)) + GetExtraWorkspaceRoot = $(TOPDIR)/make/vscode/template-workspace-folder.txt +else + GetExtraWorkspaceRoot = /dev/null +endif + +################################################################################ +# Create a project configuration from a given template, replacing a known set +# of variables. +# +# Param 1: Template +# Param 2: Output +################################################################################ +define CreateFromTemplate + $(call LogInfo, Generating $2) + $(call MakeDir, $(dir $2)) + $(SED) -e '/{{INDEXER_EXTENSIONS}}/r $(call GetIndexerFragment,extensions)' \ + -e '/{{INDEXER_SETTINGS}}/r $(call GetIndexerFragment,settings)' \ + -e '/{{EXTRA_WORKSPACE_ROOT}}/r $(call GetExtraWorkspaceRoot)' $1 | \ + $(SED) -e 's!{{TOPDIR}}!$(call FixPath,$(TOPDIR))!g' \ + -e 's!{{TOPDIR_RELATIVE}}!$(call FixPath,$(strip \ + $(call RelativePath,$(OUTPUTDIR),$(TOPDIR))))!g' \ + -e 's!{{WORKSPACE_ROOT}}!$(call FixPath,$(WORKSPACE_ROOT))!g' \ + -e 's!{{OUTPUTDIR}}!$(call FixPath,$(OUTPUTDIR))!g' \ + -e 's!{{CONF_NAME}}!$(CONF_NAME)!g' \ + -e 's!{{COMPILER}}!$(call FixPath,$(CXX)) $(SYSROOT_CFLAGS)!g' \ + -e 's!{{MAKE}}!$(call FixPath,$(MAKE))!g' \ + -e 's!{{PATH}}!$(call FixPathList,$(PATH))!g' \ + -e 's!{{DEBUGENGINENAME}}!$(call DebugEngineName)!g' \ + -e '/{{INDEXER_EXTENSIONS}}/d' \ + -e '/{{INDEXER_SETTINGS}}/d' \ + -e '/{{EXTRA_WORKSPACE_ROOT}}/d' \ + > $2 +endef + +$(OUTPUTDIR)/jdk.code-workspace: + $(call LogWarn, Creating workspace $@) + $(call CreateFromTemplate, $(TOPDIR)/make/vscode/template-workspace.jsonc, $@) + $(call ShowIndexerNotes) + +$(OUTPUTDIR)/.vscode/tasks.json: + $(call CreateFromTemplate, $(TOPDIR)/make/vscode/template-tasks.jsonc, $@) + +$(OUTPUTDIR)/.vscode/launch.json: + $(call CreateFromTemplate, $(TOPDIR)/make/vscode/template-launch.jsonc, $@) + +TARGETS := $(OUTPUTDIR)/jdk.code-workspace $(OUTPUTDIR)/.vscode/tasks.json \ + $(OUTPUTDIR)/.vscode/launch.json + +all: $(TARGETS) + +.PHONY: all $(TARGETS) diff --git a/make/vscode/indexers/ccls-extensions.txt b/make/vscode/indexers/ccls-extensions.txt new file mode 100644 index 0000000000..4fdb292277 --- /dev/null +++ b/make/vscode/indexers/ccls-extensions.txt @@ -0,0 +1,2 @@ + "ms-vscode.cpptools", + "ccls-project.ccls" diff --git a/make/vscode/indexers/ccls-notes.txt b/make/vscode/indexers/ccls-notes.txt new file mode 100644 index 0000000000..674894ff2f --- /dev/null +++ b/make/vscode/indexers/ccls-notes.txt @@ -0,0 +1,3 @@ + +* The "ccls" indexer must be present in PATH, or configured with "ccls.launch.command" in user preferences. + diff --git a/make/vscode/indexers/ccls-settings.txt b/make/vscode/indexers/ccls-settings.txt new file mode 100644 index 0000000000..394a1399e9 --- /dev/null +++ b/make/vscode/indexers/ccls-settings.txt @@ -0,0 +1,28 @@ + // Configure cpptools IntelliSense + "C_Cpp.intelliSenseCachePath": "{{OUTPUTDIR}}/.vscode", + "C_Cpp.default.compileCommands": "{{OUTPUTDIR}}/compile_commands.json", + "C_Cpp.default.cppStandard": "c++03", + "C_Cpp.default.compilerPath": "{{COMPILER}}", + + // Configure ccls + "ccls.misc.compilationDatabaseDirectory": "{{TOPDIR_RELATIVE}}", + "ccls.cache.hierarchicalPath": true, + "ccls.cache.directory": "{{OUTPUTDIR}}/.vscode/ccls", + + // Avoid issues with precompiled headers + "ccls.clang.excludeArgs": [ + // Windows / MSVC + "-Fp{{OUTPUTDIR}}/hotspot/variant-server/libjvm/objs/BUILD_LIBJVM.pch", + "-Fp{{OUTPUTDIR}}/hotspot/variant-server/libjvm/gtest/objs/BUILD_GTEST_LIBJVM.pch", + "-Yuprecompiled.hpp", + // MacOS / clang + "{{OUTPUTDIR}}/hotspot/variant-server/libjvm/objs/precompiled/precompiled.hpp.pch", + "{{OUTPUTDIR}}/hotspot/variant-server/libjvm/gtest/objs/precompiled/precompiled.hpp.pch", + "-include-pch" + ], + + // Disable conflicting features from cpptools + "C_Cpp.autocomplete": "Disabled", + "C_Cpp.errorSquiggles": "Disabled", + "C_Cpp.formatting": "Disabled", + "C_Cpp.intelliSenseEngine": "Disabled", diff --git a/make/vscode/indexers/clangd-extensions.txt b/make/vscode/indexers/clangd-extensions.txt new file mode 100644 index 0000000000..06ca0d32e4 --- /dev/null +++ b/make/vscode/indexers/clangd-extensions.txt @@ -0,0 +1,2 @@ + "ms-vscode.cpptools", + "llvm-vs-code-extensions.vscode-clangd" diff --git a/make/vscode/indexers/clangd-notes.txt b/make/vscode/indexers/clangd-notes.txt new file mode 100644 index 0000000000..46ff3438a8 --- /dev/null +++ b/make/vscode/indexers/clangd-notes.txt @@ -0,0 +1,4 @@ + +* The "clangd" indexer must be present in PATH, or configured with "clangd.path" in user preferences. +* If building with clang (default on OSX), precompiled headers must be disabled. + diff --git a/make/vscode/indexers/clangd-settings.txt b/make/vscode/indexers/clangd-settings.txt new file mode 100644 index 0000000000..b3227ce28e --- /dev/null +++ b/make/vscode/indexers/clangd-settings.txt @@ -0,0 +1,17 @@ + // Configure cpptools IntelliSense + "C_Cpp.intelliSenseCachePath": "{{OUTPUTDIR}}/.vscode", + "C_Cpp.default.compileCommands": "{{OUTPUTDIR}}/compile_commands.json", + "C_Cpp.default.cppStandard": "c++03", + "C_Cpp.default.compilerPath": "{{COMPILER}}", + + // Configure clangd + "clangd.arguments": [ + "-background-index", + "-compile-commands-dir={{OUTPUTDIR}}" + ], + + // Disable conflicting features from cpptools + "C_Cpp.autocomplete": "Disabled", + "C_Cpp.errorSquiggles": "Disabled", + "C_Cpp.formatting": "Disabled", + "C_Cpp.intelliSenseEngine": "Disabled", diff --git a/make/vscode/indexers/cpptools-extensions.txt b/make/vscode/indexers/cpptools-extensions.txt new file mode 100644 index 0000000000..820e3670f8 --- /dev/null +++ b/make/vscode/indexers/cpptools-extensions.txt @@ -0,0 +1 @@ + "ms-vscode.cpptools" diff --git a/make/vscode/indexers/cpptools-settings.txt b/make/vscode/indexers/cpptools-settings.txt new file mode 100644 index 0000000000..155bf9c497 --- /dev/null +++ b/make/vscode/indexers/cpptools-settings.txt @@ -0,0 +1,5 @@ + // Configure cpptools IntelliSense + "C_Cpp.intelliSenseCachePath": "{{OUTPUTDIR}}/.vscode", + "C_Cpp.default.compileCommands": "{{OUTPUTDIR}}/compile_commands.json", + "C_Cpp.default.cppStandard": "c++03", + "C_Cpp.default.compilerPath": "{{COMPILER}}", diff --git a/make/vscode/indexers/rtags-extensions.txt b/make/vscode/indexers/rtags-extensions.txt new file mode 100644 index 0000000000..c4b872db8b --- /dev/null +++ b/make/vscode/indexers/rtags-extensions.txt @@ -0,0 +1,2 @@ + "ms-vscode.cpptools", + "jomiller.rtags-client" diff --git a/make/vscode/indexers/rtags-settings.txt b/make/vscode/indexers/rtags-settings.txt new file mode 100644 index 0000000000..7e32633ac6 --- /dev/null +++ b/make/vscode/indexers/rtags-settings.txt @@ -0,0 +1,14 @@ + // Configure cpptools IntelliSense + "C_Cpp.intelliSenseCachePath": "{{OUTPUTDIR}}/.vscode", + "C_Cpp.default.compileCommands": "{{OUTPUTDIR}}/compile_commands.json", + "C_Cpp.default.cppStandard": "c++03", + "C_Cpp.default.compilerPath": "{{COMPILER}}", + + // Configure RTags + "rtags.misc.compilationDatabaseDirectory": "{{OUTPUTDIR}}", + + // Disable conflicting features from cpptools + "C_Cpp.autocomplete": "Disabled", + "C_Cpp.errorSquiggles": "Disabled", + "C_Cpp.formatting": "Disabled", + "C_Cpp.intelliSenseEngine": "Disabled", diff --git a/make/vscode/template-launch.jsonc b/make/vscode/template-launch.jsonc new file mode 100644 index 0000000000..a7b3510e9c --- /dev/null +++ b/make/vscode/template-launch.jsonc @@ -0,0 +1,55 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "gtestLauncher", + "type": "{{DEBUGENGINENAME}}", + "request": "launch", + "program": "{{OUTPUTDIR}}/hotspot/variant-server/libjvm/gtest/gtestLauncher", + "args": ["-jdk:{{OUTPUTDIR}}/jdk"], + "stopAtEntry": false, + "cwd": "{{WORKSPACE_ROOT}}", + "environment": [], + "externalConsole": false, + "preLaunchTask": "Make 'exploded-image'", + "osx": { + "MIMode": "lldb", + "internalConsoleOptions": "openOnSessionStart", + "args": ["--gtest_color=no", "-jdk:{{OUTPUTDIR}}/jdk"] + }, + "linux": { + "MIMode": "gdb", + "setupCommands": [ + { + "text": "handle SIGSEGV noprint nostop", + "description": "Disable stopping on signals handled by the JVM" + } + ] + } + }, + { + "name": "java", + "type": "{{DEBUGENGINENAME}}", + "request": "launch", + "program": "{{OUTPUTDIR}}/jdk/bin/java", + "stopAtEntry": false, + "cwd": "{{WORKSPACE_ROOT}}", + "environment": [], + "externalConsole": false, + "preLaunchTask": "Make 'exploded-image'", + "osx": { + "MIMode": "lldb", + "internalConsoleOptions": "openOnSessionStart", + }, + "linux": { + "MIMode": "gdb", + "setupCommands": [ + { + "text": "handle SIGSEGV noprint nostop", + "description": "Disable stopping on signals handled by the JVM" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/make/vscode/template-tasks.jsonc b/make/vscode/template-tasks.jsonc new file mode 100644 index 0000000000..0b7badb560 --- /dev/null +++ b/make/vscode/template-tasks.jsonc @@ -0,0 +1,55 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Update compilation database (compile_commands.json)", + "type": "shell", + "options": { + "env": { + "PATH": "{{PATH}}" + }, + "cwd": "{{WORKSPACE_ROOT}}" + }, + "command": "{{MAKE}} CONF_NAME={{CONF_NAME}} compile-commands", + "problemMatcher": [] + }, + { + "label": "Make 'hotspot'", + "type": "shell", + "options": { + "env": { + "PATH": "{{PATH}}" + }, + "cwd": "{{WORKSPACE_ROOT}}" + }, + "command": "{{MAKE}} CONF_NAME={{CONF_NAME}} hotspot", + "problemMatcher": ["$gcc"] + }, + { + "label": "Make 'exploded-image'", + "type": "shell", + "options": { + "env": { + "PATH": "{{PATH}}" + }, + "cwd": "{{WORKSPACE_ROOT}}" + }, + "command": "{{MAKE}} CONF_NAME={{CONF_NAME}} exploded-image", + "problemMatcher": ["$gcc"] + }, + { + "label": "Make 'jdk'", + "type": "shell", + "options": { + "env": { + "PATH": "{{PATH}}" + }, + "cwd": "{{WORKSPACE_ROOT}}" + }, + "command": "{{MAKE}} CONF_NAME={{CONF_NAME}} jdk", + "problemMatcher": ["$gcc"] + } + ] +} diff --git a/make/vscode/template-workspace-folder.txt b/make/vscode/template-workspace-folder.txt new file mode 100644 index 0000000000..82c15fb178 --- /dev/null +++ b/make/vscode/template-workspace-folder.txt @@ -0,0 +1,4 @@ + { + "name": "Additional sources", + "path": "{{WORKSPACE_ROOT}}" + }, diff --git a/make/vscode/template-workspace.jsonc b/make/vscode/template-workspace.jsonc new file mode 100644 index 0000000000..30533c7ce8 --- /dev/null +++ b/make/vscode/template-workspace.jsonc @@ -0,0 +1,63 @@ +{ + "folders": [ + { + "name": "Source root", + "path": "{{TOPDIR}}" + }, + // {{EXTRA_WORKSPACE_ROOT}} + { + "name": "Build artifacts", + "path": "{{OUTPUTDIR}}" + } + ], + "extensions": { + "recommendations": [ + // {{INDEXER_EXTENSIONS}} + ] + }, + "settings": { + // {{INDEXER_SETTINGS}} + + // Additional conventions + "files.associations": { + "*.gmk": "makefile" + }, + + // Having these enabled slow down task execution + "typescript.tsc.autoDetect": "off", + "gulp.autoDetect": "off", + "npm.autoDetect": "off", + "grunt.autoDetect": "off", + "jake.autoDetect": "off", + + // Certain types of files are not relevant for the file browser + "files.exclude": { + "**/.git": true, + "**/.hg": true, + "**/.DS_Store": true, + }, + + // Files that may be interesting to browse manually, but avoided during searches + "search.exclude": { + "**/*.class": true, + "**/*.jsa": true, + "**/*.vardeps": true, + "**/*.o": true, + "**/*.obj": true, + "**/*.d": true, + "**/*.d.*": true, + "**/*_batch*": true, + "**/*.marker": true, + "**/compile-commands/": true, + "**/objs": true, + "**/launcher-objs": true, + "**/*.cmdline": true, + "**/*.log": true, + ".vscode": true, + ".clangd": true + }, + + // Trailing whitespace should never be used in this project + "files.trimTrailingWhitespace": true + } +} \ No newline at end of file diff --git a/test/make/TestMakeBase.gmk b/test/make/TestMakeBase.gmk index e61ae5b1ad..63b235d370 100644 --- a/test/make/TestMakeBase.gmk +++ b/test/make/TestMakeBase.gmk @@ -326,6 +326,18 @@ $(call AssertEquals, \ RelativePath, \ ) +$(call AssertEquals, \ + $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/baz), \ + ./banan/kung, \ + RelativePath, \ +) + +$(call AssertEquals, \ + $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/baz/), \ + ./banan/kung, \ + RelativePath, \ +) + ################################################################################ # Test ParseKeywordVariable -- GitLab