|
| 1 | +# Copyright (c) Microsoft. All rights reserved. |
| 2 | +# Portable to Full PDB conversion script for Test Platform. |
| 3 | + |
| 4 | +[CmdletBinding()] |
| 5 | +Param( |
| 6 | + [Parameter(Mandatory=$false)] |
| 7 | + [ValidateSet("Debug", "Release")] |
| 8 | + [System.String] $Configuration = "Release" |
| 9 | +) |
| 10 | + |
| 11 | +# |
| 12 | +# Variables |
| 13 | +# |
| 14 | +Write-Verbose "Setup environment variables." |
| 15 | +$TF_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName |
| 16 | +$TF_PACKAGES_DIR = Join-Path $TF_ROOT_DIR "packages" |
| 17 | +$TF_OUT_DIR = Join-Path $TF_ROOT_DIR "artifacts" |
| 18 | +$TF_PortablePdbs =@("PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.pdb") |
| 19 | + |
| 20 | +$PdbConverterToolVersion = "1.1.0-beta1-62316-01" |
| 21 | + |
| 22 | +function Locate-PdbConverterTool |
| 23 | +{ |
| 24 | + $pdbConverter = Join-Path -path $TF_PACKAGES_DIR -ChildPath "Pdb2Pdb.$PdbConverterToolVersion\tools\Pdb2Pdb.exe" |
| 25 | + |
| 26 | + if (!(Test-Path -path $pdbConverter)) |
| 27 | + { |
| 28 | + throw "Unable to locate Pdb2Pdb converter exe in path '$pdbConverter'." |
| 29 | + } |
| 30 | + |
| 31 | + Write-Verbose "Pdb2Pdb converter path is : $pdbConverter" |
| 32 | + return $pdbConverter |
| 33 | + |
| 34 | +} |
| 35 | + |
| 36 | +function ConvertPortablePdbToWindowsPdb |
| 37 | +{ |
| 38 | + foreach($TF_PortablePdb in $TF_PortablePdbs) |
| 39 | + { |
| 40 | + $portablePdbs += Join-Path -path $TF_OUT_DIR\$Configuration -childPath $TF_PortablePdb |
| 41 | + } |
| 42 | + |
| 43 | + $pdbConverter = Locate-PdbConverterTool |
| 44 | + |
| 45 | + foreach($portablePdb in $portablePdbs) |
| 46 | + { |
| 47 | + # First check if corresponding dll exists |
| 48 | + $dllOrExePath = $portablePdb -replace ".pdb",".dll" |
| 49 | + |
| 50 | + if(!(Test-Path -path $dllOrExePath)) |
| 51 | + { |
| 52 | + # If no corresponding dll found, check if exe exists |
| 53 | + $dllOrExePath = $portablePdb -replace ".pdb",".exe" |
| 54 | + |
| 55 | + if(!(Test-Path -path $dllOrExePath)) |
| 56 | + { |
| 57 | + throw "Unable to locate dll/exe corresponding to $portablePdb" |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + $fullpdb = $portablePdb -replace ".pdb",".pdbfull" |
| 62 | + |
| 63 | + Write-Verbose "$pdbConverter $dll /pdb $portablePdb /out $fullpdb" |
| 64 | + & $pdbConverter $dllOrExePath /pdb $portablePdb /out $fullpdb |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +Write-Verbose "Converting Portable pdbs to Windows(Full) Pdbs..." |
| 69 | +ConvertPortablePdbToWindowsPdb |
| 70 | + |
0 commit comments