Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into microbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Apr 3, 2023
2 parents 07331ab + 99e9481 commit 5217804
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 48 deletions.
30 changes: 30 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": 1,
"isRoot": true,
"tools": {
"powershell": {
"version": "7.3.3",
"commands": [
"pwsh"
]
},
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
},
"dotnet-coverage": {
"version": "17.6.11",
"commands": [
"dotnet-coverage"
]
},
"nbgv": {
"version": "3.5.119",
"commands": [
"nbgv"
]
}
}
}
24 changes: 0 additions & 24 deletions azure-pipelines/Get-nbgv.ps1

This file was deleted.

46 changes: 23 additions & 23 deletions azure-pipelines/Merge-CodeCoverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ Param(
)

$RepoRoot = [string](Resolve-Path $PSScriptRoot/..)

if (!(Test-Path $RepoRoot/obj/dotnet-coverage*)) {
dotnet tool install --tool-path $RepoRoot/obj dotnet-coverage --version 17.4.3 --configfile $PSScriptRoot/justnugetorg.nuget.config
}

Write-Verbose "Searching $Path for *.cobertura.xml files"
$reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml

if ($reports) {
$reports |% { $_.FullName } |% {
# In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not.
$xml = [xml](Get-Content -Path $_)
$xml.coverage.packages.package.classes.class |? { $_.filename} |% {
$_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar)
Push-Location $RepoRoot
try {
Write-Verbose "Searching $Path for *.cobertura.xml files"
$reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml

if ($reports) {
$reports |% { $_.FullName } |% {
# In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not.
$xml = [xml](Get-Content -Path $_)
$xml.coverage.packages.package.classes.class |? { $_.filename} |% {
$_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar)
}

$xml.Save($_)
}

$xml.Save($_)
}
$Inputs = $reports |% { Resolve-Path -relative $_.FullName }

$Inputs = $reports |% { Resolve-Path -relative $_.FullName }
if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) {
New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null
}

if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) {
New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null
& dotnet tool run dotnet-coverage merge $Inputs -o $OutputFile -f cobertura
} else {
Write-Error "No reports found to merge."
}

& "$RepoRoot/obj/dotnet-coverage" merge $Inputs -o $OutputFile -f cobertura
} else {
Write-Error "No reports found to merge."
} finally {
Pop-Location
}
2 changes: 1 addition & 1 deletion azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- template: install-dependencies.yml

- powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -ca'
- script: dotnet tool run nbgv cloud -ca
displayName: ⚙ Set build number

- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}:
Expand Down
11 changes: 11 additions & 0 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
No effect if -NoPrerequisites is specified.
.PARAMETER NoRestore
Skips the package restore step.
.PARAMETER NoToolRestore
Skips the dotnet tool restore step.
.PARAMETER Signing
Install the MicroBuild signing plugin for building test-signed builds on desktop machines.
.PARAMETER Localization
Expand Down Expand Up @@ -59,6 +61,8 @@ Param (
[Parameter()]
[switch]$NoRestore,
[Parameter()]
[switch]$NoToolRestore,
[Parameter()]
[switch]$Signing,
[Parameter()]
[switch]$Localization,
Expand Down Expand Up @@ -116,6 +120,13 @@ try {
}
}

if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) {
dotnet tool restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring dotnet CLI tools."
}
}

$InstallNuGetPkgScriptPath = "$PSScriptRoot\azure-pipelines\Install-NuGetPackage.ps1"
$nugetVerbosity = 'quiet'
if ($Verbose) { $nugetVerbosity = 'normal' }
Expand Down

0 comments on commit 5217804

Please sign in to comment.