Sync eng/common directory with azure-sdk-tools for PR 6300 (#4719)
* add fallback onto azure.sdk.tools.testproxy within generate-assets-json.ps1 Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> Co-authored-by: Sameeksha Vaity <sameeksha.v91@gmail.com> Co-authored-by: Konrad Jamrozik <spawarotti@jamro.pl>
This commit is contained in:
parent
b2f92f3513
commit
a11a93b48a
@ -138,11 +138,18 @@ class Version {
|
||||
}
|
||||
|
||||
Function Test-Exe-In-Path {
|
||||
Param([string] $ExeToLookFor)
|
||||
Param([string] $ExeToLookFor, [bool]$ExitOnError = $true)
|
||||
if ($null -eq (Get-Command $ExeToLookFor -ErrorAction SilentlyContinue)) {
|
||||
Write-Error "Unable to find $ExeToLookFor in your PATH"
|
||||
exit 1
|
||||
if ($ExitOnError) {
|
||||
Write-Error "Unable to find $ExeToLookFor in your PATH"
|
||||
exit 1
|
||||
}
|
||||
else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
return $true
|
||||
}
|
||||
|
||||
Function Test-TestProxyVersion {
|
||||
@ -348,9 +355,29 @@ $language = Get-Repo-Language
|
||||
# in the path and that we're able to map the language's recording
|
||||
# directories
|
||||
if ($InitialPush) {
|
||||
Test-Exe-In-Path -ExeToLookFor $TestProxyExe
|
||||
$proxyPresent = Test-Exe-In-Path -ExeToLookFor $TestProxyExe -ExitOnError $false
|
||||
|
||||
if ($TestProxyExe -eq "test-proxy") {
|
||||
# try to fall back
|
||||
if (-not $proxyPresent) {
|
||||
$StandaloneTestProxyExe = "Azure.Sdk.Tools.TestProxy"
|
||||
|
||||
if ($IsWindows) {
|
||||
$StandaloneTestProxyExe += ".exe"
|
||||
}
|
||||
|
||||
$standalonePresent = Test-Exe-In-Path -ExeToLookFor $StandaloneTestProxyExe -ExitOnError $false
|
||||
|
||||
if ($standalonePresent) {
|
||||
Write-Host "Default proxy exe $TestProxyExe is not present, but standalone tool $StandaloneTestProxyExe is. Updating proxy exe to use the standalone version."
|
||||
$TestProxyExe = $StandaloneTestProxyExe
|
||||
}
|
||||
else {
|
||||
Write-Error "The user has selected option InitialPush to push their assets, neither $TestProxyExe nor standalone executable $StandaloneTestProxyExe are installed on this machine."
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
if ($TestProxyExe -eq "test-proxy" -or $TestProxyExe.StartsWith("Azure.Sdk.Tools.TestProxy")) {
|
||||
Test-TestProxyVersion -TestProxyExe $TestProxyExe
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user