diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-03-31 03:05:15 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-03-31 03:05:15 -0700 |
| commit | 1c9fd4aefc680e31fcd77c9a025eccd1dd1f2f34 (patch) | |
| tree | 1309b66ee3e17207b0a2fbbabdd36b954fbc4ad1 /scripts | |
| parent | 044c20dee0bda261e3e438b046d5226e3a8b0a8f (diff) | |
| download | vcpkg-1c9fd4aefc680e31fcd77c9a025eccd1dd1f2f34.tar.gz vcpkg-1c9fd4aefc680e31fcd77c9a025eccd1dd1f2f34.zip | |
[applocal.ps1] Keep global set of searched binaries and avoid excessive recursion.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/buildsystems/msbuild/applocal.ps1 | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index 55680c1f6..b2523a4d1 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -1,7 +1,10 @@ [cmdletbinding()] param([string]$targetBinary, [string]$installedDir, [string]$tlogFile) +$g_searched = @{} + function resolve($targetBinary) { + Write-Verbose "Resolving $targetBinary..." try { $targetBinaryPath = Resolve-Path $targetBinary -erroraction stop @@ -15,23 +18,30 @@ function resolve($targetBinary) { $a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" }) $a | % { if ([string]::IsNullOrEmpty($_)) { - continue + return + } + if ($g_searched.ContainsKey($_)) { + Write-Verbose " ${_}: previously searched - Skip" + return } + $g_searched.Set_Item($_, $true) if (Test-Path "$installedDir\$_") { if (Test-Path "$targetBinaryDir\$_") { - Write-Verbose "$_ is already present" + Write-Verbose " ${_}: already present - Only recurse" } else { Copy-Item $installedDir\$_ $targetBinaryDir - Write-Verbose "Copying $installedDir\$_ -> $_" + Write-Verbose " ${_}: Copying $installedDir\$_" } "$targetBinaryDir\$_" if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$_" } resolve("$targetBinaryDir\$_") } else { - Write-Verbose "$installedDir\$_ not found" + Write-Verbose " ${_}: $installedDir\$_ not found" } } + Write-Verbose "Done Resolving $targetBinary." } -resolve($targetBinary)
\ No newline at end of file +resolve($targetBinary) +Write-Verbose $($g_searched | out-string)
\ No newline at end of file |
