Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat projects and script files #3290

Merged
merged 3 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EE49
scripts\build.ps1 = scripts\build.ps1
scripts\build.sh = scripts\build.sh
scripts\PortableToFullPdb.ps1 = scripts\PortableToFullPdb.ps1
scripts\stylecop.json = scripts\stylecop.json
scripts\stylecop.ruleset = scripts\stylecop.ruleset
scripts\stylecop.test.ruleset = scripts\stylecop.test.ruleset
scripts\test.ps1 = scripts\test.ps1
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
displayName: 'Run script build.cmd'
inputs:
filename: build.cmd
# build should not be needed in the end, we are copying the build task from the build folder, but we should get
# build should not be needed in the end, we are copying the build task from the build folder, but we should get
# it either from artifacts, if present, or from extracted package file
# Adding it at the moment to avoid this error: #[error]Copy-Item : Cannot find path 'D:\a\1\s\src\Microsoft.TestPlatform.Build\bin\Release\netstandard2.0' because it does not exist.
arguments: '-verbose -configuration $(buildConfiguration) -steps "InstallDotnet, Restore, Build, PrepareAcceptanceTests"'
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
buildConfiguration: 'Release'
VSTestRTMBuild: 'false'
steps:
- script: chmod +x ./scripts/vsts-prebuild.sh
- script: chmod +x ./scripts/vsts-prebuild.sh
displayName: 'Preparing for set version'

- script: ./scripts/vsts-prebuild.sh -build "preview-$(Build.BuildNumber)" -rtm "$(VSTestRTMBuild)" -branch "$(Build.SourceBranch)"
Expand All @@ -152,7 +152,7 @@ jobs:
displayName: 'Build'

- script: ./test.sh -c $(buildConfiguration) -p Unit
displayName: 'Unit tests'
displayName: 'Unit tests'

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
2 changes: 1 addition & 1 deletion playground/MSTest1/MSTest1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />

<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' == 'WINDOWS_NT' ">$(TargetFrameworks);net472</TargetFrameworks>
<!-- We build this on linux as well, and are including ref assemblies for this framework only. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
Expand Down
69 changes: 31 additions & 38 deletions scripts/PortableToFullPdb.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[Parameter(Mandatory = $false)]
[ValidateSet("Debug", "Release")]
[System.String] $Configuration = "Release"
)
Expand All @@ -18,59 +18,52 @@ $TP_OUT_DIR = Join-Path $TP_ROOT_DIR "artifacts"

$PdbConverterToolVersion = "1.1.0-beta2-21075-01"

function Locate-PdbConverterTool
{
function Locate-PdbConverterTool {
$pdbConverter = Join-Path -path $TP_PACKAGES_DIR -ChildPath "Microsoft.DiaSymReader.Pdb2Pdb\$PdbConverterToolVersion\tools\Pdb2Pdb.exe"

if (!(Test-Path -path $pdbConverter)) {
throw "Unable to locate Pdb2Pdb converter exe in path '$pdbConverter'."
}
throw "Unable to locate Pdb2Pdb converter exe in path '$pdbConverter'."
}

Write-Verbose "Pdb2Pdb converter path is : $pdbConverter"
return $pdbConverter

}

function ConvertPortablePdbToWindowsPdb
{
$allPdbs = Get-ChildItem -path $TP_OUT_DIR\$Configuration *.pdb -Recurse | % {$_.FullName}
function ConvertPortablePdbToWindowsPdb {
$allPdbs = Get-ChildItem -path $TP_OUT_DIR\$Configuration *.pdb -Recurse | % { $_.FullName }
$portablePdbs = New-Object System.Collections.Generic.List[System.Object]

foreach($pdb in $allPdbs)
{
# First four bytes should be 'BSJB' for portable pdb
$bytes = [char[]](Get-Content $pdb -Encoding byte -TotalCount 4) -join ''

if( $bytes -eq "BSJB")
{
$portablePdbs.Add($pdb)
}

foreach ($pdb in $allPdbs) {
# First four bytes should be 'BSJB' for portable pdb
$bytes = [char[]](Get-Content $pdb -Encoding byte -TotalCount 4) -join ''

if ( $bytes -eq "BSJB") {
$portablePdbs.Add($pdb)
}
}

$pdbConverter = Locate-PdbConverterTool

foreach($portablePdb in $portablePdbs)
{
# First check if corresponding dll exists
$dllOrExePath = $portablePdb -replace ".pdb",".dll"

if(!(Test-Path -path $dllOrExePath))
{
# If no corresponding dll found, check if exe exists
$dllOrExePath = $portablePdb -replace ".pdb",".exe"

if(!(Test-Path -path $dllOrExePath))
{
throw "Unable to locate dll/exe corresponding to $portablePdb"
}
}

$fullpdb = $portablePdb -replace ".pdb",".pdbfull"

foreach ($portablePdb in $portablePdbs) {
# First check if corresponding dll exists
$dllOrExePath = $portablePdb -replace ".pdb", ".dll"

if (!(Test-Path -path $dllOrExePath)) {
# If no corresponding dll found, check if exe exists
$dllOrExePath = $portablePdb -replace ".pdb", ".exe"

if (!(Test-Path -path $dllOrExePath)) {
throw "Unable to locate dll/exe corresponding to $portablePdb"
}
}

$fullpdb = $portablePdb -replace ".pdb", ".pdbfull"

Write-Verbose "$pdbConverter $dll /pdb $portablePdb /out $fullpdb"
& $pdbConverter $dllOrExePath /pdb $portablePdb /out $fullpdb

Remove-Item -Path $portablePdb
Remove-Item -Path $portablePdb
}
}

Expand Down
Loading