Windows: Install Azul Zulu instead of the Oracle JDK.
@@ -111,14 +111,29 @@ Write-Host "Updating MSYS2 packages (round 2)..."
Write-Host "Installing required MSYS2 packages..."
& bash -lc "pacman --noconfirm --needed -S curl zip unzip gcc tar diffutils patch perl"
+## Install Azul Zulu.
+Write-Host "Installing Zulu 8..."
+$zulu_url = "https://cdn.azul.com/zulu/bin/zulu8.27.0.7-jdk8.0.162-win_x64.zip"
+$zulu_zip = "c:\temp\zulu8.27.0.7-jdk8.0.162-win_x64.zip"
+$zulu_extracted_path = "c:\temp\" + [IO.Path]::GetFileNameWithoutExtension($zulu_zip)
+$zulu_root = "c:\openjdk"
+(New-Object Net.WebClient).DownloadFile($zulu_url, $zulu_zip)
+[System.IO.Compression.ZipFile]::ExtractToDirectory($zulu_zip, "c:\temp")
+Move-Item $zulu_extracted_path -Destination $zulu_root
+Remove-Item $zulu_zip
+$env:PATH = [Environment]::GetEnvironmentVariable("PATH", "Machine") + ";${zulu_root}\bin"
+[Environment]::SetEnvironmentVariable("PATH", $env:PATH, "Machine")
+$env:JAVA_HOME = $zulu_root
+[Environment]::SetEnvironmentVariable("JAVA_HOME", $env:JAVA_HOME, "Machine")
+
## Install the JDK.
-Write-Host "Installing JDK 8..."
+# Write-Host "Installing JDK 8..."
# FYI: choco adds "C:\Program Files\Java\jdk<version>\bin" to global PATH.
# FYI: choco sets JAVA_HOME to "C:\Program Files\Java\jdk<version>\bin".
-& choco install jdk8
-$env:PATH = [Environment]::GetEnvironmentVariable("PATH", "Machine")
-$env:JAVA_HOME = [Environment]::GetEnvironmentVariable("JAVA_HOME", "Machine")
-Write-Host "JAVA_HOME was set to '${JAVA_HOME}'..."
+# & choco install jdk8
+# $env:PATH = [Environment]::GetEnvironmentVariable("PATH", "Machine")
+# $env:JAVA_HOME = [Environment]::GetEnvironmentVariable("JAVA_HOME", "Machine")
+# Write-Host "JAVA_HOME was set to '${JAVA_HOME}'..."
## Install Visual C++ 2015 Build Tools (Update 3).
# Write-Host "Installing Visual C++ 2015 Build Tools..."
@@ -246,9 +261,10 @@ Write-Host "Creating Buildkite agent environment hook..."
$buildkite_environment_hook = @"
SET BUILDKITE_ARTIFACT_UPLOAD_DESTINATION=gs://bazel-buildkite-artifacts/`$BUILDKITE_JOB_ID
SET BUILDKITE_GS_ACL=publicRead
+SET JAVA_HOME=${env:JAVA_HOME}
+SET PATH=${env:PATH}
SET TEMP=D:\temp
SET TMP=D:\temp
-SET PATH=${env:PATH}
"@
[System.IO.File]::WriteAllLines("${buildkite_agent_root}\hooks\environment.bat", $buildkite_environment_hook)
