Skip to content

Commit

Permalink
Use a better script
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Aug 15, 2023
1 parent edcf022 commit 48231b4
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions scripts/install-dotnet-workloads.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Param(
[string] $SourceUrl,
[string] $InstallDir,
[string] $Tizen = '<latest>',
[boolean] $IsPreview = $true
[string] $SourceUrl = '',
[string] $InstallDir = '',
[string] $Tizen = '',
[boolean] $IsPreview = $false
)

$ErrorActionPreference = 'Stop'

if (!$Tizen) {
$Tizen = '<latest>'
}

$feed1 = 'https://api.nuget.org/v3/index.json'
$feed2 = 'https://api.nuget.org/v3/index.json'
$feed3 = 'https://api.nuget.org/v3/index.json'
Expand All @@ -16,21 +20,36 @@ if ($IsPreview) {
$feed3 = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json'
}

$Workloads = 'android','macos','wasm-tools','wasm-tools-net6'
if (!$IsLinux) {
$Workloads += 'ios','tvos','maccatalyst','maui'
}

if ($SourceUrl) {
$Rollback = '--from-rollback-file',"$SourceUrl"
} elseif ($IsPreview) {
Write-Error "A preview workload install was requested, but no rollback file was provided. Specify the -SourceUrl."
exit 1
}

Write-Host "Installing .NET workloads..."
& dotnet workload install `
android ios tvos macos maccatalyst wasm-tools wasm-tools-net6 maui `
--from-rollback-file $SourceUrl `
@Workloads `
@Rollback `
--source https://api.nuget.org/v3/index.json `
--source $feed1 `
--source $feed2 `
--source $feed3 `
--skip-sign-check

Write-Host "Installing Tizen workloads..."
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
if (-not $Tizen) {
$Tizen = '<latest>'
New-Item -ItemType Directory -Force './output/tmp' | Out-Null
if ($IsLinux -or $IsMacOS) {
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.sh' -OutFile './output/tmp/workload-install.sh'
bash output/tmp/workload-install.sh --version "$Tizen"
} else {
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile './output/tmp/workload-install.ps1'
./output/tmp/workload-install.ps1 -Version "$Tizen"
}
./workload-install.ps1 -Version "$Tizen"

exit $LASTEXITCODE

0 comments on commit 48231b4

Please sign in to comment.