Files
runner-images/images/windows/scripts/build/Install-Kotlin.ps1
Vasilii Polikarpov da1c04b81a [Windows] Reimplement function resolving GH asset (#8899)
* [Windows] Reimplement function resolving GH asset

* Fix tests and software report

* Fix selenium-server version check
2023-11-28 15:08:03 +01:00

30 lines
1.1 KiB
PowerShell

################################################################################
## File: Install-Kotlin.ps1
## Desc: Install Kotlin
## Supply chain security: Kotlin - checksum validation
################################################################################
# Install Kotlin
$kotlinVersion = (Get-ToolsetContent).kotlin.version
$kotlinDownloadUrl = Resolve-GithubReleaseAssetUrl `
-Repo "JetBrains/kotlin" `
-Version $kotlinVersion `
-Asset "kotlin-compiler-*.zip"
$kotlinInstallerPath = Start-DownloadWithRetry -Url $kotlinDownloadUrl -Name "kotlin-compiler.zip"
#region Supply chain security
$fileHash = (Get-FileHash -Path $kotlinInstallerPath -Algorithm SHA256).Hash
$externalHash = Get-HashFromGitHubReleaseBody -RepoOwner "JetBrains" -RepoName "kotlin" -FileName "$kotlinBinaryName-*.zip" -Version $kotlinVersion -WordNumber 2
Use-ChecksumComparison $fileHash $externalHash
#endregion
Write-Host "Expand Kotlin archive"
$kotlinPath = "C:\tools"
Expand-7ZipArchive -Path $kotlinInstallerPath -DestinationPath $kotlinPath
# Add to PATH
Add-MachinePathItem "$kotlinPath\kotlinc\bin"
Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin"