Skip to content

Commit

Permalink
Apply Fallback Install
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonghyunCho committed Aug 16, 2024
1 parent 6ee5c63 commit dc06d08
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions workload/scripts/workload-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $ProgressPreference = "SilentlyContinue"

$ManifestBaseName = "Samsung.NET.Sdk.Tizen.Manifest"

$LatestVersionMap = @{
$LatestVersionMap = [ordered]@{
"$ManifestBaseName-6.0.100" = "7.0.101";
"$ManifestBaseName-6.0.200" = "7.0.100-preview.13.6";
"$ManifestBaseName-6.0.300" = "8.0.133";
Expand Down Expand Up @@ -95,13 +95,29 @@ function Get-LatestVersion([string]$Id) {
if ($attempts -gt 0) { Start-Sleep $sleepInSeconds }
} while ($attempts -gt 0)

if ($LatestVersionMap.ContainsKey($Id))
if ($LatestVersionMap.Contains($Id))
{
Write-Host "Return cached latest version."
return $LatestVersionMap.$Id
} else {
Write-Error "Wrong Id: $Id"
}
else
{
$SubStringId = $Id.Substring(0, $ManifestBaseName.Length + 2);
$MatchingFallbackVersion = @()
foreach ($key in $LatestVersionMap.Keys) {
if ($key -like "$SubStringId*") {
$MatchingFallbackVersion += $key
}
}
if ($MatchingFallbackVersion)
{
$FallbackVersion = $MatchingFallbackVersion[-1]
Write-Host "Return fallback version: $FallbackVersion"
return $FallbackVersion
}
}

Write-Error "Wrong Id: $Id"
}

function Get-Package([string]$Id, [string]$Version, [string]$Destination, [string]$FileExt = "nupkg") {
Expand Down

0 comments on commit dc06d08

Please sign in to comment.