8258240: make vscode-project on Windows generates jdk.code-workspace file with unescaped '\' in paths

Reviewed-by: erikj
This commit is contained in:
Daniel Jelinski 2022-01-19 14:18:14 +00:00 committed by Erik Joelsson
parent 96114315cf
commit b20b11cf82

View File

@ -29,6 +29,13 @@ default: all
include $(SPEC)
include MakeBase.gmk
################################################################################
# SedEscape
#
# Escape special characters for use in SED replacement string
################################################################################
SedEscape = $(subst !,\!,$(subst \,\\,$1))
################################################################################
# Return the full path to an indexer-specific file fragment.
#
@ -78,15 +85,15 @@ define CreateFromTemplate
$(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' \
$(SED) -e 's!{{TOPDIR}}!$(call SedEscape,$(call FixPath,$(TOPDIR)))!g' \
-e 's!{{TOPDIR_RELATIVE}}!$(call SedEscape,$(call FixPath,$(strip \
$(call RelativePath,$(OUTPUTDIR),$(TOPDIR)))))!g' \
-e 's!{{WORKSPACE_ROOT}}!$(call SedEscape,$(call FixPath,$(WORKSPACE_ROOT)))!g' \
-e 's!{{OUTPUTDIR}}!$(call SedEscape,$(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 FixPath,$(PATH))!g' \
-e 's!{{COMPILER}}!$(call SedEscape,$(call FixPath,$(CXX))) $(SYSROOT_CFLAGS)!g' \
-e 's!{{MAKE}}!$(call SedEscape,$(call FixPath,$(MAKE)))!g' \
-e 's!{{PATH}}!$(call SedEscape,$(call FixPath,$(PATH)))!g' \
-e 's!{{DEBUGENGINENAME}}!$(call DebugEngineName)!g' \
-e '/{{INDEXER_EXTENSIONS}}/d' \
-e '/{{INDEXER_SETTINGS}}/d' \