[Windows] Implement minor improvements, rev 2 (#3839)

* implement minor improvements

* Update Install-WDK.ps1

* fix nitpick
This commit is contained in:
Maxim Lobanov
2021-08-04 09:35:16 +03:00
committed by GitHub
parent 924ebc40d1
commit 3b5c4ebd39
7 changed files with 104 additions and 70 deletions

View File

@@ -10,19 +10,67 @@
$dash = "-" * 40 $dash = "-" * 40
$origPath = $env:PATH $origPath = $env:PATH
$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest" function Install-Msys2 {
$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object { $msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
$_.name -match "^msys2-x86_64" -and $_.name.EndsWith(".exe") }).browser_download_url $msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object {
$_.name -match "^msys2-x86_64" -and $_.name.EndsWith(".exe") }).browser_download_url
# Download the latest msys2 x86_64, filename includes release date # Download the latest msys2 x86_64, filename includes release date
Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])" Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])"
$msys2File = Start-DownloadWithRetry -Url $msys2Uri $msys2File = Start-DownloadWithRetry -Url $msys2Uri
Write-Host "Finished download" Write-Host "Finished download"
# extract tar.xz to C:\ # extract tar.xz to C:\
Write-Host "Starting msys2 installation" Write-Host "Starting msys2 installation"
& $msys2File in --confirm-command --accept-messages --root C:/msys64 & $msys2File in --confirm-command --accept-messages --root C:/msys64
Remove-Item $msys2File Remove-Item $msys2File
}
function Install-Msys2Packages($Packages) {
if (-not $Packages) {
return
}
Write-Host "`n$dash Install msys2 packages"
pacman.exe -S --noconfirm --needed --noprogressbar $Packages
taskkill /f /fi "MODULES eq msys-2.0.dll"
Write-Host "`n$dash Remove p7zip/7z package due to conflicts"
pacman.exe -R --noconfirm --noprogressbar p7zip
}
function Install-MingwPackages($Packages) {
if (-not $Packages) {
return
}
Write-Host "`n$dash Install mingw packages"
$archs = $Packages.arch
foreach ($arch in $archs) {
Write-Host "Installing $arch packages"
$archPackages = $toolsetContent.mingw | Where-Object { $_.arch -eq $arch }
$runtimePackages = $archPackages.runtime_packages.name | ForEach-Object { "${arch}-$_" }
$additionalPackages = $archPackages.additional_packages | ForEach-Object { "${arch}-$_" }
$packagesToInstall = $runtimePackages + $additionalPackages
Write-Host "The following packages will be installed: $packagesToInstall"
pacman.exe -S --noconfirm --needed --noprogressbar $packagesToInstall
}
# clean all packages to decrease image size
Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm
$pkgs = pacman.exe -Q
foreach ($arch in $archs)
{
Write-Host "`n$dash Installed $arch packages"
$pkgs | grep ^${arch}-
}
}
Install-Msys2
# Add msys2 bin tools folders to PATH temporary # Add msys2 bin tools folders to PATH temporary
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath" $env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath"
@@ -35,40 +83,10 @@ pacman.exe -Syuu --noconfirm
taskkill /f /fi "MODULES eq msys-2.0.dll" taskkill /f /fi "MODULES eq msys-2.0.dll"
$toolsetContent = (Get-ToolsetContent).MsysPackages $toolsetContent = (Get-ToolsetContent).MsysPackages
Write-Host "`n$dash Install msys2 packages" Install-Msys2Packages -Packages $toolsetContent.msys2
$msys2Packages = $toolsetContent.msys2 Install-MingwPackages -Packages $toolsetContent.mingw
pacman.exe -S --noconfirm --needed --noprogressbar $msys2Packages
taskkill /f /fi "MODULES eq msys-2.0.dll"
Write-Host "`n$dash Remove p7zip/7z package due to conflicts"
pacman.exe -R --noconfirm --noprogressbar p7zip
# install mingw packages
$archs = $toolsetContent.mingw.arch
foreach ($arch in $archs)
{
Write-Host "Installing $arch packages"
$archPackages = $toolsetContent.mingw | Where-Object { $_.arch -eq $arch }
$runtimePackages = $archPackages.runtime_packages.name | ForEach-Object { "${arch}-$_" }
$additionalPackages = $archPackages.additional_packages | ForEach-Object { "${arch}-$_" }
$packagesToInstall = $runtimePackages + $additionalPackages
Write-Host "The following packages will be installed: $packagesToInstall"
pacman.exe -S --noconfirm --needed --noprogressbar $packagesToInstall
}
# clean all packages to decrease image size
Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm
$pkgs = pacman.exe -Q
foreach ($arch in $archs)
{
Write-Host "`n$dash Installed $arch packages"
$pkgs | grep ^${arch}-
}
$env:PATH = $origPath $env:PATH = $origPath
Write-Host "`nMSYS2 installation completed" Write-Host "`nMSYS2 installation completed"
Invoke-PesterTests -TestFile "MSYS2" Invoke-PesterTests -TestFile "MSYS2"

View File

@@ -11,13 +11,17 @@ if (Test-IsWin19)
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix" $FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"
$VSver = "2019" $VSver = "2019"
} }
else elseif (Test-IsWin16)
{ {
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014" $winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156" $wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156"
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix" $FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"
$VSver = "2017" $VSver = "2017"
} }
else
{
throw "Invalid version of Visual Studio is found. Either 2017 or 2019 are required"
}
$argumentList = ("/features", "+", "/quiet") $argumentList = ("/features", "+", "/quiet")

View File

@@ -5,18 +5,23 @@
Choco-Install -PackageName wixtoolset -ArgumentList "--force" Choco-Install -PackageName wixtoolset -ArgumentList "--force"
if(Test-IsWin19) if (Test-IsWin19)
{ {
$extensionUrl = "https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix" $extensionUrl = "https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix"
$VSver = "2019" $VSver = "2019"
} }
else elseif (Test-IsWin16)
{ {
$extensionUrl = "https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix" $extensionUrl = "https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix"
$VSver = "2017" $VSver = "2017"
} }
else
{
throw "Invalid version of Visual Studio is found. Either 2017 or 2019 are required"
}
$extensionName = "Votive$VSver.vsix" $extensionName = "Votive$VSver.vsix"
#Installing VS extension 'Wix Toolset Visual Studio Extension' #Installing VS extension 'Wix Toolset Visual Studio Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName -VSversion $VSver Install-VsixExtension -Url $extensionUrl -Name $extensionName -VSversion $VSver

View File

@@ -14,6 +14,3 @@ $registryPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319"
if(Test-Path $registryPath){ if(Test-Path $registryPath){
Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD
} }
Invoke-PesterTests -TestFile "Tools" -TestName "DotnetTLS"

View File

@@ -7,18 +7,16 @@ $imageVersion = $env:IMAGE_VERSION
$imageDataFile = $env:IMAGEDATA_FILE $imageDataFile = $env:IMAGEDATA_FILE
$githubUrl="https://github.com/actions/virtual-environments/blob" $githubUrl="https://github.com/actions/virtual-environments/blob"
if ($caption -match "2019") if (Test-IsWin19) {
{
$imageLabel = "windows-2019" $imageLabel = "windows-2019"
$softwareUrl = "${githubUrl}/win19/${imageVersion}/images/win/Windows2019-Readme.md" $softwareUrl = "${githubUrl}/win19/${imageVersion}/images/win/Windows2019-Readme.md"
$releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win19%2F${imageVersion}" $releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win19%2F${imageVersion}"
} } elseif (Test-IsWin16) {
if ($caption -match "2016")
{
$imageLabel = "windows-2016" $imageLabel = "windows-2016"
$softwareUrl = "${githubUrl}/win16/${imageVersion}/images/win/Windows2016-Readme.md" $softwareUrl = "${githubUrl}/win16/${imageVersion}/images/win/Windows2016-Readme.md"
$releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win16%2F${imageVersion}" $releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win16%2F${imageVersion}"
} else {
throw "Invalid platform version is found. Either Windows Server 2016 or 2019 or 2022 are required"
} }
$json = @" $json = @"

View File

@@ -273,8 +273,11 @@ $markdown += Build-AndroidEnvironmentTable | New-MDTable
$markdown += New-MDNewLine $markdown += New-MDNewLine
# Docker images section # Docker images section
$markdown += New-MDHeader "Cached Docker images" -Level 3 $cachedImages = Get-CachedDockerImagesTableData
$markdown += Get-CachedDockerImagesTableData | New-MDTable if ($cachedImages) {
$markdown += New-MDNewLine $markdown += New-MDHeader "Cached Docker images" -Level 3
$markdown += $cachedImages | New-MDTable
$markdown += New-MDNewLine
}
$markdown | Out-File -FilePath "C:\InstalledSoftware.md" $markdown | Out-File -FilePath "C:\InstalledSoftware.md"

View File

@@ -37,7 +37,7 @@ function Get-VisualStudioExtensions {
# SSDT extensions for VS2017 # SSDT extensions for VS2017
$vs = (Get-VisualStudioVersion).Name.Split()[-1] $vs = (Get-VisualStudioVersion).Name.Split()[-1]
if ($vs -eq "2017") if (Test-IsWin16)
{ {
$analysisPackageVersion = Get-VSExtensionVersion -packageName '04a86fc2-dbd5-4222-848e-911638e487fe' $analysisPackageVersion = Get-VSExtensionVersion -packageName '04a86fc2-dbd5-4222-848e-911638e487fe'
$reportingPackageVersion = Get-VSExtensionVersion -packageName '717ad572-c4b7-435c-c166-c2969777f718' $reportingPackageVersion = Get-VSExtensionVersion -packageName '717ad572-c4b7-435c-c166-c2969777f718'
@@ -49,21 +49,30 @@ function Get-VisualStudioExtensions {
) )
} }
# Wix if (Test-IsWin16 -or Test-IsWin19) {
$wixPackageVersion = Get-WixVersion # Wix
$wixExtensionVersion = (Get-VisualStudioPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version $wixPackageVersion = Get-WixVersion
$wixExtensionVersion = (Get-VisualStudioPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version
$wixPackages = @(
@{Package = 'WIX Toolset'; Version = $wixPackageVersion}
@{Package = "WIX Toolset Studio $vs Extension"; Version = $wixExtensionVersion}
)
# WDK # WDK
$wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit'
$wdkExtensionVersion = Get-WDKVersion $wdkExtensionVersion = Get-WDKVersion
$wdkPackages = @(
@{Package = 'Windows Driver Kit'; Version = $wdkPackageVersion}
@{Package = 'Windows Driver Kit Visual Studio Extension'; Version = $wdkExtensionVersion}
)
}
$extensions = @( $extensions = @(
$vsixs $vsixs
$ssdtPackages $ssdtPackages
@{Package = 'Windows Driver Kit'; Version = $wdkPackageVersion} $wixPackages
@{Package = 'Windows Driver Kit Visual Studio Extension'; Version = $wdkExtensionVersion} $wdkPackages
@{Package = 'WIX Toolset'; Version = $wixPackageVersion}
@{Package = "WIX Toolset Studio $vs Extension"; Version = $wixExtensionVersion}
) )
$extensions | Foreach-Object { $extensions | Foreach-Object {