diff --git a/doc/ide.html b/doc/ide.html new file mode 100644 index 0000000000000000000000000000000000000000..1730eb0bef5b5bb1e6d18aed43b61ee4155a5aaa --- /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 0000000000000000000000000000000000000000..4a692efd22f03f9dd6f14eec95387002598c4d19 --- /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 32f52fa342315774dd8326632e1f46bbc0056592..f84d69660675592c8a53edb665b0d569945257d1 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 51f7a6588c5d147cddd709901f119d4250aa7167..6d84690c9363677206b7220c51243605fe783a07 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 aa509c7f7ecf8b9ea9836f8cb9bd5d09c5762132..51aaa286b9b11b49be851250a00a76d2737740ae 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 0000000000000000000000000000000000000000..8583225f6327899415256e4093064f1c9a74b1c6 --- /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 0000000000000000000000000000000000000000..4fdb29227726cac34f7e37951713ced04290f41a --- /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 0000000000000000000000000000000000000000..674894ff2f5672be000cccb54a4338aed58ff024 --- /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 0000000000000000000000000000000000000000..394a1399e9b34993eb2963e2b38d8dcb630f7b56 --- /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 0000000000000000000000000000000000000000..06ca0d32e4e9dfb6ba2f6a71fc7f2f16b73682ad --- /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 0000000000000000000000000000000000000000..46ff3438a865456f42ac8b3978b022011dfc01f6 --- /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 0000000000000000000000000000000000000000..b3227ce28ec50e173eeb898a8ad9ec05401c0dc2 --- /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 0000000000000000000000000000000000000000..820e3670f80d5f463d74d8b5416b28cb281d0356 --- /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 0000000000000000000000000000000000000000..155bf9c4970357650236386e66a177228b50e197 --- /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 0000000000000000000000000000000000000000..c4b872db8b0542dfd550a2a6b5cf7205d6e7e8a7 --- /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 0000000000000000000000000000000000000000..7e32633ac668b50934b828b9d07117182b1ab27a --- /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 0000000000000000000000000000000000000000..a7b3510e9c20a91958e751ebff640efe174fbacf --- /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 0000000000000000000000000000000000000000..0b7badb560e567641d3a9a822e45e082c3c1fc70 --- /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 0000000000000000000000000000000000000000..82c15fb178aef9f3e1aefc526c6548ea5553f49c --- /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 0000000000000000000000000000000000000000..30533c7ce8437743ea824b19bddb3d49aa131228 --- /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 e61ae5b1ada4c7b94493d9fba39977afe57ca614..63b235d3705bba0e50e3c9e2c2aa9063ea227277 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