diff --git a/images/win/scripts/Installers/Install-Kotlin.ps1 b/images/win/scripts/Installers/Install-Kotlin.ps1 new file mode 100644 index 000000000..95be7f777 --- /dev/null +++ b/images/win/scripts/Installers/Install-Kotlin.ps1 @@ -0,0 +1,18 @@ +################################################################################ +## File: Install-Kotlin.ps1 +## Desc: Install Kotlin +################################################################################ + +# Install Kotlin +$url = "https://api.github.com/repos/JetBrains/kotlin/releases/latest" +[System.String] $kotlinLatest = (Invoke-RestMethod -Uri $url).assets.browser_download_url -match "kotlin-compiler" +$kotlinInstallerPath = Start-DownloadWithRetry -Url $kotlinLatest -Name "kotlin-compiler.zip" + +Write-Host "Expand Kotlin archive" +$kotlinPath = "C:\tools" +Extract-7Zip -Path $kotlinInstallerPath -DestinationPath $kotlinPath + +# Add to PATH +Add-MachinePathItem "$kotlinPath\kotlinc\bin" + +Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin" \ No newline at end of file diff --git a/images/win/scripts/Tests/ChocoPackages.Tests.ps1 b/images/win/scripts/Tests/ChocoPackages.Tests.ps1 index cb95e0954..9debefdd3 100644 --- a/images/win/scripts/Tests/ChocoPackages.Tests.ps1 +++ b/images/win/scripts/Tests/ChocoPackages.Tests.ps1 @@ -102,12 +102,4 @@ Describe "CMake" { It "cmake" { "cmake --version" | Should -ReturnZeroExitCode } -} - -Describe "Kotlin" { - $kotlinPackages = @("kotlinc", "kotlinc-js", "kotlinc-jvm") - - It " is available" -TestCases ($kotlinPackages | ForEach-Object { @{ toolName = $_ } }) { - "$toolName -version" | Should -ReturnZeroExitCode - } -} +} \ No newline at end of file diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 6755193ad..cb72bbd3a 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -173,3 +173,11 @@ Describe "Pipx" { "pipx --version" | Should -ReturnZeroExitCode } } + +Describe "Kotlin" { + $kotlinPackages = @("kapt", "kotlin", "kotlinc", "kotlin-dce-js", "kotlinc-js", "kotlinc-jvm") + + It " is available" -TestCases ($kotlinPackages | ForEach-Object { @{ toolName = $_ } }) { + "$toolName -version" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index 851e3060f..944ab75c0 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -401,7 +401,6 @@ { "name": "tortoisesvn" }, { "name": "swig" }, { "name": "vswhere" }, - { "name": "kotlinc" }, { "name": "julia", "args": [ "--ia", "/DIR=C:\\Julia" ] diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index 04095117c..87abcdd1c 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -431,7 +431,6 @@ { "name": "tortoisesvn" }, { "name": "swig" }, { "name": "vswhere" }, - { "name": "kotlinc" }, { "name": "julia", "args": [ "--ia", "/DIR=C:\\Julia" ] diff --git a/images/win/toolsets/toolset-2022.json b/images/win/toolsets/toolset-2022.json index 922bcecd8..cd5dae932 100644 --- a/images/win/toolsets/toolset-2022.json +++ b/images/win/toolsets/toolset-2022.json @@ -255,7 +255,6 @@ { "name": "tortoisesvn" }, { "name": "swig" }, { "name": "vswhere" }, - { "name": "kotlinc" }, { "name": "julia", "args": [ "--ia", "/DIR=C:\\Julia" ] diff --git a/images/win/windows2016.json b/images/win/windows2016.json index 8f05537c5..0222a54f7 100644 --- a/images/win/windows2016.json +++ b/images/win/windows2016.json @@ -187,6 +187,7 @@ "{{ template_dir }}/scripts/Installers/Install-AliyunCli.ps1", "{{ template_dir }}/scripts/Installers/Install-PostgreSQL.ps1", "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1", + "{{ template_dir }}/scripts/Installers/Install-Kotlin.ps1", "{{ template_dir }}/scripts/Installers/Install-Ruby.ps1", "{{ template_dir }}/scripts/Installers/Install-PyPy.ps1", "{{ template_dir }}/scripts/Installers/Install-Toolset.ps1", diff --git a/images/win/windows2019.json b/images/win/windows2019.json index b9339a3be..af3c1ea91 100644 --- a/images/win/windows2019.json +++ b/images/win/windows2019.json @@ -182,7 +182,8 @@ "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1", "{{ template_dir }}/scripts/Installers/Install-NodeLts.ps1", "{{ template_dir }}/scripts/Installers/Install-CommonUtils.ps1", - "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1" + "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1", + "{{ template_dir }}/scripts/Installers/Install-Kotlin.ps1" ] }, { diff --git a/images/win/windows2022.json b/images/win/windows2022.json index 4d39b73e9..64b8680f8 100644 --- a/images/win/windows2022.json +++ b/images/win/windows2022.json @@ -166,7 +166,8 @@ "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1", "{{ template_dir }}/scripts/Installers/Install-NodeLts.ps1", "{{ template_dir }}/scripts/Installers/Install-CommonUtils.ps1", - "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1" + "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1", + "{{ template_dir }}/scripts/Installers/Install-Kotlin.ps1" ] }, {