Files
runner-images-sangeeth/images/windows/scripts/build/Install-Kotlin.ps1
Vasilii Polikarpov d86c4900fa [Windows] Update functions that get urls and hashes from Github (#8917)
* [Windows] Update function to get hash from github

* Remove redundant function and add documentation

* Fix aws-sam-cli url
2023-11-30 17:12:17 +01:00

33 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"
$kotlinArchivePath = Invoke-DownloadWithRetry $kotlinDownloadUrl
#region Supply chain security
$externalHash = Get-GithubReleaseAssetHash `
-Repo "JetBrains/kotlin" `
-Version "$kotlinVersion" `
-FileName (Split-Path $kotlinDownloadUrl -Leaf) `
-HashType "SHA256"
Test-FileChecksum $kotlinArchivePath -ExpectedSHA256Sum $externalHash
#endregion
Write-Host "Expand Kotlin archive"
$kotlinPath = "C:\tools"
Expand-7ZipArchive -Path $kotlinArchivePath -DestinationPath $kotlinPath
# Add to PATH
Add-MachinePathItem "$kotlinPath\kotlinc\bin"
Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin"