mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 12:48:18 +00:00
some variable names clarifications
This commit is contained in:
@@ -36,6 +36,6 @@ Export-ModuleMember -Function @(
|
|||||||
'Invoke-PesterTests'
|
'Invoke-PesterTests'
|
||||||
'Get-VsCatalogJsonPath'
|
'Get-VsCatalogJsonPath'
|
||||||
'Install-AndroidSDKPackages'
|
'Install-AndroidSDKPackages'
|
||||||
'Get-VisualStudioInstallation'
|
'Get-VisualStudioProduct'
|
||||||
'Get-VisualStudioComponents'
|
'Get-VisualStudioComponents'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -258,27 +258,6 @@ function Install-VsixExtension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-VSExtensionVersion
|
|
||||||
{
|
|
||||||
Param
|
|
||||||
(
|
|
||||||
[Parameter(Mandatory=$true)]
|
|
||||||
[string] $packageName
|
|
||||||
)
|
|
||||||
|
|
||||||
$instanceFolders = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioInstallation -VSInstallType "VS").InstanceId
|
|
||||||
$state = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') | ConvertFrom-Json
|
|
||||||
$packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version
|
|
||||||
|
|
||||||
if (-not $packageVersion)
|
|
||||||
{
|
|
||||||
Write-Host "installed package $packageName for Visual Studio 2019 was not found"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return $packageVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-ToolcachePackages
|
function Get-ToolcachePackages
|
||||||
{
|
{
|
||||||
$toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json"
|
$toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json"
|
||||||
|
|||||||
@@ -61,31 +61,26 @@ Function Install-VisualStudio
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-VsCatalogJsonPath {
|
function Get-VsCatalogJsonPath {
|
||||||
$instanceFolder = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioInstallation -VSInstallType "VS").InstanceId
|
$instanceFolder = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId
|
||||||
return Join-Path $instanceFolder "catalog.json"
|
return Join-Path $instanceFolder "catalog.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-VisualStudioInstallation {
|
function Get-VisualStudioProduct {
|
||||||
Param
|
Param
|
||||||
(
|
(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[ValidateSet('VS','BuildTools')]
|
[ValidateSet('VisualStudio','BuildTools')]
|
||||||
[String] $VSInstallType
|
[String] $ProductType
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($VSInstallType -eq "VS")
|
if ($ProductType -eq "VisualStudio")
|
||||||
{
|
{
|
||||||
$VSSelectionType = "*Enterprise*"
|
$VSSelectionType = "*Enterprise*"
|
||||||
}
|
}
|
||||||
elseif ($VSInstallType -eq "BuildTools")
|
elseif ($ProductType -eq "BuildTools")
|
||||||
{
|
{
|
||||||
$VSSelectionType = "*Build*"
|
$VSSelectionType = "*Build*"
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Output "Visual Studio Installation type have to be 'VS' or 'BuildTools'"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
return Get-VSSetupInstance | Select-VSSetupInstance -Product * | Where-Object -Property DisplayName -like $VSSelectionType
|
return Get-VSSetupInstance | Select-VSSetupInstance -Product * | Where-Object -Property DisplayName -like $VSSelectionType
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,10 +88,30 @@ function Get-VisualStudioComponents {
|
|||||||
Param
|
Param
|
||||||
(
|
(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[ValidateSet('VS','BuildTools')]
|
[String] $ProductType
|
||||||
[String] $VSInstallType
|
|
||||||
)
|
)
|
||||||
(Get-VisualStudioInstallation -VSInstallType $VSInstallType).Packages | Where-Object type -in 'Component', 'Workload' |
|
(Get-VisualStudioProduct -ProductType $ProductType).Packages | Where-Object type -in 'Component', 'Workload' |
|
||||||
Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version |
|
Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version |
|
||||||
Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" }
|
Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-VSExtensionVersion
|
||||||
|
{
|
||||||
|
Param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string] $packageName
|
||||||
|
)
|
||||||
|
|
||||||
|
$instanceFolders = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId
|
||||||
|
$state = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') | ConvertFrom-Json
|
||||||
|
$packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version
|
||||||
|
|
||||||
|
if (-not $packageVersion)
|
||||||
|
{
|
||||||
|
Write-Host "installed package $packageName for Visual Studio 2019 was not found"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packageVersion
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,18 +7,18 @@ $ErrorActionPreference = "Stop"
|
|||||||
|
|
||||||
$toolset = Get-ToolsetContent
|
$toolset = Get-ToolsetContent
|
||||||
$requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" }
|
$requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" }
|
||||||
$buildRequiredComponents = $toolset.visualStudio.build_workloads | ForEach-Object { "--add $_" }
|
$buildToolsRequiredComponents = $toolset.visualStudio.buildtools_workloads | ForEach-Object { "--add $_" }
|
||||||
$workLoads = @(
|
$workLoads = @(
|
||||||
"--allWorkloads --includeRecommended"
|
"--allWorkloads --includeRecommended"
|
||||||
$requiredComponents
|
$requiredComponents
|
||||||
"--remove Component.CPython3.x64"
|
"--remove Component.CPython3.x64"
|
||||||
)
|
)
|
||||||
$workLoadsArgument = [String]::Join(" ", $workLoads)
|
$workLoadsArgument = [String]::Join(" ", $workLoads)
|
||||||
$buildWorkLoads = @(
|
$buildToolsWorkloads= @(
|
||||||
"--includeRecommended"
|
"--includeRecommended"
|
||||||
$buildRequiredComponents
|
$buildToolsRequiredComponents
|
||||||
)
|
)
|
||||||
$buildWorkLoadsArgument = [String]::Join(" ", $buildWorkLoads)
|
$buildWorkLoadsArgument = [String]::Join(" ", $buildToolsWorkloads)
|
||||||
|
|
||||||
$releaseInPath = $toolset.visualStudio.edition
|
$releaseInPath = $toolset.visualStudio.edition
|
||||||
$subVersion = $toolset.visualStudio.subversion
|
$subVersion = $toolset.visualStudio.subversion
|
||||||
@@ -29,7 +29,7 @@ $buildbootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_buildtools.e
|
|||||||
Install-VisualStudio -BootstrapperUrl $bootstrapperUrl -WorkLoads $workLoadsArgument
|
Install-VisualStudio -BootstrapperUrl $bootstrapperUrl -WorkLoads $workLoadsArgument
|
||||||
Install-VisualStudio -BootstrapperUrl $buildbootstrapperUrl -WorkLoads $buildWorkLoadsArgument
|
Install-VisualStudio -BootstrapperUrl $buildbootstrapperUrl -WorkLoads $buildWorkLoadsArgument
|
||||||
|
|
||||||
$vsInstallRoot = (Get-VisualStudioInstallation -VSInstallType "VS").InstallationPath
|
$vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath
|
||||||
|
|
||||||
# Initialize Visual Studio Experimental Instance
|
# Initialize Visual Studio Experimental Instance
|
||||||
& "$vsInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit
|
& "$vsInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit
|
||||||
|
|||||||
@@ -171,12 +171,12 @@ $markdown += New-MDNewLine
|
|||||||
|
|
||||||
$markdown += New-MDHeader "Workloads, components and extensions:" -Level 4
|
$markdown += New-MDHeader "Workloads, components and extensions:" -Level 4
|
||||||
$markdown += New-MDNewLine
|
$markdown += New-MDNewLine
|
||||||
$markdown += ((Get-VisualStudioComponents -VSInstallType "VS") + (Get-VisualStudioExtensions)) | New-MDTable
|
$markdown += ((Get-VisualStudioComponents -ProductType "VisualStudio") + (Get-VisualStudioExtensions)) | New-MDTable
|
||||||
$markdown += New-MDNewLine
|
$markdown += New-MDNewLine
|
||||||
|
|
||||||
$markdown += New-MDHeader "Build Workloads and components:" -Level 4
|
$markdown += New-MDHeader "Build Tools Workloads:" -Level 4
|
||||||
$markdown += New-MDNewLine
|
$markdown += New-MDNewLine
|
||||||
$markdown += (Get-VisualStudioComponents -VSInstallType "BuildTools") | New-MDTable
|
$markdown += (Get-VisualStudioComponents -ProductType "BuildTools") | New-MDTable
|
||||||
$markdown += New-MDNewLine
|
$markdown += New-MDNewLine
|
||||||
|
|
||||||
$markdown += New-MDHeader "Microsoft Visual C++:" -Level 4
|
$markdown += New-MDHeader "Microsoft Visual C++:" -Level 4
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function Get-VisualStudioExtensions {
|
|||||||
# Wix
|
# Wix
|
||||||
$vs = (Get-VisualStudioVersion).Name.Split()[-1]
|
$vs = (Get-VisualStudioVersion).Name.Split()[-1]
|
||||||
$wixPackageVersion = Get-WixVersion
|
$wixPackageVersion = Get-WixVersion
|
||||||
$wixExtensionVersion = ((Get-VisualStudioInstallation -VSInstallType "VS").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version
|
$wixExtensionVersion = ((Get-VisualStudioProduct -ProductType "VisualStudio").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version
|
||||||
|
|
||||||
# WDK
|
# WDK
|
||||||
$wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit'
|
$wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Describe "Visual Studio" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
It "Devenv.exe" {
|
It "Devenv.exe" {
|
||||||
$vsInstallRoot = (Get-VisualStudioInstallation -VSInstallType "VS").InstallationPath
|
$vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath
|
||||||
$devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe"
|
$devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe"
|
||||||
$devenvexePath | Should -Exist
|
$devenvexePath | Should -Exist
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ Describe "Visual Studio" {
|
|||||||
$expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads
|
$expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads
|
||||||
$testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} }
|
$testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} }
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$installedComponents = Get-VisualStudioComponents -VSInstallType "VS" | Select-Object -ExpandProperty Package
|
$installedComponents = Get-VisualStudioComponents -ProductType "VisualStudio" | Select-Object -ExpandProperty Package
|
||||||
}
|
}
|
||||||
|
|
||||||
It "<ComponentName>" -TestCases $testCases {
|
It "<ComponentName>" -TestCases $testCases {
|
||||||
@@ -23,11 +23,11 @@ Describe "Visual Studio" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context "Visual Studio build components" {
|
Context "Visual Studio Build Tools components" {
|
||||||
$expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty build_workloads
|
$expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty buildtools_workloads
|
||||||
$testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} }
|
$testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} }
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$installedComponents = Get-VisualStudioComponents -VSInstallType "Build" | Select-Object -ExpandProperty Package
|
$installedComponents = Get-VisualStudioComponents -ProductType "Build" | Select-Object -ExpandProperty Package
|
||||||
}
|
}
|
||||||
|
|
||||||
It "<ComponentName>" -TestCases $testCases {
|
It "<ComponentName>" -TestCases $testCases {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@
|
|||||||
"Microsoft.VisualStudio.Component.Workflow",
|
"Microsoft.VisualStudio.Component.Workflow",
|
||||||
"Microsoft.VisualStudio.Workload.Office"
|
"Microsoft.VisualStudio.Workload.Office"
|
||||||
],
|
],
|
||||||
"build_workloads": [
|
"buildtools_workloads": [
|
||||||
"Microsoft.VisualStudio.Workload.WebBuildTools"
|
"Microsoft.VisualStudio.Workload.WebBuildTools"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,7 +258,7 @@
|
|||||||
"Component.MDD.Linux",
|
"Component.MDD.Linux",
|
||||||
"Component.MDD.Linux.GCC.arm"
|
"Component.MDD.Linux.GCC.arm"
|
||||||
],
|
],
|
||||||
"build_workloads": [
|
"buildtools_workloads": [
|
||||||
"Microsoft.VisualStudio.Workload.WebBuildTools"
|
"Microsoft.VisualStudio.Workload.WebBuildTools"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user