diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-11-08 18:38:33 +0000 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-11-13 16:13:43 +0000 |
commit | 9bd2132cfa62c53b8ec902ebe9469ea57a121eb4 (patch) | |
tree | 3235bdbb85205541648be478a81d27d10c54e805 | |
parent | 1d60a6a2edb36632136db8f3547577838bca6a4c (diff) | |
download | meson-9bd2132cfa62c53b8ec902ebe9469ea57a121eb4.zip meson-9bd2132cfa62c53b8ec902ebe9469ea57a121eb4.tar.gz meson-9bd2132cfa62c53b8ec902ebe9469ea57a121eb4.tar.bz2 |
azure: Rewrite importing visual studio environment variables
Rewrite this in a cruder way that doesn't require installing things (and
so can work with the vs2015 image)
-rw-r--r-- | ci/azure-steps.yml | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ci/azure-steps.yml b/ci/azure-steps.yml index 6303761..4090458 100644 --- a/ci/azure-steps.yml +++ b/ci/azure-steps.yml @@ -51,14 +51,23 @@ steps: $origPath = $env:Path # import visual studio variables if ($env:compiler -eq 'msvc2015') { - $vsver = $env:compiler.Replace('msvc', '') + $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" } else { - $vsver = '2017' + $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" } - Set-PSRepository -Name PSGallery -InstallationPolicy Trusted - Install-Module Pscx -Scope CurrentUser -AllowClobber - Install-Module VSSetup -Scope CurrentUser - Import-VisualStudioVars -VisualStudioVersion $vsver -Architecture $(arch) + + ## ask cmd.exe to output the environment table after the batch file completes + $tempFile = [IO.Path]::GetTempFileName() + cmd /c " `"$vcvars`" $env:arch && set > `"$tempFile`" " + + ## go through the environment variables in the temp file. + ## for each of them, set the variable in our local environment. + Get-Content $tempFile | Foreach-Object { + if($_ -match "^(.*?)=(.*)$") { + Set-Content "env:\$($matches[1])" $matches[2] + } + } + Remove-Item $tempFile if ($env:compiler -eq 'clang-cl') { # drop visual studio from PATH |