changeset 11114:f79cccd8514d

8213619: Windows powershell build script missing environment variables Reviewed-by: kcr, mennen Contributed-by: wookey.dean@gmail.com
author kcr
date Wed, 14 Nov 2018 13:02:37 -0800
parents f4802915ad95
children 908599063479
files tools/scripts/build.ps1
diffstat 1 files changed, 40 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tools/scripts/build.ps1	Wed Nov 14 13:26:16 2018 +0100
+++ b/tools/scripts/build.ps1	Wed Nov 14 13:02:37 2018 -0800
@@ -1,14 +1,51 @@
 choco install ant
 choco install vswhere
 choco install zip
-$env:WINSDK_DIR = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots").KitsRoot10
-$env:VCINSTALLDIR = "$(vswhere -legacy -latest -property installationPath)\VC\Auxiliary\Build"
+
+$vsRoot = "$(vswhere -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath)"
+if ([string]::IsNullOrWhitespace($vsRoot)) {
+  $vs = "$(vswhere -latest -property installationPath)"
+  if ([string]::IsNullOrWhitespace($vs)) {
+    choco install visualstudio2017community
+    choco install visualstudio2017-workload-nativedesktop
+  }
+  else {
+    choco install visualstudio2017-workload-nativedesktop
+  }
+  $vsRoot = "$(vswhere -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath)"
+}
+
+$winSdk = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots").KitsRoot10 2>$null
+if ([string]::IsNullOrWhitespace($winSdk)) {
+  choco install windows-sdk-7.1
+  $winSdk = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" -ErrorAction Stop).KitsRoot10) 
+}
+
+# Cygwin required for chmod
+$cygwinPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Cygwin\setup").rootdir 2>$null
+if ([string]::IsNullOrWhitespace($cygwinPath)) {
+  choco install cygwin
+  $cygwinPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Cygwin\setup"  -ErrorAction Stop).rootdir
+}
+
+if ($env:Path -NotLike "*$($cygwinPath)*") {
+  $env:Path += ";$($cygwinPath)\bin"
+}
+$env:WINSDK_DIR = $winSdk
+$env:VCINSTALLDIR = "$($vsRoot)\VC\Auxiliary\Build"
+
 $msvcToolsVer = Get-Content "$env:VCINSTALLDIR\Microsoft.VCToolsVersion.default.txt"
+$msvcRedistVer = Get-Content "$env:VCINSTALLDIR\Microsoft.VCRedistVersion.default.txt"
 if ([string]::IsNullOrWhitespace($msvcToolsVer)) {
   # The MSVC tools version file can have txt *or* props extension.
   $msvcToolsVer = Get-Content "$env:VCINSTALLDIR\Microsoft.VCToolsVersion.default.props"
 }
 $env:MSVC_VER = $msvcToolsVer
+$env:MSVC_REDIST_VER = $msvcRedistVer
+
+$files = Get-ChildItem "$($vsRoot)\VC\Redist\MSVC\$($msvcRedistVer)\x86\*.CRT\"
+$env:WINDOWS_CRT_VER = $files[0].Name.replace("Microsoft.VC","").replace(".CRT","")
+
 $env:VS150COMNTOOLS = $env:VCINSTALLDIR
 $env:VSVARS32FILE = "$env:VCINSTALLDIR\vcvars32.bat"
 refreshenv
@@ -18,6 +55,5 @@
     exit $lastexitcode
   }
 } else {
-  .\gradlew all test -PCOMPILE_WEBKIT=false -PCONF=DebugNative --stacktrace -x :web:test --info
+  .\gradlew all test -PCOMPILE_WEBKIT=false -PCONF=Debug --stacktrace -x :web:test --info --no-daemon
 }
-