Skip to content

Commit

Permalink
Sandbox fixes (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanish-kh authored Nov 3, 2024
1 parent 7263c40 commit 1384f5e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Tools/SandboxTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,20 @@ if ($useNuGetForMicrosoftUIXaml) {
$dependencies += $uiLibs_nuget
}

Write-Output $versionTag

if ([System.Version]$versionTag.Trim('v') -ge [System.Version]'1.9.25180') {
$compareVersion = $versionTag -replace '(^v)|(-preview$)'
if ([System.Version]$compareVersion -ge [System.Version]'1.9.25180') {
# As of WinGet 1.9.25180, VCLibs no longer publishes to the public URL and must be downloaded from the WinGet release
$dependencies += $dependencies_inRelease
$script:dependencySource = 'InRelease'
} else {
$dependencies += $vcLibsUwp
# As of WinGet 1.7.10582, the dependency on uiLibsUwP was bumped from version 2.7.3 to version 2.8.6
$uiLibsUwp += ([System.Version]$versionTag.Trim('v') -ge [System.Version]'1.7.10582') ? $uiLibsUwp_2_8 : $uiLibsUwp_2_7
# As of WinGet 1.7.10514 (https://github.com/microsoft/winget-cli/pull/4218), the dependency on uiLibsUwP was bumped from version 2.7.3 to version 2.8.6
$uiLibsUwp += ([System.Version]$compareVersion -ge [System.Version]'1.7.10514') ? $uiLibsUwp_2_8 : $uiLibsUwp_2_7
$dependencies += $uiLibsUwp
$script:dependencySource = 'Legacy'
}

# Clean temp directory
# Clean temp directory except for the dependencies
Get-ChildItem $tempFolder -Recurse -Exclude $($(Split-Path $dependencies.SaveTo -Leaf) -replace '\.([^\.]+)$', '.*') | Remove-Item -Force -Recurse

if (-Not [String]::IsNullOrWhiteSpace($Manifest)) {
Expand All @@ -192,10 +191,12 @@ foreach ($dependency in $dependencies) {
$downloadFile = $true
if (Test-Path -Path $dependency.SaveTo) {
# If we have a hash for the file, it needs to be validated
if (!$dependency.hash) {
if ($dependency.hash) {
$downloadFile = $dependency.hash -ne $(Get-FileHash $dependency.SaveTo).Hash
} else {
# There is no hash to validate against, but the file exists, try using the existing file
# This is only meant for DesktopAppInstaller_Dependencies.zip right now, which does not have a hash
# https://github.com/microsoft/winget-cli/issues/4938
$downloadFile = $false
}
}
Expand Down Expand Up @@ -296,7 +297,7 @@ Write-Host @'
`$ProgressPreference = 'SilentlyContinue'
try {
if ($dependencySource -eq 'InRelease') {
if ('$($dependencySource)' -eq 'InRelease') {
Expand-Archive -Path '$($dependencies_inRelease.pathInSandbox)' -DestinationPath C:\Users\WDAGUtilityAccount\Downloads\Dependencies -ErrorAction SilentlyContinue
Get-ChildItem C:\Users\WDAGUtilityAccount\Downloads\Dependencies\x64 -Filter *.appx | Add-AppxPackage
} else {
Expand Down

0 comments on commit 1384f5e

Please sign in to comment.