mirror of
git://code.qt.io/qt/qt5.git
synced 2026-02-01 19:36:04 +08:00
Set-EnvironmentVariable helper: apply envvar to current PS session
When you use the helper to set an envvar in provisioning, you can not
reference the machine scoped variable in a later .ps1 script in the same
provisoning run using the direct/static reference '$env:NAME', instead
you have to use a more verbose method with e.g. 'Get-Item' cmdlet and/or
set the envvar additionally to the process scope yourself.
This change makes the helper also add process scope to the envvars, this
way envvars set in provisioning can be simply referenced with
'$env:NAME' in later provisioning scripts, which is consistent with the
way you can use SetEnvVar helper in Unix and directly reference the
envvar with just its variable name in later .sh scripts.
This change also removes duplicate local scope envvar definitions now
that Set-EnvironmentVariable helper does it.
Change-Id: I804fa8f8dfce742a84e8b4bc077f466820589f7e
(cherry picked from commit 30a92ce1f2)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tero Heikkinen <tero.heikkinen@qt.io>
This commit is contained in:
@@ -57,7 +57,6 @@ $ndkFolderDefault = Install $ndkCachedUrlDefault $ndkZip $ndkChecksumDefault $nd
|
||||
Set-EnvironmentVariable "ANDROID_NDK_ROOT_DEFAULT" $ndkFolderDefault
|
||||
# To be used by vcpkg
|
||||
Set-EnvironmentVariable "ANDROID_NDK_HOME" $ndkFolderDefault
|
||||
$env:ANDROID_NDK_HOME = "$ndkFolderDefault"
|
||||
|
||||
if ($ndkVersionDefault -eq $ndkVersionLatest) {
|
||||
Write-Host "Android Latest version is the same than Default. NDK installation done."
|
||||
|
||||
@@ -189,6 +189,8 @@ function Set-EnvironmentVariable
|
||||
Write-Host "Setting environment variable `"$($Key)`" to `"$($Value)`""
|
||||
|
||||
[Environment]::SetEnvironmentVariable($Key, $Value, [EnvironmentVariableTarget]::Machine)
|
||||
# Make the envvar immediately available to subsequent scripts run in the same session.
|
||||
[Environment]::SetEnvironmentVariable($Key, $Value, [EnvironmentVariableTarget]::Process)
|
||||
}
|
||||
|
||||
function Is64BitWinHost
|
||||
|
||||
@@ -55,11 +55,7 @@ if(![System.IO.File]::Exists("$vcpkgRoot\vcpkg.exe")){
|
||||
# Disable telemetry
|
||||
Set-Content -Value "" -Path "$vcpkgRoot\vcpkg.disable-metrics" -Force
|
||||
|
||||
# Setting VCPKG_ROOT using Set-EnvironmentVariable makes the variable only
|
||||
# available during build time. In order to make it available during the
|
||||
# provisioning, we need to directly set it via $env:VCPKG_ROOT as well.
|
||||
Set-EnvironmentVariable "VCPKG_ROOT" "$vcpkgRoot"
|
||||
$env:VCPKG_ROOT = "$vcpkgRoot"
|
||||
|
||||
# Set a source for vcpkg Binary and Asset Cache
|
||||
# The `coin/provisioning/common/windows/mount-vcpkg-cache-drive.ps1` script is
|
||||
|
||||
Reference in New Issue
Block a user