diff --git a/doc/ide.html b/doc/ide.html new file mode 100644 index 00000000000..1730eb0bef5 --- /dev/null +++ b/doc/ide.html @@ -0,0 +1,54 @@ + + +
+ + + +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.
+There are a few ways to generate IDE configuration for the native sources, depending on which IDE to use.
+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.
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.
+This section is a work in progress.
+make ide-project
+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
+This section is a work in progress.
+ + diff --git a/doc/ide.md b/doc/ide.md new file mode 100644 index 00000000000..4a692efd22f --- /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 791be753513..0bbcc5c65fc 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -287,6 +287,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 @@ -774,6 +795,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 011be4c620e..2f9aec75a29 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 44166ac3d3f..fad6778f96e 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -471,6 +471,22 @@ else $1 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 ($(call isTargetOs, windows), true) + 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/common/Utils.gmk b/make/common/Utils.gmk index e58e395ed7f..8bf8c15476a 100644 --- a/make/common/Utils.gmk +++ b/make/common/Utils.gmk @@ -122,7 +122,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) diff --git a/make/vscode/CreateVSCodeProject.gmk b/make/vscode/CreateVSCodeProject.gmk new file mode 100644 index 00000000000..19f80426ddc --- /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 ($(call isTargetOs, windows), true) + 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 00000000000..4fdb2922772 --- /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 00000000000..674894ff2f5 --- /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 00000000000..394a1399e9b --- /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 00000000000..06ca0d32e4e --- /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 00000000000..46ff3438a86 --- /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 00000000000..b3227ce28ec --- /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 00000000000..820e3670f80 --- /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 00000000000..155bf9c4970 --- /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 00000000000..c4b872db8b0 --- /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 00000000000..7e32633ac66 --- /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 00000000000..a7b3510e9c2 --- /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 00000000000..0b7badb560e --- /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 00000000000..82c15fb178a --- /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 00000000000..30533c7ce84 --- /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 64dd83b9e58..71dec2277b0 100644 --- a/test/make/TestMakeBase.gmk +++ b/test/make/TestMakeBase.gmk @@ -361,6 +361,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