diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index f614bd0e3..0b2bcae28 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -477,6 +477,12 @@ "{{ template_dir }}/scripts/Installers/Install-Cmake.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-R.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index b7437cd74..700280b17 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -452,6 +452,12 @@ "{{ template_dir }}/scripts/Installers/Install-Cmake.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-R.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Install-R.ps1 b/images/win/scripts/Installers/Install-R.ps1 new file mode 100644 index 000000000..a6f238e7f --- /dev/null +++ b/images/win/scripts/Installers/Install-R.ps1 @@ -0,0 +1,11 @@ +################################################################################ +## File: Install-R.ps1 +## Desc: Install R for Windows +################################################################################ + +Choco-Install R.Project +Choco-Install rtools + +$rscriptPath = Resolve-Path "C:\Program Files\R\*\bin\x64" +Add-MachinePathItem $rscriptPath +Invoke-PesterTests -TestFile "Tools" -TestName "R" \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index d4657c1c4..771bb3b7a 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -69,6 +69,7 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-BazelVersion), (Get-BazeliskVersion), (Get-CMakeVersion), + (Get-RVersion), (Get-DockerVersion), (Get-DockerComposeVersion), (Get-GitVersion), diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index ba1d5f9a4..2dc90306c 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -18,6 +18,12 @@ function Get-BazeliskVersion { return "Bazelisk $bazeliskVersion" } +function Get-RVersion { + ($(cmd /c "Rscript --version 2>&1") | Out-String) -match "R scripting front-end version (?\d+\.\d+\.\d+)" | Out-Null + $rVersion = $Matches.Version + return "R $rVersion" +} + function Get-CMakeVersion { ($(cmake -version) | Out-String) -match "cmake version (?\d+\.\d+\.\d+)" | Out-Null $cmakeVersion = $Matches.Version diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 87595450d..dd2be77de 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -73,6 +73,12 @@ Describe "CMake" { } } +Describe "R" { + It "Rscript" { + "Rscript --version" | Should -ReturnZeroExitCode + } +} + Describe "DACFx" { It "DACFx" { (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Contains "Microsoft SQL Server Data-Tier Application Framework (x64)" | Should -BeTrue