[2020-02] Bump msbuild to track mono-2019-12 (#19661)
[mono-project.git] / eng / common / darc-init.ps1
blobfc2190365f3e8beea5c91aac54b8dbba1482a781
1 param (
2 $darcVersion = $null,
3 $versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16',
4 $verbosity = 'minimal',
5 $toolpath = $null
8 . $PSScriptRoot\tools.ps1
10 function InstallDarcCli ($darcVersion) {
11 $darcCliPackageName = 'microsoft.dotnet.darc'
13 $dotnetRoot = InitializeDotNetCli -install:$true
14 $dotnet = "$dotnetRoot\dotnet.exe"
15 $toolList = & "$dotnet" tool list -g
17 if ($toolList -like "*$darcCliPackageName*") {
18 & "$dotnet" tool uninstall $darcCliPackageName -g
21 # If the user didn't explicitly specify the darc version,
22 # query the Maestro API for the correct version of darc to install.
23 if (-not $darcVersion) {
24 $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
27 $arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
29 Write-Host "Installing Darc CLI version $darcVersion..."
30 Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.'
31 if (-not $toolpath) {
32 & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g
33 }else {
34 & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath"
38 try {
39 InstallDarcCli $darcVersion
41 catch {
42 Write-Host $_.ScriptStackTrace
43 Write-PipelineTelemetryError -Category 'Darc' -Message $_
44 ExitWithExitCode 1