Files
qt5/coin/provisioning/common/windows/ninja.ps1
Elias Toivola b99f11d3c2 Fix/unmix Ninja download priority
The download helper for .ps1 scripts takes in parameters in order:
1. The external URL (this is 2nd priority DL source)
2. The internal / cache URL (this is 1st priority source)
3. Download location
The URL variables were inputted to the function in wrong order. And URL
variables for x64 were named incorrectly. This change fixes that.

Pick-to: 6.8
Task-number: QTQAINFRA-6296
Change-Id: Ic4f939448a4ac39e4fd7d52e5b80132b02c38dc2
Reviewed-by: Elias Toivola <elias.toivola@qt.io>
Reviewed-by: Matti Paaso <matti.paaso@qt.io>
2024-11-03 12:42:12 +02:00

63 lines
2.2 KiB
PowerShell

. "$PSScriptRoot\helpers.ps1"
$cpu_arch = Get-CpuArchitecture
switch ($cpu_arch) {
arm64 {
$arch = "arm64"
$version = "1.12.0"
$longPathFixed = $true # fixed https://github.com/ninja-build/ninja/pull/2225 in 1.12.0
$zip = Get-DownloadLocation "ninja-$version-win-$arch.zip"
$internalUrl = "https://ci-files01-hki.ci.qt.io/input/ninja/ninja-$version-win-$arch.zip"
$externalUrl = "https://github.com/ninja-build/ninja/releases/download/v$version/ninja-win$arch.zip"
$sha1 = "51bf1bac149ae1e3d1572fa9fa87d6431dbddc8b"
Break
}
x64 {
$arch = "amd64"
$version = "1.10.2"
$longPathFixed = $false
$zip = Get-DownloadLocation "ninja-$version-win-x86.zip"
$internalUrl = "https://ci-files01-hki.ci.qt.io/input/ninja/ninja-$version-win-really-x86.zip"
$externalUrl = "http://master.qt.io/development_releases/prebuilt/ninja/v$version/ninja-win-x86.zip"
$sha1 = "1a22ee9269df8ed69c4600d7ee4ccd8841bb99ca"
Break
}
default {
throw "Unknown architecture $cpu_arch"
}
}
Download $externalUrl $internalUrl $zip
Verify-Checksum $zip $sha1
Extract-7Zip $zip C:\Utils\Ninja
Remove "$zip"
Add-Path "C:\Utils\Ninja"
Write-Output "Ninja ($arch) = $version" >> ~/versions.txt
if ( -Not $longPathFixed ) {
$manifest = @"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
</assembly>
"@
$vs2019 = [System.IO.File]::Exists("C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat")
if($vs2019) {
Invoke-MtCommand "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 $manifest "C:\Utils\Ninja\ninja.exe"
} else {
Invoke-MtCommand "C:\Program Files (x86)\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 $manifest "C:\Utils\Ninja\ninja.exe"
}
}