diff options
| author | lines9686-rgb <282495677+lines9686-rgb@users.noreply.github.com> | 2026-11-23 18:51:13 +0300 |
|---|---|---|
| committer | lines9686-rgb <282495677+lines9686-rgb@users.noreply.github.com> | 2026-11-24 07:09:02 +0300 |
| commit | 5dbd92b92d147cdc5c365fffd8a3f83c6d6ac5f9 (patch) | |
| tree | 1d3a240c61df04b351c20292bb65be2fb93b6531 /scripts | |
| parent | ece4ba5b31ebc6f345c8e29eae1261f2f780057a (diff) | |
build scripts: refuse a folder with % in its path up front
cmd.exe expands %...% on every line of the generated _build.cmd (twice on a CALL line), and cl.exe rejects a % in the
path-valued /D definitions of the runtime's test targets (D8038) however it is quoted, so a checkout with % in its path
failed in configure, or a few hundred Ninja steps in once the batch was escaped (@ezbyDev's measurements in the original repository).
build_runtime.ps1 now stops before looking for Visual Studio when the checkout path has a %, and build_llvm_mc.ps1 when
-Temp has one, each naming the folder; docs/testing.md gets a Known-problems row. tests/test_build_percent_path.py runs
both scripts with such a path, with git, python and vswhere hidden so that a missing check can't start a real build.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/build_llvm_mc.ps1 | 5 | ||||
| -rw-r--r-- | scripts/build_runtime.ps1 | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/scripts/build_llvm_mc.ps1 b/scripts/build_llvm_mc.ps1 index 3d4d8044a..8c73337de 100644 --- a/scripts/build_llvm_mc.ps1 +++ b/scripts/build_llvm_mc.ps1 | |||
| @@ -19,6 +19,11 @@ param( | |||
| 19 | ) | 19 | ) |
| 20 | $ErrorActionPreference = "Stop" | 20 | $ErrorActionPreference = "Stop" |
| 21 | 21 | ||
| 22 | # cmd.exe expands %...% on every line of _build.cmd (twice on a CALL line), so a -Temp with % in it breaks the build. | ||
| 23 | if ($Temp.Contains('%')) { | ||
| 24 | throw "-Temp '$Temp' contains '%', which cmd.exe expands in the generated _build.cmd. Choose a -Temp folder without % in its path." | ||
| 25 | } | ||
| 26 | |||
| 22 | if (-not $Keep) { | 27 | if (-not $Keep) { |
| 23 | # Compare directory boundaries, including when the paths do not exist yet. | 28 | # Compare directory boundaries, including when the paths do not exist yet. |
| 24 | $paths = $ExecutionContext.SessionState.Path | 29 | $paths = $ExecutionContext.SessionState.Path |
diff --git a/scripts/build_runtime.ps1 b/scripts/build_runtime.ps1 index 8bd74d1cf..63acb7ce3 100644 --- a/scripts/build_runtime.ps1 +++ b/scripts/build_runtime.ps1 | |||
| @@ -35,6 +35,11 @@ function Find-BuildTool([string]$Preferred, [string]$CommandName, [scriptblock]$ | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | $root = Split-Path $PSScriptRoot -Parent | 37 | $root = Split-Path $PSScriptRoot -Parent |
| 38 | # A % in the checkout path cannot build: cmd.exe expands %...% in _build.cmd, and cl.exe rejects a % in the | ||
| 39 | # path-valued /D definitions of the test targets (D8038) however it is quoted. Say so before anything starts. | ||
| 40 | if ($root.Contains('%')) { | ||
| 41 | throw "The checkout path '$root' contains '%', and the runtime can't be built from there (cmd.exe and cl.exe treat % specially). Move or clone the checkout to a folder without % in its path (docs/testing.md, Known problems)." | ||
| 42 | } | ||
| 38 | $installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer" | 43 | $installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer" |
| 39 | $vs = & "$installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | 44 | $vs = & "$installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath |
| 40 | if (-not $vs) { throw "Visual Studio with the C++ x64 tools wasn't found." } | 45 | if (-not $vs) { throw "Visual Studio with the C++ x64 tools wasn't found." } |