You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
41
external/linker/eng/common/init-tools-native.ps1
vendored
41
external/linker/eng/common/init-tools-native.ps1
vendored
@@ -41,9 +41,13 @@ Param (
|
||||
[switch] $Force = $False,
|
||||
[int] $DownloadRetries = 5,
|
||||
[int] $RetryWaitTimeInSeconds = 30,
|
||||
[string] $GlobalJsonFile = "$PSScriptRoot\..\..\global.json"
|
||||
[string] $GlobalJsonFile
|
||||
)
|
||||
|
||||
if (!$GlobalJsonFile) {
|
||||
$GlobalJsonFile = Join-Path (Get-Item $PSScriptRoot).Parent.Parent.FullName "global.json"
|
||||
}
|
||||
|
||||
Set-StrictMode -version 2.0
|
||||
$ErrorActionPreference="Stop"
|
||||
|
||||
@@ -75,33 +79,42 @@ try {
|
||||
$NativeTools.PSObject.Properties | ForEach-Object {
|
||||
$ToolName = $_.Name
|
||||
$ToolVersion = $_.Value
|
||||
$LocalInstallerCommand = $InstallerPath
|
||||
$LocalInstallerCommand += " -ToolName $ToolName"
|
||||
$LocalInstallerCommand += " -InstallPath $InstallBin"
|
||||
$LocalInstallerCommand += " -BaseUri $BaseUri"
|
||||
$LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir"
|
||||
$LocalInstallerCommand += " -Version $ToolVersion"
|
||||
$LocalInstallerArguments = @{ ToolName = "$ToolName" }
|
||||
$LocalInstallerArguments += @{ InstallPath = "$InstallBin" }
|
||||
$LocalInstallerArguments += @{ BaseUri = "$BaseUri" }
|
||||
$LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" }
|
||||
$LocalInstallerArguments += @{ Version = "$ToolVersion" }
|
||||
|
||||
if ($Verbose) {
|
||||
$LocalInstallerCommand += " -Verbose"
|
||||
$LocalInstallerArguments += @{ Verbose = $True }
|
||||
}
|
||||
if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') {
|
||||
if($Force) {
|
||||
$LocalInstallerCommand += " -Force"
|
||||
$LocalInstallerArguments += @{ Force = $True }
|
||||
}
|
||||
}
|
||||
if ($Clean) {
|
||||
$LocalInstallerCommand += " -Clean"
|
||||
$LocalInstallerArguments += @{ Clean = $True }
|
||||
}
|
||||
|
||||
Write-Verbose "Installing $ToolName version $ToolVersion"
|
||||
Write-Verbose "Executing '$LocalInstallerCommand'"
|
||||
Invoke-Expression "$LocalInstallerCommand"
|
||||
Write-Verbose "Executing '$InstallerPath $LocalInstallerArguments'"
|
||||
& $InstallerPath @LocalInstallerArguments
|
||||
if ($LASTEXITCODE -Ne "0") {
|
||||
Write-Error "Execution failed"
|
||||
exit 1
|
||||
$errMsg = "$ToolName installation failed"
|
||||
if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) {
|
||||
Write-Warning $errMsg
|
||||
$toolInstallationFailure = $true
|
||||
} else {
|
||||
Write-Error $errMsg
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "No native tools defined in global.json"
|
||||
|
||||
Reference in New Issue
Block a user