Skip to content

Commit

Permalink
Test optimize vsix install
Browse files Browse the repository at this point in the history
  • Loading branch information
middlemose authored Jun 5, 2024
1 parent ea9fd66 commit 36f7b6c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
52 changes: 33 additions & 19 deletions .github/scripts/Install-Vsix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Checks WDK vsix version and downloads and installs as necessary.
#>

[CmdletBinding()]
param(
[bool]$optimize = $false
)

$root = Get-Location

# launch developer powershell (if necessary)
Expand All @@ -29,24 +34,33 @@ function TestWdkVsix {
Test-Path "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=$version"
}

PrintWdkVsix
if (-not (TestWdkVsix)) {
"The correct WDK vsix is not installed."
"Will attempt to download and install now..."
Invoke-WebRequest -Uri "$uri" -OutFile wdk.vsix
"Finished downloading."
"Starting install process. This will take some time to complete..."
Start-Process vsixinstaller -ArgumentList "/f /q /sp .\wdk.vsix" -wait
"The install process has finished."
"Checking the WDK.vsix version installed..."
if (TestWdkVsix) {
PrintWdkVsix
"The WDK vsix version is OK"
}
else {
"The WDK vsix install FAILED"
Write-Host "`u{274C} wdk vsix install had an issue"
Write-Error "the wdk vsix cannot be installed at this time"
exit 1
if ($optimize) {
"---> Downloading vsix and configuring build environment..."
Invoke-WebRequest -Uri "$uri" -OutFile wdk.zip
Expand-Archive ".\wkd.zip" .\
cp ".\`$MSBuild\*" (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*\MSBuild\") -Recurse -Force
"<--- Finished"
}
else {
PrintWdkVsix
if (-not (TestWdkVsix)) {
"The correct WDK vsix is not installed."
"Will attempt to download and install now..."
Invoke-WebRequest -Uri "$uri" -OutFile wdk.vsix
"Finished downloading."
"Starting install process. This will take some time to complete..."
Start-Process vsixinstaller -ArgumentList "/f /q /sp .\wdk.vsix" -wait
"The install process has finished."
"Checking the WDK.vsix version installed..."
if (TestWdkVsix) {
PrintWdkVsix
"The WDK vsix version is OK"
}
else {
"The WDK vsix install FAILED"
Write-Host "`u{274C} wdk vsix install had an issue"
Write-Error "the wdk vsix cannot be installed at this time"
exit 1
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/Code-Scanning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
submodules: 'recursive'

- name: Install WDK VSIX
run: .\.github\scripts\Install-Vsix.ps1
run: .\.github\scripts\Install-Vsix.ps1 -optimize:$true

- name: Install Nuget Packages
run: nuget restore .\packages.config -PackagesDirectory .\packages\
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
submodules: 'recursive'

- name: Install WDK VSIX
run: .\.github\scripts\Install-Vsix.ps1
run: .\.github\scripts\Install-Vsix.ps1 -optimize:$true

- name: Install Nuget Packages
run: nuget restore .\packages.config -PackagesDirectory .\packages\
Expand Down
4 changes: 2 additions & 2 deletions Build-SampleSet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ $jresult = @{
$SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count

# set vsix version
$wdk_vsix_version = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name
# $wdk_vsix_version = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name

Write-Output ("Build Environment: " + $build_environment)
Write-Output ("Build Number: " + $build_number)
Write-Output ("WDK VSIX Version: " + $wdk_vsix_version)
# Write-Output ("WDK VSIX Version: " + $wdk_vsix_version)
Write-Output ("Samples: " + $sampleSet.Count)
Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")")
Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")")
Expand Down

0 comments on commit 36f7b6c

Please sign in to comment.