1bf215546Sopenharmony_ci# Download new TLS certs from Windows Update 2bf215546Sopenharmony_ciGet-Date 3bf215546Sopenharmony_ciWrite-Host "Updating TLS certificate store" 4bf215546Sopenharmony_ciRemove-Item -Recurse -Force -ErrorAction SilentlyContinue "_tlscerts" | Out-Null 5bf215546Sopenharmony_ci$certdir = (New-Item -ItemType Directory -Name "_tlscerts") 6bf215546Sopenharmony_cicertutil -syncwithWU "$certdir" 7bf215546Sopenharmony_ciForeach ($file in (Get-ChildItem -Path "$certdir\*" -Include "*.crt")) { 8bf215546Sopenharmony_ci Import-Certificate -FilePath $file -CertStoreLocation Cert:\LocalMachine\Root | Out-Null 9bf215546Sopenharmony_ci} 10bf215546Sopenharmony_ciRemove-Item -Recurse -Path $certdir 11bf215546Sopenharmony_ci 12bf215546Sopenharmony_ci 13bf215546Sopenharmony_ciGet-Date 14bf215546Sopenharmony_ciWrite-Host "Installing Chocolatey" 15bf215546Sopenharmony_ciInvoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 16bf215546Sopenharmony_ciImport-Module "$env:ProgramData\chocolatey\helpers\chocolateyProfile.psm1" 17bf215546Sopenharmony_ciUpdate-SessionEnvironment 18bf215546Sopenharmony_ciWrite-Host "Installing Chocolatey packages" 19bf215546Sopenharmony_ci 20bf215546Sopenharmony_ci# Chocolatey tries to download winflexbison from SourceForge, which is not super reliable, and has no retry 21bf215546Sopenharmony_ci# loop of its own - so we give it a helping hand here 22bf215546Sopenharmony_ciFor ($i = 0; $i -lt 5; $i++) { 23bf215546Sopenharmony_ci choco install --no-progress -y python3 --params="/InstallDir:C:\python3" 24bf215546Sopenharmony_ci $python_install = $? 25bf215546Sopenharmony_ci choco install --allow-empty-checksums --no-progress -y cmake git git-lfs ninja pkgconfiglite winflexbison --installargs "ADD_CMAKE_TO_PATH=System" 26bf215546Sopenharmony_ci $other_install = $? 27bf215546Sopenharmony_ci $choco_installed = $other_install -and $python_install 28bf215546Sopenharmony_ci if ($choco_installed) { 29bf215546Sopenharmony_ci Break 30bf215546Sopenharmony_ci } 31bf215546Sopenharmony_ci} 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ciif (!$choco_installed) { 34bf215546Sopenharmony_ci Write-Host "Couldn't install dependencies from Chocolatey" 35bf215546Sopenharmony_ci Exit 1 36bf215546Sopenharmony_ci} 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_ci# Add Chocolatey's native install path 39bf215546Sopenharmony_ciUpdate-SessionEnvironment 40bf215546Sopenharmony_ci# Python and CMake add themselves to the system environment path, which doesn't get refreshed 41bf215546Sopenharmony_ci# until we start a new shell 42bf215546Sopenharmony_ci$env:PATH = "C:\python3;C:\python3\scripts;C:\Program Files\CMake\bin;$env:PATH" 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_ciStart-Process -NoNewWindow -Wait git -ArgumentList 'config --global core.autocrlf false' 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_ciGet-Date 47bf215546Sopenharmony_ciWrite-Host "Installing Meson, Mako and numpy" 48bf215546Sopenharmony_cipip3 install meson mako numpy --progress-bar off 49bf215546Sopenharmony_ciif (!$?) { 50bf215546Sopenharmony_ci Write-Host "Failed to install dependencies from pip" 51bf215546Sopenharmony_ci Exit 1 52bf215546Sopenharmony_ci} 53bf215546Sopenharmony_ci 54bf215546Sopenharmony_ciGet-Date 55bf215546Sopenharmony_ciWrite-Host "Downloading Vulkan-SDK" 56bf215546Sopenharmony_ciInvoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/$env:VULKAN_SDK_VERSION/windows/VulkanSDK-$env:VULKAN_SDK_VERSION-Installer.exe" -OutFile 'C:\vulkan_sdk.exe' 57bf215546Sopenharmony_ciC:\vulkan_sdk.exe --am --al -c in 58bf215546Sopenharmony_ciif (!$?) { 59bf215546Sopenharmony_ci Write-Host "Failed to install Vulkan SDK" 60bf215546Sopenharmony_ci Exit 1 61bf215546Sopenharmony_ci} 62bf215546Sopenharmony_ciRemove-Item C:\vulkan_sdk.exe -Force 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ciGet-Date 65bf215546Sopenharmony_ciWrite-Host "Downloading Vulkan-Runtime" 66bf215546Sopenharmony_ciInvoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/$env:VULKAN_SDK_VERSION/windows/VulkanRT-$env:VULKAN_SDK_VERSION-Installer.exe" -OutFile 'C:\vulkan-runtime.exe' | Out-Null 67bf215546Sopenharmony_ciWrite-Host "Installing Vulkan-Runtime" 68bf215546Sopenharmony_ciStart-Process -NoNewWindow -Wait C:\vulkan-runtime.exe -ArgumentList '/S' 69bf215546Sopenharmony_ciif (!$?) { 70bf215546Sopenharmony_ci Write-Host "Failed to install Vulkan-Runtime" 71bf215546Sopenharmony_ci Exit 1 72bf215546Sopenharmony_ci} 73bf215546Sopenharmony_ciRemove-Item C:\vulkan-runtime.exe -Force 74