diff --git a/CHANGELOG.md b/CHANGELOG.md index b1bc5514..7d018e22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,27 +5,17 @@ Improvements: - Improve dryrun parsing to support single-quoted tool paths. mingw-make now working. [#739](https://github.com/microsoft/vscode-makefile-tools/issues/739) [@vannaka](https://github.com/vannaka) - -## 0.12 - -Improvements: - - Add native support for custom `Makefile` naming conventions such as `*.Makefile`, `Makefile.*`, and `*.makefile`. [#645](https://github.com/microsoft/vscode-makefile-tools/issues/645) - Add `# region` / `# endregion` folding support for makefiles. [#544](https://github.com/microsoft/vscode-makefile-tools/issues/544) - Add `name` and `description` fields to `makefile.launchConfigurations` to allow user-friendly labeling of launch configurations. [#568](https://github.com/microsoft/vscode-makefile-tools/issues/568) - Add `makefile.runOnSave` setting to automatically build and run the current target when a file is saved. [#786](https://github.com/microsoft/vscode-makefile-tools/issues/786) - Add `makefile.buildOnSave` setting to automatically build the current target when a file is saved. [#558](https://github.com/microsoft/vscode-makefile-tools/issues/558) - Add `makefile.cleanConfigureOnConfigurationChange` setting to always run Clean Configure when switching build configurations. [#534](https://github.com/microsoft/vscode-makefile-tools/issues/534) -- Make the wording more clear for the clean and build command. [#136](https://github.com/microsoft/vscode-makefile-tools/issues/136) -- While parsing, don't replace characters with newlines if they are inside quotes. [#671](https://github.com/microsoft/vscode-makefile-tools/issues/671) -- Handle line continuation characters during parsing. [#628](https://github.com/microsoft/vscode-makefile-tools/issues/628) -- Created issue templates for bug reporting and docs/feature requests. [#702](https://github.com/microsoft/vscode-makefile-tools/issues/702) - Added buildCleanTarget to panel visibility settings. [#744](https://github.com/microsoft/vscode-makefile-tools/issues/744). - Document all `makefile.*` settings with types, defaults, and descriptions. [#790](https://github.com/microsoft/vscode-makefile-tools/issues/790) Bug Fixes: -- Fix intellisense "unrecognized token" issue with define. [#526](https://github.com/microsoft/vscode-makefile-tools/issues/526), [#465](https://github.com/microsoft/vscode-makefile-tools/issues/465) - Fix incorrect parsing of environment variables with quoted values containing spaces. [#729](https://github.com/microsoft/vscode-makefile-tools/issues/729) - Fix build task failure where task definition was missing command property. [#748](https://github.com/microsoft/vscode-makefile-tools/issues/748) - Added support for C++23 and C++26 standard flags. [#752](https://github.com/microsoft/vscode-makefile-tools/issues/752) @@ -38,8 +28,22 @@ Bug Fixes: - Fix binary path links in output log not being clickable on Windows when the path has no .exe extension. [#698](https://github.com/microsoft/vscode-makefile-tools/issues/698) - Fix `parseCompilerArgs.bat` failing when macro definitions contain numeric expressions like `-1` inside quoted values. [#755](https://github.com/microsoft/vscode-makefile-tools/issues/755) - Fix launch target resetting to "Unset" when `binaryArgs` is added to `makefile.launchConfigurations` on Windows. [#737](https://github.com/microsoft/vscode-makefile-tools/issues/737) +- Fix parsing of environment variables with multiline values from preconfigure scripts. [#754](https://github.com/microsoft/vscode-makefile-tools/issues/754) - Fix Project Outline showing "Unset" for launch configurations that have a `name` field. [#808](https://github.com/microsoft/vscode-makefile-tools/issues/808) +## 0.12 + +Improvements: + +- Make the wording more clear for the clean and build command. [#136](https://github.com/microsoft/vscode-makefile-tools/issues/136) +- While parsing, don't replace characters with newlines if they are inside quotes. [#671](https://github.com/microsoft/vscode-makefile-tools/issues/671) +- Handle line continuation characters during parsing. [#628](https://github.com/microsoft/vscode-makefile-tools/issues/628) +- Created issue templates for bug reporting and docs/feature requests. [#702](https://github.com/microsoft/vscode-makefile-tools/issues/702) + +Bug Fixes: + +- Fix intellisense "unrecognized token" issue with define. [#526](https://github.com/microsoft/vscode-makefile-tools/issues/526), [#465](https://github.com/microsoft/vscode-makefile-tools/issues/465) + ## 0.11 Improvements: diff --git a/src/make.ts b/src/make.ts index a8eeb042..6e3872f2 100644 --- a/src/make.ts +++ b/src/make.ts @@ -1107,13 +1107,16 @@ export async function postConfigure(triggeredBy: TriggeredBy): Promise { // The input 'content' represents the output of a command that lists all the environment variables: // set on windows or printenv on linux/mac. async function applyEnvironment(content: string | undefined): Promise { - let lines: string[] = content?.split(/\r?\n/) || []; - lines.forEach((line) => { - let eqPos: number = line.search("="); - // Sometimes we get a "" line and searching for = returns -1. Skip. + // On Linux/macOS, printenv -0 outputs NUL-separated entries to support multiline values + // (e.g., BASH_FUNC_* exported functions). On Windows, 'set' outputs newline-separated entries. + const separator = process.platform === "win32" ? /\r?\n/ : /\0/; + let entries: string[] = content?.split(separator) || []; + entries.forEach((entry) => { + let eqPos: number = entry.search("="); + // Sometimes we get a "" entry and searching for = returns -1. Skip. if (eqPos !== -1) { - let envVarName: string = line.substring(0, eqPos); - let envVarValue: string = line.substring(eqPos + 1, line.length); + let envVarName: string = entry.substring(0, eqPos); + let envVarValue: string = entry.substring(eqPos + 1, entry.length); // Only save to the modified environment values if it's different than the process.env. if (!process.env[envVarName] || envVarValue !== process.env[envVarName]) { @@ -1158,7 +1161,7 @@ export async function runPrePostConfigureScript( wrapScriptContent = `source '${scriptFile}' ${ scriptArgs.length > 0 ? scriptArgs.join(" ").toString() : "" }\n`; - wrapScriptContent += `printenv > '${wrapScriptOutFile}'`; + wrapScriptContent += `printenv -0 > '${wrapScriptOutFile}'`; wrapScriptFile += ".sh"; }