2021-09-16 11:35:11 +03:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-Kotlin.ps1
|
|
|
|
|
## Desc: Install Kotlin
|
2023-09-22 11:26:00 +02:00
|
|
|
## Supply chain security: Kotlin - checksum validation
|
2021-09-16 11:35:11 +03:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# Install Kotlin
|
2021-12-08 10:39:42 +03:00
|
|
|
$kotlinVersion = (Get-ToolsetContent).kotlin.version
|
|
|
|
|
|
2023-11-28 15:08:03 +01:00
|
|
|
$kotlinDownloadUrl = Resolve-GithubReleaseAssetUrl `
|
|
|
|
|
-Repo "JetBrains/kotlin" `
|
2023-11-30 17:12:17 +01:00
|
|
|
-Version "$kotlinVersion" `
|
2023-11-28 15:08:03 +01:00
|
|
|
-Asset "kotlin-compiler-*.zip"
|
2023-11-29 13:02:29 +01:00
|
|
|
$kotlinArchivePath = Invoke-DownloadWithRetry $kotlinDownloadUrl
|
2021-09-16 11:35:11 +03:00
|
|
|
|
2023-09-22 11:26:00 +02:00
|
|
|
#region Supply chain security
|
2024-03-07 17:11:44 +01:00
|
|
|
$externalHash = Get-Content $(Invoke-DownloadWithRetry "$kotlinDownloadUrl.sha256")
|
2023-11-30 09:22:14 +01:00
|
|
|
Test-FileChecksum $kotlinArchivePath -ExpectedSHA256Sum $externalHash
|
2023-09-22 11:26:00 +02:00
|
|
|
#endregion
|
|
|
|
|
|
2021-09-16 11:35:11 +03:00
|
|
|
Write-Host "Expand Kotlin archive"
|
|
|
|
|
$kotlinPath = "C:\tools"
|
2023-11-29 13:02:29 +01:00
|
|
|
Expand-7ZipArchive -Path $kotlinArchivePath -DestinationPath $kotlinPath
|
2021-09-16 11:35:11 +03:00
|
|
|
|
|
|
|
|
# Add to PATH
|
|
|
|
|
Add-MachinePathItem "$kotlinPath\kotlinc\bin"
|
|
|
|
|
|
2023-09-22 11:26:00 +02:00
|
|
|
Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin"
|