Skip to content

Commit

Permalink
Merge pull request #1054 from AArnott/libtemplateUpdate
Browse files Browse the repository at this point in the history
Merge latest Library.Template
  • Loading branch information
AArnott authored Jun 20, 2024
2 parents b98ecd9 + 6c5aaed commit 52278b9
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
]
},
"dotnet-coverage": {
"version": "17.11.0",
"version": "17.11.3",
"commands": [
"dotnet-coverage"
]
},
"nbgv": {
"version": "3.6.133",
"version": "3.6.139",
"commands": [
"nbgv"
]
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions
FROM mcr.microsoft.com/dotnet/sdk:8.0.201-jammy
FROM mcr.microsoft.com/dotnet/sdk:8.0.300-jammy

# Installing mono makes `dotnet test` work without errors even for net472.
# But installing it takes a long time, so it's excluded by default.
Expand Down
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ indent_size = 2
# Xml config files
[*.{ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}]
indent_size = 2
indent_style = space

# JSON files
[*.json]
Expand Down
19 changes: 0 additions & 19 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,4 @@
<PackageReleaseNotes Condition="'$(PackageProjectUrl)'!=''">$(PackageProjectUrl)/releases/tag/v$(Version)</PackageReleaseNotes>
</PropertyGroup>
</Target>

<PropertyGroup Condition="'$(IsWpfTempProject)' == ''">
<IsWpfTempProject>false</IsWpfTempProject>
<IsWpfTempProject Condition="$(MSBuildProjectName.EndsWith('_wpftmp'))">true</IsWpfTempProject>
</PropertyGroup>

<!--
Inspired by https://github.com/dotnet/arcade/blob/cbfa29d4e859622ada3d226f90f103f659665d31/src/Microsoft.DotNet.Arcade.Sdk/tools/Workarounds.props#L14-L31
Disable Source Link and Xliff in WPF temp projects to avoid generating non-deterministic file names to obj dir.
The project name is non-deterministic and is included in the Source Link json file name and xlf directory names.
It's also not necessary to generate these assets.
-->
<PropertyGroup Condition="'$(IsWpfTempProject)' == 'true'">
<EnableSourceLink>false</EnableSourceLink>
<EmbedUntrackedSources>false</EmbedUntrackedSources>
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<EnableXlfLocalization>false</EnableXlfLocalization>
</PropertyGroup>
</Project>
5 changes: 0 additions & 5 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<!-- Workaround https://github.com/dotnet/wpf/issues/1718 -->
<EmbedUntrackedSources Condition=" '$(UseWPF)' == 'true' ">false</EmbedUntrackedSources>
</PropertyGroup>

<ItemGroup>
<!-- Avoid compile error about missing namespace when combining ImplicitUsings with .NET Framework target frameworks. -->
<Using Remove="System.Net.Http" Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'" />
Expand Down
11 changes: 4 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageVersion Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.VisualStudio.Internal.MicroBuild.NonShipping" Version="$(MicroBuildVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="$(VisualStudioThreadingVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="$(VisualStudioThreadingVersion)" />
Expand All @@ -34,22 +34,19 @@
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="xunit.combinatorial" Version="1.6.24" />
<PackageVersion Include="xunit.runner.console" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
<PackageVersion Include="xunit.skippablefact" Version="1.4.13" />
<PackageVersion Include="xunit.stafact" Version="1.1.11" />
<PackageVersion Include="xunit" Version="2.8.0" />
<PackageVersion Include="xunit" Version="2.8.1" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.495" />
<GlobalPackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
<GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
<GlobalPackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" Version="3.11.0-beta1.24122.1" />
<GlobalPackageReference Include="Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.139" />
<GlobalPackageReference Include="Nullable" Version="1.3.1" />
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
22 changes: 22 additions & 0 deletions azure-pipelines/WIFtoPATauth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
parameters:
- name: deadPATServiceConnectionId # The GUID of the PAT-based service connection whose access token must be replaced.
type: string
- name: wifServiceConnectionName # The name of the WIF service connection to use to get the access token.
type: string
- name: resource # The scope for which the access token is requested.
type: string
default: 499b84ac-1321-427f-aa17-267ca6975798 # Azure Artifact feeds (any of them)

steps:
- task: AzureCLI@2
displayName: 🔏 Authenticate with WIF service connection
inputs:
azureSubscription: ${{ parameters.wifServiceConnectionName }}
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
$accessToken = az account get-access-token --query accessToken --resource '${{ parameters.resource }}' -o tsv
# Set the access token as a secret, so it doesn't get leaked in the logs
Write-Host "##vso[task.setsecret]$accessToken"
# Override the apitoken of the nuget service connection, for the duration of this stage
Write-Host "##vso[task.setendpoint id=${{ parameters.deadPATServiceConnectionId }};field=authParameter;key=apitoken]$accessToken"
17 changes: 13 additions & 4 deletions azure-pipelines/install-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
parameters:
initArgs:
- name: initArgs
type: string
default: ''
- name: needsAzurePublicFeeds
type: boolean
default: true # If nuget.config pulls from the azure-public account, we need to authenticate when building on the devdiv account.

steps:
- ${{ if and(parameters.needsAzurePublicFeeds, eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9')) }}:
- template: WIFtoPATauth.yml
parameters:
wifServiceConnectionName: azure-public/vside package pull
deadPATServiceConnectionId: 0ae39abc-4d06-4436-a7b5-865833df49db # azure-public/msft_consumption

- task: NuGetAuthenticate@1
displayName: 🔏 Authenticate NuGet feeds
inputs:
${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}:
nuGetServiceConnections: azure-public/msft_consumption # Only necessary for GitHub-hosted repos
forceReinstallCredentialProvider: true
${{ if and(parameters.needsAzurePublicFeeds, eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9')) }}:
nuGetServiceConnections: azure-public/msft_consumption

- powershell: |
$AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors
Expand Down
34 changes: 17 additions & 17 deletions azure-pipelines/official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ parameters:
# As an entrypoint pipeline yml file, all parameters here show up in the Queue Run dialog.
# If any paramaters should NOT be queue-time options, they should be removed from here
# and references to them in this file replaced with hard-coded values.
- name: RealSign
displayName: Real sign?
- name: ForceOfficialBuild
displayName: Official build (sign, compliance, etc.)
type: boolean
default: false
default: false # this should remain false so PR builds using this pipeline are unofficial
- name: ShouldSkipOptimize
displayName: Skip OptProf optimization
type: boolean
Expand All @@ -39,14 +39,10 @@ parameters:
displayName: Run tests
type: boolean
default: true
- name: EnableCompliance
displayName: Run Compliance Tools
type: boolean
default: true
- name: EnableAPIScan
displayName: Include APIScan with Compliance tools
displayName: Include APIScan with compliance tools
type: boolean
default: true
default: true # enable in individual repos only AFTER updating TSAOptions.json with your own values

resources:
repositories:
Expand All @@ -59,18 +55,22 @@ variables:
- template: GlobalVariables.yml

extends:
${{ if parameters.EnableCompliance }}:
${{ if or(parameters.ForceOfficialBuild, eq(variables['Build.Reason'],'Schedule')) }}:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
sdl:
sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES
codeSignValidation:
enabled: true
break: true
additionalTargetsGlobPattern: -|Variables-*\*.ps1;-|APIScanInputs-*\**;-|test_symbols-*\**;-|MicroBuild\**
policheck:
enabled: true
exclusionsFile: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml
suppression:
suppressionFile: $(System.DefaultWorkingDirectory)\azure-pipelines\falsepositives.gdnsuppress
sbom:
enabled: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} # Disable the generation for SBOMs for artifacts in unsigned builds since it's slow
enabled: true
credscan:
suppressionsFile: $(Build.SourcesDirectory)/azure-pipelines/CredScanSuppressions.json
debugMode: true # required for whole directory suppressions
Expand All @@ -82,9 +82,9 @@ extends:
- template: /azure-pipelines/build.yml@self
parameters:
Is1ESPT: true
RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}
RealSign: true
ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }}
EnableAPIScan: ${{ and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }}
EnableAPIScan: ${{ and(parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }}
windowsPool: VSEngSS-MicroBuild2022-1ES
linuxPool:
name: AzurePipelines-EO
Expand All @@ -99,7 +99,7 @@ extends:
RunTests: ${{ parameters.RunTests }}
- template: /azure-pipelines/prepare-insertion-stages.yml@self
parameters:
RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}
RealSign: true
${{ else }}:
template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate
parameters:
Expand All @@ -117,9 +117,9 @@ extends:
- template: /azure-pipelines/build.yml@self
parameters:
Is1ESPT: true
RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}
RealSign: false
ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }}
EnableAPIScan: ${{ and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }}
EnableAPIScan: false
windowsPool: VSEngSS-MicroBuild2022-1ES
linuxPool:
name: AzurePipelines-EO
Expand All @@ -134,4 +134,4 @@ extends:
RunTests: ${{ parameters.RunTests }}
- template: /azure-pipelines/prepare-insertion-stages.yml@self
parameters:
RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}
RealSign: false
4 changes: 4 additions & 0 deletions azure-pipelines/prepare-insertion-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ stages:
- download: current
artifact: deployables-Windows
displayName: 🔻 Download deployables-Windows artifact
- template: WIFtoPATauth.yml
parameters:
wifServiceConnectionName: azure-public/vside package push
deadPATServiceConnectionId: 42175e93-c771-4a4f-a132-3cca78f44b3b # azure-public/vssdk
1 change: 1 addition & 0 deletions azure-pipelines/vs-insertion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extends:
InsertionReviewers: $(Build.RequestedFor),Andrew Arnott
AutoCompletePR: true
AutoCompleteMergeStrategy: Squash
ShallowClone: true
- powershell: |
$contentType = 'application/json';
$headers = @{ Authorization = 'Bearer $(System.AccessToken)' };
Expand Down
1 change: 1 addition & 0 deletions azure-pipelines/vs-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ extends:
InsertionBuildPolicy: Request Perf DDRITs
InsertionReviewers: $(Build.RequestedFor)
AutoCompletePR: false
ShallowClone: true
- powershell: |
$insertionPRId = azure-pipelines/Get-InsertionPRId.ps1
$Markdown = @"
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.201",
"version": "8.0.300",
"rollForward": "patch",
"allowPrerelease": false
}
Expand Down

0 comments on commit 52278b9

Please sign in to comment.