Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v16.10' into improveSemaphoreR…
Browse files Browse the repository at this point in the history
…eliability
  • Loading branch information
AArnott committed May 4, 2021
2 parents a7b2a04 + 7c534fa commit 9f2c0e3
Show file tree
Hide file tree
Showing 120 changed files with 18,093 additions and 16,363 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Expand Up @@ -4,9 +4,9 @@
version: 2
updates:
- package-ecosystem: nuget
directory: /src
directory: /
schedule:
interval: weekly
interval: monthly
ignore:
- dependency-name: Microsoft.CodeAnalysis* # We intentionally target older VS versions.
- dependency-name: DllExport # Later versions don't offer what we want.
19 changes: 10 additions & 9 deletions Directory.Build.props
Expand Up @@ -5,31 +5,32 @@
<BaseIntermediateOutputPath>$(RepoRootPath)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<BaseOutputPath Condition=" '$(BaseOutputPath)' == '' ">$(RepoRootPath)bin\$(MSBuildProjectName)\</BaseOutputPath>
<PackageOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\NuGet\</PackageOutputPath>
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<AnalysisLevel>latest</AnalysisLevel>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<Company>Microsoft</Company>
<Authors>Microsoft</Authors>
<Copyright>© Microsoft. All rights reserved.</Copyright>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Microsoft/vs-threading</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<MicroBuildVersion>2.0.61</MicroBuildVersion>
<MicroBuildVersion>2.0.65</MicroBuildVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" Condition=" '$(MSBuildProjectName)' != 'SosThreadingTools' " />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.2.31" PrivateAssets="all" />
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.7.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" PrivateAssets="all" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.9.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.261" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions azure-pipelines.yml
@@ -1,8 +1,8 @@
trigger:
branches:
include:
- master
- microbuild
- main
- 'v*'
- 'validate/*'
paths:
exclude:
Expand All @@ -13,6 +13,7 @@ trigger:

variables:
TreatWarningsAsErrors: true
UpdateXlfOnBuild: false # force build breaks if xlf files aren't updated on dev box with resx changes
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BuildConfiguration: Release
# codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines/Convert-PDB.ps1
Expand Up @@ -18,13 +18,13 @@
[string]$OutputPath
)

$version = '1.1.0-beta1-64128-01'
$version = '1.1.0-beta2-21101-01'
$baseDir = "$PSScriptRoot\..\obj\tools"
$pdb2pdbpath = "$baseDir\pdb2pdb.$version\tools\Pdb2Pdb.exe"
$pdb2pdbpath = "$baseDir\Microsoft.DiaSymReader.Pdb2Pdb.$version\tools\Pdb2Pdb.exe"
if (-not (Test-Path $pdb2pdbpath)) {
if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null }
$baseDir = (Resolve-Path $baseDir).Path # Normalize it
& (& $PSScriptRoot\Get-NuGetTool.ps1) install pdb2pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://dotnet.myget.org/F/symreader-converter/api/v3/index.json | Out-Null
& (& $PSScriptRoot\Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null
}

$args = $DllPath,'/out',$OutputPath,'/nowarn','0021'
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines/OptProf.yml
Expand Up @@ -6,7 +6,7 @@ schedules:
branches:
include:
- 'v1*'
- master
- main
always: true # we must keep data fresh since optimizationdata drops are purged after 30 days

# Avoid errant CI builds: https://developercommunity.visualstudio.com/content/problem/1154409/azure-pipeline-is-triggering-due-to-events-that-ne.html
Expand All @@ -28,13 +28,13 @@ variables:
value: Any CPU
- name: NUGET_PACKAGES
value: $(Agent.TempDirectory)/.nuget/packages
- name: push_to_ci
value: true
- name: PublicRelease
value: false # avoid using nice version since we're building a preliminary/unoptimized package
- name: SignType
value: real
- group: Library.Template
- name: NugetSecurityAnalysisWarningLevel
value: none # nuget.config requires signed packages by trusted owners

stages:
- stage: Library
Expand All @@ -43,7 +43,7 @@ stages:
jobs:
- template: build.yml
parameters:
windowsPool: VSEng-MicroBuildVS2019
windowsPool: VSEngSS-MicroBuild2019
ShouldSkipOptimize: true
- stage: QueueVSBuild
jobs:
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines/artifacts/VSInsertion.ps1
@@ -1,7 +1,7 @@
# This artifact captures everything needed to insert into VS (NuGet packages, insertion metadata, etc.)

# Only collect on Windows agents (Linux agents are missing nuget.exe, and besides we can only sign on Windows).
if ($env:AGENT_OS -and ($env:AGENT_OS -ne 'Windows_NT')) {
if ($IsMacOS -or $IsLinux) {
# We only package up for insertions on Windows agents since they are where optprof can happen.
Write-Verbose "Skipping VSInsertion artifact since we're not on Windows"
return @{}
}
Expand All @@ -11,7 +11,7 @@ $config = 'Debug'
if ($env:BUILDCONFIGURATION) { $config = $env:BUILDCONFIGURATION }
$NuGetPackages = "$RepoRoot\bin\Packages\$config\NuGet"
$CoreXTPackages = "$RepoRoot\bin\Packages\$config\CoreXT"
if (-not (Test-Path $NuGetPackages)) { Write-Warning "No NuGet packages found. Has a build been run?"; return @{} }
if (-not (Test-Path $NuGetPackages)) { Write-Error "No NuGet packages found. Has a build been run?"; return @{} }
$ArtifactBasePath = "$RepoRoot\obj\_artifacts"
$ArtifactPath = "$ArtifactBasePath\VSInsertion"
if (-not (Test-Path $ArtifactPath)) { New-Item -ItemType Directory -Path $ArtifactPath | Out-Null }
Expand All @@ -22,7 +22,7 @@ $profilingInputs.Save("$ArtifactPath\ProfilingInputs.props")

$nbgv = & "$PSScriptRoot\..\Get-nbgv.ps1"
$version = $(& $nbgv get-version -p "$RepoRoot\src" -f json | ConvertFrom-Json).NuGetPackageVersion
nuget pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $CoreXTPackages -BasePath $ArtifactPath -Version $version | Out-Null
& (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $CoreXTPackages -BasePath $ArtifactPath -Version $version | Out-Null
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines/artifacts/deployables.ps1
Expand Up @@ -17,7 +17,7 @@ if (Test-Path $SosThreadingToolsRoot) {
$ArchiveLayout = "$RepoRoot\obj\SosThreadingTools\ArchiveLayout"
if (Test-Path $ArchiveLayout) { Remove-Item -Force $ArchiveLayout -Recurse }
New-Item -Path $ArchiveLayout -ItemType Directory | Out-Null
Copy-Item -Force -Path "$SosThreadingToolsRoot" -Recurse -Exclude "DllExport.dll","*.pdb","*.xml" -Destination $ArchiveLayout
Copy-Item -Force -Path "$SosThreadingToolsRoot" -Recurse -Exclude "DllExport.dll","*.xml" -Destination $ArchiveLayout
Rename-Item -Path $ArchiveLayout\net472 $ArchiveLayout\SosThreadingTools
Get-ChildItem -Path $ArchiveLayout\symstore -Recurse | Remove-Item
Compress-Archive -Force -Path $ArchiveLayout\SosThreadingTools -DestinationPath $ArchivePath
Expand Down
6 changes: 5 additions & 1 deletion azure-pipelines/build.yml
Expand Up @@ -10,6 +10,10 @@ jobs:
steps:
- checkout: self
clean: true

- ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
- template: schedule-only-steps.yml

- template: install-dependencies.yml

- powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud'
Expand Down Expand Up @@ -52,7 +56,7 @@ jobs:
- macOS
pool:
vmImage: Ubuntu 18.04
condition: succeededOrFailed()
condition: ne(variables['OptProf'], 'true')
steps:
- checkout: self
clean: true
Expand Down
15 changes: 12 additions & 3 deletions azure-pipelines/dotnet.yml
Expand Up @@ -16,15 +16,15 @@ steps:
displayName: dotnet test -f net472
inputs:
command: test
arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net472.binlog"
testRunTitle: net472-$(Agent.JobName)
condition: and(ne(variables['OptProf'], 'true'), eq(variables['Agent.OS'], 'Windows_NT'))

- task: DotNetCoreCLI@2
displayName: dotnet test -f netcoreapp2.1
inputs:
command: test
arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp2.1.binlog"
testRunTitle: netcoreapp2.1-$(Agent.JobName)
workingDirectory: test/Microsoft.VisualStudio.Threading.Tests
condition: ne(variables['OptProf'], 'true')
Expand All @@ -33,11 +33,20 @@ steps:
displayName: dotnet test -f netcoreapp3.1
inputs:
command: test
arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp3.1.binlog"
testRunTitle: netcoreapp3.1-$(Agent.JobName)
workingDirectory: test/Microsoft.VisualStudio.Threading.Tests
condition: ne(variables['OptProf'], 'true')

- task: DotNetCoreCLI@2
displayName: dotnet test -f net5.0
inputs:
command: test
arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net5.0.binlog"
testRunTitle: net5.0-$(Agent.JobName)
workingDirectory: test/Microsoft.VisualStudio.Threading.Tests
condition: ne(variables['OptProf'], 'true')

# We have to artifically run this script so that the extra .nupkg is produced for variables/InsertConfigValues.ps1 to notice.
- powershell: azure-pipelines\artifacts\VSInsertion.ps1
displayName: Prepare VSInsertion artifact
Expand Down
6 changes: 4 additions & 2 deletions azure-pipelines/microbuild.after.yml
Expand Up @@ -19,7 +19,7 @@ steps:
buildNumber: $(ProfilingInputsDropName)
sourcePath: $(Build.ArtifactStagingDirectory)\OptProf\ProfilingInputs
toLowerCase: false
usePat: false
usePat: true
displayName: Publish to Artifact Services - ProfilingInputs
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
continueOnError: true
Expand All @@ -42,5 +42,7 @@ steps:
/repoName:$(Build.Repository.Name)
/additionalCodexArguments:-bld
/additionalCodexArguments:$(Build.ArtifactStagingDirectory)/build_logs
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'PullRequest'))
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.Reason'], 'PullRequest'))
continueOnError: true

- template: secure-development-tools.yml
3 changes: 2 additions & 1 deletion azure-pipelines/microbuild.before.yml
Expand Up @@ -2,12 +2,13 @@ parameters:
- name: ShouldSkipOptimize

steps:
- task: MicroBuildOptProfPlugin@5
- task: MicroBuildOptProfPlugin@6
inputs:
ProfilingInputsDropName: ProfilingInputs/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
OptimizationInputsLookupMethod: DropPrefix
DropNamePrefix: OptimizationInputs/$(System.TeamProject)/$(Build.Repository.Name)
ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }}
AccessToken: $(System.AccessToken)
displayName: Install OptProf Plugin

- task: MicroBuildSigningPlugin@2
Expand Down
14 changes: 10 additions & 4 deletions azure-pipelines/official.yml
@@ -1,7 +1,7 @@
trigger:
branches:
include:
- master
- main
- 'v16.*'
- 'validate/*'
paths:
Expand All @@ -15,7 +15,7 @@ schedules:
displayName: Daily vs-insertion
branches:
include:
- master
- main
- 'v16.*'

parameters:
Expand All @@ -29,6 +29,9 @@ parameters:
type: boolean
default: false

variables:
NugetSecurityAnalysisWarningLevel: none # nuget.config requires signed packages by trusted owners

stages:

- stage: Build
Expand All @@ -38,12 +41,13 @@ stages:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BuildConfiguration: Release
BuildPlatform: Any CPU
push_to_ci: true
NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages
SignTypeSelection: ${{ parameters.SignTypeSelection }}
jobs:
- template: build.yml
parameters:
windowsPool: VSEng-MicroBuildVS2019
windowsPool: VSEngSS-MicroBuild2019
ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }}

- stage: symbol_archive
Expand All @@ -69,7 +73,7 @@ stages:
inputs:
SymbolsFeatureName: $(SymbolsFeatureName)
SymbolsSymwebProject: VS
SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\Symbols.Archival
SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildId)\Symbols.Archival
SymbolsEmailContacts: vsidemicrobuild
SymbolsAgentPath: $(Pipeline.Workspace)/symbols-Windows
- task: MicroBuildCleanup@1
Expand Down Expand Up @@ -101,3 +105,5 @@ stages:
packagesToPush: $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg
nuGetFeedType: external
publishFeedCredentials: azure-public/vssdk
allowPackageConflicts: true
continueOnError: true # until "skip on conflict" is offered as a task input.
2 changes: 1 addition & 1 deletion azure-pipelines/publish-codecoverage.yml
Expand Up @@ -12,7 +12,7 @@ steps:
displayName: Download macOS code coverage results
continueOnError: true
- powershell: |
dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config
dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.8.5 --configfile azure-pipelines/justnugetorg.nuget.config
Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj
Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)"
$reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.*.cobertura.xml"
Expand Down
3 changes: 1 addition & 2 deletions azure-pipelines/release.yml
Expand Up @@ -4,7 +4,7 @@ pr: none
resources:
pipelines:
- pipeline: CI
source: Library # TODO: This should match the name of your CI pipeline
source: vs-threading
trigger:
tags:
- auto-release
Expand Down Expand Up @@ -58,7 +58,6 @@ stages:
- download: CI
artifact: deployables-Windows
displayName: Download deployables-Windows artifact
patterns: 'deployables-Windows/*'
- task: NuGetToolInstaller@1
displayName: Use NuGet 5.x
inputs:
Expand Down
11 changes: 11 additions & 0 deletions azure-pipelines/secure-development-tools.yml
@@ -0,0 +1,11 @@
steps:

### Check for checked in credentials.
- task: CredScan@3
displayName: 'Run CredScan'

### Run PoliCheck to check for disallowed terms. targetType: F indicates we're searching files and folders.
- task: PoliCheck@1
displayName: 'Run PoliCheck'
inputs:
targetType: F
13 changes: 7 additions & 6 deletions azure-pipelines/variables/InsertPropsValues.ps1
@@ -1,16 +1,17 @@
$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BuildConfiguration")
$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BUILDCONFIGURATION")

$dirsToSearch = "$BinPath\NuGet\*.nupkg" |? { Test-Path $_ }
$icv=@()
if ($dirsToSearch) {

# Avoid updating the .props world for an optprof run.
# This avoids analyzer updates that are unrelated and can cause build breaks
# as well as breaks in servicing branches when we insert a PublicRelease=false unstable package version.
if ($dirsToSearch -and !$env:OPTPROF) {
Get-ChildItem -Path $dirsToSearch |% {
if ($_.Name -match "^(.*)\.(\d+\.\d+\.\d+(?:-.*?)?)(?:\.symbols)?\.nupkg$") {
$id = $Matches[1]
$version = $Matches[2]
# Avoid inserting analyzers in an optprof run.
if ($env:OPTPROF -ne 'true' -or $_.Name -notlike '*Analyzers*') {
$icv += "$id=$version"
}
$icv += "$id=$version"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines/variables/ProfilingInputsDropName.ps1
@@ -1,5 +1,5 @@
if ($env:System_TeamProject) {
"ProfilingInputs/$env:System_TeamProject/$env:Build_Repository_Name/$env:Build_SourceBranchName/$env:Build_BuildId"
if ($env:SYSTEM_TEAMPROJECT) {
"ProfilingInputs/$env:SYSTEM_TEAMPROJECT/$env:BUILD_REPOSITORY_NAME/$env:BUILD_SOURCEBRANCHNAME/$env:BUILD_BUILDID"
} else {
Write-Warning "No Azure Pipelines build detected. No VSTS drop name will be computed."
Write-Warning "No Azure Pipelines build detected. No Azure Pipelines drop name will be computed."
}
5 changes: 2 additions & 3 deletions azure-pipelines/variables/SignType.ps1
Expand Up @@ -2,11 +2,10 @@ if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9') {
if ($env:BUILD_REASON -eq 'Schedule') {
'real'
} else {
if ($env:SignTypeSelection) {
$env:SignTypeSelection
if ($env:SIGNTYPESELECTION) {
$env:SIGNTYPESELECTION
} else {
'test'
}
}
}

0 comments on commit 9f2c0e3

Please sign in to comment.