2019-01-12 01:39:30 +00:00
|
|
|
param (
|
2019-05-15 12:11:39 +00:00
|
|
|
$darcVersion = $null,
|
|
|
|
$versionEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16"
|
2019-01-12 01:39:30 +00:00
|
|
|
)
|
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
$verbosity = "m"
|
|
|
|
. $PSScriptRoot\tools.ps1
|
|
|
|
|
2019-01-12 01:39:30 +00:00
|
|
|
function InstallDarcCli ($darcVersion) {
|
2018-10-22 05:07:26 +00:00
|
|
|
$darcCliPackageName = "microsoft.dotnet.darc"
|
2018-12-19 20:55:42 +00:00
|
|
|
|
|
|
|
$dotnetRoot = InitializeDotNetCli -install:$true
|
|
|
|
$dotnet = "$dotnetRoot\dotnet.exe"
|
2019-06-08 12:08:27 +00:00
|
|
|
$toolList = & "$dotnet" tool list -g
|
2018-10-22 05:07:26 +00:00
|
|
|
|
|
|
|
if ($toolList -like "*$darcCliPackageName*") {
|
2019-06-08 12:08:27 +00:00
|
|
|
& "$dotnet" tool uninstall $darcCliPackageName -g
|
2018-10-22 05:07:26 +00:00
|
|
|
}
|
|
|
|
|
2019-05-15 12:11:39 +00:00
|
|
|
# If the user didn't explicitly specify the darc version,
|
|
|
|
# query the Maestro API for the correct version of darc to install.
|
2019-01-12 01:39:30 +00:00
|
|
|
if (-not $darcVersion) {
|
2019-05-15 12:11:39 +00:00
|
|
|
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
|
2019-01-12 01:39:30 +00:00
|
|
|
}
|
2019-06-08 12:08:27 +00:00
|
|
|
|
2019-05-14 13:05:32 +00:00
|
|
|
$arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json'
|
2018-10-22 05:07:26 +00:00
|
|
|
|
2019-01-12 01:39:30 +00:00
|
|
|
Write-Host "Installing Darc CLI version $darcVersion..."
|
2018-10-22 05:07:26 +00:00
|
|
|
Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed."
|
2019-06-08 12:08:27 +00:00
|
|
|
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g
|
2018-10-22 05:07:26 +00:00
|
|
|
}
|
|
|
|
|
2019-01-12 01:39:30 +00:00
|
|
|
InstallDarcCli $darcVersion
|