diff options
| author | Billy O'Neal <bion@microsoft.com> | 2021-02-04 10:15:44 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-04 10:15:44 -0800 |
| commit | aa60b7efa56a83ead743718941d8b320ef4a05af (patch) | |
| tree | db9f9ebd6fa37598b2f5f2ad564eb858cdeddcb0 /scripts/cleanEnvironmentHelper.ps1 | |
| parent | f226416d2eafc495dd03572cb61542fb1670ffdc (diff) | |
| download | vcpkg-aa60b7efa56a83ead743718941d8b320ef4a05af.tar.gz vcpkg-aa60b7efa56a83ead743718941d8b320ef4a05af.zip | |
[vcpkg] Download vcpkg.exe rather than building it in bootstrap on Windows. (#15474)
This reduces bootstrap cost for Windows customers, resolving the issue initially submitted as #12502 .
The `toolsrc` tree was extracted to https://github.com/microsoft/vcpkg-tool. `bootstrap.sh` was changed to download the right source tarball, extract, and build it. This was chosen over the previous attempt, a submodule, over concerns of accidentally destroying people's local modifications.
Diffstat (limited to 'scripts/cleanEnvironmentHelper.ps1')
| -rw-r--r-- | scripts/cleanEnvironmentHelper.ps1 | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/scripts/cleanEnvironmentHelper.ps1 b/scripts/cleanEnvironmentHelper.ps1 deleted file mode 100644 index fa5fe869d..000000000 --- a/scripts/cleanEnvironmentHelper.ps1 +++ /dev/null @@ -1,52 +0,0 @@ -# Capture environment variables for the System and User. Also add some special/built-in variables. -# These will be used to synthesize a clean environment -$specialEnvironmentMap = @{ "SystemDrive"=$env:SystemDrive; "SystemRoot"=$env:SystemRoot; "UserProfile"=$env:UserProfile; "TMP"=$env:TMP } # These are built-in and not set in the registry -$machineEnvironmentMap = [Environment]::GetEnvironmentVariables('Machine') # HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment -$userEnvironmentMap = [Environment]::GetEnvironmentVariables('User') # HKEY_CURRENT_USER\Environment - -# Identify the keySet of environment variable names -$nameSet = ($specialEnvironmentMap.Keys + $machineEnvironmentMap.Keys + $userEnvironmentMap.Keys) | Sort-Object | Select-Object -Unique - -# Any environment variable in the $nameSet should be restored to its original value -foreach ($name in $nameSet) -{ - if ($specialEnvironmentMap.ContainsKey($name)) - { - [Environment]::SetEnvironmentVariable($name, $specialEnvironmentMap[$name], 'Process') - continue; - } - - # PATH needs to be concatenated as it has values in both machine and user environment. Any other values should be set. - if ($name -eq 'path') - { - $pathValuePartial = @() - # Machine values before user values - $pathValuePartial += $machineEnvironmentMap[$name] -split ';' - $pathValuePartial += $userEnvironmentMap[$name] -split ';' - $pathValue = $pathValuePartial -join ';' - [Environment]::SetEnvironmentVariable($name, $pathValue, 'Process') - continue; - } - - if ($userEnvironmentMap.ContainsKey($name)) - { - [Environment]::SetEnvironmentVariable($name, $userEnvironmentMap[$name], 'Process') - continue; - } - - if ($machineEnvironmentMap.ContainsKey($name)) - { - [Environment]::SetEnvironmentVariable($name, $machineEnvironmentMap[$name], 'Process') - continue; - } - - throw "Unreachable: Unknown variable $name" -} - -# Any environment variable NOT in the $nameSet should be removed -$processEnvironmentMap = [Environment]::GetEnvironmentVariables('Process') -$variablesForRemoval = $processEnvironmentMap.Keys | Where-Object {$nameSet -notcontains $_} -foreach ($name in $variablesForRemoval) -{ - [Environment]::SetEnvironmentVariable($name, $null, 'Process') -} |
