Skip to content

Commit 61706fe

Browse files
authored
Merge branch 'vs17.12' into merge/vs17.11-to-vs17.12
2 parents 155d42e + 675b209 commit 61706fe

File tree

666 files changed

+22363
-12138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

666 files changed

+22363
-12138
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// IMPORTANT: This file is read by the merge flow from main branch only.
2+
{
3+
"merge-flow-configurations": {
4+
// MSBuild servicing chain from oldest supported through currently-supported to main
5+
// Automate opening PRs to merge msbuild's vs16.11 (VS until 4/2029) into vs17.0 (SDK 6.0.1xx)
6+
"vs16.11": {
7+
"MergeToBranch": "vs17.0"
8+
},
9+
// Automate opening PRs to merge msbuild's vs17.0 (SDK 6.0.1xx) into vs17.3 (SDK 6.0.4xx)
10+
"vs17.0": {
11+
"MergeToBranch": "vs17.3"
12+
},
13+
// Automate opening PRs to merge msbuild's vs17.3 (SDK 6.0.4xx) into vs17.6 (VS until 1/2025)
14+
"vs17.3": {
15+
"MergeToBranch": "vs17.6"
16+
},
17+
// Automate opening PRs to merge msbuild's vs17.6 into vs17.8 (VS until 7/2025)
18+
"vs17.6": {
19+
"MergeToBranch": "vs17.8"
20+
},
21+
// Automate opening PRs to merge msbuild's vs17.8 (SDK 8.0.1xx) into vs17.10 (SDK 8.0.3xx)
22+
"vs17.8": {
23+
"MergeToBranch": "vs17.10"
24+
},
25+
// Automate opening PRs to merge msbuild's vs17.10 (SDK 8.0.3xx) into vs17.11 (SDK 8.0.4xx)
26+
"vs17.10": {
27+
"MergeToBranch": "vs17.11"
28+
},
29+
// MSBuild latest release to main
30+
"vs17.11": {
31+
"MergeToBranch": "main"
32+
}
33+
}
34+
}

.config/guardian/.gdnbaselines

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,6 @@
1111
}
1212
},
1313
"results": {
14-
"1757d0179485ad6618415e151de2453f25d5484071f7bae328fa9ca9d4d54688": {
15-
"signature": "1757d0179485ad6618415e151de2453f25d5484071f7bae328fa9ca9d4d54688",
16-
"alternativeSignatures": [],
17-
"target": "src/Tasks.UnitTests/TestResources/mycert.pfx",
18-
"line": 1,
19-
"memberOf": [
20-
"default"
21-
],
22-
"tool": "credscan",
23-
"ruleId": "CSCAN-GENERAL0020",
24-
"createdDate": "2024-03-14 11:30:33Z",
25-
"expirationDate": "2024-08-31 12:48:32Z",
26-
"justification": "This error is baselined with an expiration date of 180 days from 2024-03-14 12:48:32Z"
27-
},
28-
"60d4d52e838e08dc19d3ac2b43b7c809b080db55f9c754b80bd60f30624e9687": {
29-
"signature": "60d4d52e838e08dc19d3ac2b43b7c809b080db55f9c754b80bd60f30624e9687",
30-
"alternativeSignatures": [],
31-
"target": "artifacts/bin/Microsoft.Build.Tasks.UnitTests/Release/net472/TestResources/mycert.pfx",
32-
"line": 1,
33-
"memberOf": [
34-
"default"
35-
],
36-
"tool": "credscan",
37-
"ruleId": "CSCAN-GENERAL0020",
38-
"createdDate": "2024-03-14 12:01:14Z",
39-
"expirationDate": "2024-08-31 12:48:32Z",
40-
"justification": "This error is baselined with an expiration date of 180 days from 2024-03-14 12:48:32Z"
41-
},
42-
"7cb5d42a8744e4a214149aa27d3d8a1b7989914d1a2fee8cea13287368cbafff": {
43-
"signature": "7cb5d42a8744e4a214149aa27d3d8a1b7989914d1a2fee8cea13287368cbafff",
44-
"alternativeSignatures": [],
45-
"target": "artifacts/bin/Microsoft.Build.Tasks.UnitTests/Release/net8.0/TestResources/mycert.pfx",
46-
"line": 1,
47-
"memberOf": [
48-
"default"
49-
],
50-
"tool": "credscan",
51-
"ruleId": "CSCAN-GENERAL0020",
52-
"createdDate": "2024-03-14 12:01:14Z",
53-
"expirationDate": "2024-08-31 12:48:32Z",
54-
"justification": "This error is baselined with an expiration date of 180 days from 2024-03-14 12:48:32Z"
55-
},
5614
"24491acb7bf0f8b072d9fbd2f6efcf1bdf6e9506ff3f7a9f9c803445c55b7bd9": {
5715
"signature": "24491acb7bf0f8b072d9fbd2f6efcf1bdf6e9506ff3f7a9f9c803445c55b7bd9",
5816
"alternativeSignatures": [

.editorconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,41 @@ dotnet_diagnostic.IDE0290.severity = suggestion
410410

411411
# Collection initialization can be simplified
412412
dotnet_diagnostic.IDE0300.severity = suggestion
413+
dotnet_diagnostic.IDE0303.severity = suggestion
413414
dotnet_diagnostic.IDE0301.severity = suggestion
414415
dotnet_diagnostic.IDE0305.severity = suggestion
416+
dotnet_diagnostic.IDE0306.severity = suggestion
415417

416418
# Temporarily disable SA1010 "Opening square brackets should not be preceded by a space" until https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3687 is fixed
417419
dotnet_diagnostic.SA1010.severity = none
420+
421+
# Remove unnecessary equality operator IDE0100 (https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/ide0100)
422+
# Making it a suggestion to have a flexibility for future
423+
dotnet_diagnostic.IDE0100.severity = suggestion
424+
425+
# File header should match the template, making it error since couple of files met in the code base without any header
426+
dotnet_diagnostic.IDE0073.severity = error
427+
428+
# Use 'System.Threading.Lock'
429+
dotnet_diagnostic.IDE0330.severity = suggestion
430+
431+
# Value types are incompatible with null values. https://xunit.net/xunit.analyzers/rules/xUnit1012
432+
dotnet_diagnostic.xUnit1012.severity = warning
433+
434+
# Use Assert.Fail() instead of Assert.True(false) or Assert.False(true)
435+
dotnet_diagnostic.xUnit2020.severity = warning
436+
437+
# Use Assert.DoesNotContain instead of Assert.Empty on filtered collections
438+
dotnet_diagnostic.xUnit2029.severity = warning
439+
440+
# Do not use blocking task operations in test method. https://xunit.net/xunit.analyzers/rules/xUnit1031
441+
# The parallelization is disabled in https://github.com/dotnet/msbuild/blob/371d00f5c10a15b0858c411aafa11aac74596b06/src/Shared/UnitTests/xunit.runner.json#L6-L7
442+
# Issue to consider enabling parallelization: https://github.com/dotnet/msbuild/issues/10640
443+
dotnet_diagnostic.xUnit1031.severity = none
444+
445+
# Do not use equality check to check for collection size. https://xunit.net/xunit.analyzers/rules/xUnit2013
446+
# To fix the warning for empty collection we can use Assert.Empty() instead of Assert.Equal(0, collection.Count)
447+
# However to fix the warning for collections with 1 elements we should use Assert.Single() instead of Assert.Equal(1, collection.Count)
448+
# The latter brings incosistency in the codebase and some times in one test case.
449+
# So we are disabling this rule with respect to the above mentioned reasons.
450+
dotnet_diagnostic.xUnit2013.severity = none

.exp-insertions.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,24 @@ jobs:
152152
command: restore
153153
feedsToUse: config
154154
restoreSolution: '$(Build.SourcesDirectory)\eng\common\internal\Tools.csproj'
155-
nugetConfigPath: '$(Build.SourcesDirectory)\NuGet.config'
155+
nugetConfigPath: '$(Build.SourcesDirectory)\eng\common\internal\NuGet.config'
156156
restoreDirectory: '$(Build.SourcesDirectory)\.packages'
157157

158+
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance#authentication-from-pipelines
159+
# Requires Azure client 2.x
160+
- task: AzureCLI@2
161+
displayName: 'Set AzDO.DotnetPerfStarToken'
162+
enabled: true
163+
inputs:
164+
azureSubscription: 'dotnet-perfstar at app.vssps.visualstudio.com' # Azure DevOps service connection
165+
scriptType: 'pscore'
166+
scriptLocation: 'inlineScript'
167+
inlineScript: |
168+
# '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps
169+
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
170+
Write-Host "Setting AzDO.DotnetPerfStarToken"
171+
Write-Host "##vso[task.setvariable variable=AzDO.DotnetPerfStarToken]${token}"
172+
158173
- powershell: |
159174
mkdir "$(Pipeline.Workspace)/artifacts"
160175
@@ -166,7 +181,7 @@ jobs:
166181
Write-Host "Detected drop.exe path: $dropExePath"
167182
168183
Write-Host "Downloading VS msbuild"
169-
$patAuthEnvVar = "SYSTEM_ACCESSTOKEN"
184+
$patAuthEnvVar = "patVariable"
170185
& "$dropExePath" get --patAuthEnvVar $patAuthEnvVar -u "$(MSBuildDropPath)\$(VSVersion)" -d "$(System.ArtifactsDirectory)/VSMSBuildDrop"
171186
Write-Host "Download of VS msbuild finished"
172187
@@ -175,7 +190,7 @@ jobs:
175190
Write-Host "Copy of VS msbuild finished"
176191
displayName: Download msbuild vs drop
177192
env:
178-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
193+
patVariable: $(AzDO.DotnetPerfStarToken)
179194
180195
- task: DownloadBuildArtifacts@1
181196
inputs:

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ eng/common/** linguist-vendored linguist-generated
2424

2525
# Display XLF files collapsed by default in PR diffs
2626
*.xlf linguist-generated=true
27+
28+
# VerifyTests
29+
*.verified.txt text eol=lf working-tree-encoding=UTF-8
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 💡 BuildCheck Suggestion
2+
description: Suggesting a diagnostic check (AKA [BuildCheck](https://github.com/dotnet/msbuild/blob/main/documentation/specs/BuildCheck/BuildCheck.md)) that MSBuild could provide.
3+
title: "[BuildCheck Suggestion]: "
4+
labels: ["BuildCheck Suggestion", "Area: BuildCheck"]
5+
body:
6+
- type: textarea
7+
attributes:
8+
label: Summary
9+
description: Brief summary of what this proposal is about.
10+
validations:
11+
required: true
12+
- type: textarea
13+
attributes:
14+
label: Background and Motivation
15+
description: What is the problem MSBuild should be flagging and in what context did you encounter it?
16+
validations:
17+
required: true
18+
- type: textarea
19+
attributes:
20+
label: Sample issue or antipattern that the check should be flagging
21+
description: Please provide as specific as possible sample that you envision to be catched by the check.
22+
validations:
23+
required: true
24+
- type: textarea
25+
attributes:
26+
label: Sample output
27+
description: If you have an idea what and how to report - please try to provide possible sample.
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Sync Microsoft.Build version in analyzer template with Version.props
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'eng/Versions.props'
8+
9+
jobs:
10+
Sync-version:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set baseBranch variable
18+
id: vars
19+
run: echo "baseBranch=${{ github.ref_name }}" >> $GITHUB_ENV
20+
21+
- name: Update analyzer template version with version from Versions.props
22+
shell: pwsh
23+
run: |
24+
try {
25+
# Define the paths to your XML and JSON files
26+
$xmlFilePath = "eng/Versions.props"
27+
$jsonFilePath = "template_feed/content/Microsoft.CheckTemplate/.template.config/template.json"
28+
29+
# Check if the XML file exists
30+
if (-Not (Test-Path -Path $xmlFilePath)) {
31+
throw "Versions.props file not found: $xmlFilePath"
32+
}
33+
34+
# Load and parse the XML content
35+
[xml]$xmlContent = Get-Content -Path $xmlFilePath
36+
$versionPrefix = [string]$xmlContent.Project.PropertyGroup.VersionPrefix
37+
$versionPrefix = $versionPrefix.Trim()
38+
39+
# Validate the versionPrefix
40+
if ([string]::IsNullOrWhiteSpace($versionPrefix)) {
41+
throw "VersionPrefix is empty or null in the XML file: $xmlFilePath"
42+
}
43+
44+
# Check if the JSON file exists
45+
if (-Not (Test-Path -Path $jsonFilePath)) {
46+
throw "Analyzer template file not found: $jsonFilePath"
47+
}
48+
49+
# Load the JSON template
50+
$jsonContent = Get-Content -Path $jsonFilePath -Raw | ConvertFrom-Json
51+
52+
# Check if the versionPrefix is different from the current defaultValue
53+
if ($versionPrefix -ne $jsonContent.symbols.MicrosoftBuildVersion.defaultValue) {
54+
# Update the defaultValue of MicrosoftBuildVersion in the JSON template
55+
$jsonContent.symbols.MicrosoftBuildVersion.defaultValue = $versionPrefix
56+
57+
# Convert the JSON content back to a string
58+
$jsonString = $jsonContent | ConvertTo-Json -Depth 10
59+
60+
# Write the updated JSON back to the file
61+
Set-Content -Path $jsonFilePath -Value $jsonString
62+
Write-Output "Updated MicrosoftBuildVersion to $versionPrefix"
63+
64+
# Set the updateNeeded output variable to true
65+
$updateNeeded = "true"
66+
} else {
67+
Write-Output "No update needed. MicrosoftBuildVersion is already $versionPrefix"
68+
69+
# Set the updateNeeded output variable to false
70+
$updateNeeded = "false"
71+
}
72+
73+
# Set the versionPrefix and template filePath as an output
74+
Add-Content -Path $env:GITHUB_ENV -Value "versionPrefix=$versionPrefix"
75+
Add-Content -Path $env:GITHUB_ENV -Value "jsonFilePath=$jsonFilePath"
76+
Add-Content -Path $env:GITHUB_ENV -Value "updateNeeded=$updateNeeded"
77+
Write-Output "Extracted versionPrefix: $versionPrefix"
78+
Write-Output "Extracted jsonFilePath: $jsonFilePath"
79+
Write-Output "Update needed: $updateNeeded"
80+
}
81+
catch {
82+
Write-Error "An error occurred: $_"
83+
}
84+
85+
- name: Create Pull Request
86+
if: env.updateNeeded == 'true'
87+
uses: actions/github-script@v7
88+
with:
89+
script: |
90+
const baseBranch = process.env.baseBranch;
91+
const versionPrefix = process.env.versionPrefix;
92+
const filePath = process.env.jsonFilePath;
93+
const newBranch = `${baseBranch}-update-msbuild-version-for-analyzer-template`;
94+
const commitMessage = `Update MicrosoftBuildVersion to ${versionPrefix}`;
95+
const prBody = '[Automated] Update the MicrosoftBuildVersion defaultValue in the template.json.';
96+
const prTitle = 'Update MicrosoftBuildVersion in analyzer template';
97+
98+
// Main execution
99+
(async () => {
100+
try {
101+
// Configure git
102+
await configureGit();
103+
104+
// Create and switch to the new branch
105+
await createAndSwitchBranch(newBranch);
106+
107+
// Check if the branch PR already exists on the remote
108+
const shouldOpenPullRequest = await checkBranchPRExists(newBranch,baseBranch);
109+
110+
// Stage and commit the changes
111+
await stageAndCommitChanges(filePath, commitMessage);
112+
113+
// Push the new branch to the repository
114+
await pushBranch(newBranch);
115+
116+
// Create the pull request if needed
117+
if (shouldOpenPullRequest) {
118+
await createPullRequest(baseBranch, newBranch, prTitle, prBody);
119+
} else {
120+
console.log("The PR already exists, skipping opening a new PR.");
121+
}
122+
} catch (error) {
123+
core.setFailed(error);
124+
}
125+
})();
126+
127+
async function configureGit() {
128+
await exec.exec(`git config user.name "github-actions"`);
129+
await exec.exec(`git config user.email "[email protected]"`);
130+
}
131+
132+
async function createAndSwitchBranch(branch) {
133+
await exec.exec('git', ['checkout', '-b', branch]);
134+
}
135+
136+
async function checkBranchPRExists(newBranch,baseBranch) {
137+
// Check if a pull request already exists
138+
const { data: pullRequests } = await github.rest.pulls.list({
139+
owner: context.repo.owner,
140+
repo: context.repo.repo,
141+
head: newBranch,
142+
base: baseBranch,
143+
state: 'open',
144+
});
145+
146+
if (pullRequests.length === 0) {
147+
return true;
148+
} else {
149+
return false;
150+
}
151+
}
152+
153+
async function stageAndCommitChanges(filePath, commitMessage) {
154+
await exec.exec(`git add ${filePath}`);
155+
await exec.exec(`git commit -m "${commitMessage}"`);
156+
}
157+
158+
async function pushBranch(branch) {
159+
await exec.exec(`git push --force --set-upstream origin HEAD:${branch}`);
160+
}
161+
162+
async function createPullRequest(baseBranch, newBranch, title, body) {
163+
await github.rest.pulls.create({
164+
owner: context.repo.owner,
165+
repo: context.repo.repo,
166+
title: title,
167+
body: body,
168+
head: newBranch,
169+
base: baseBranch
170+
});
171+
}

.vsts-dotnet-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,4 +424,4 @@ jobs:
424424
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Verify'
425425
ArtifactName: 'macOS Verify $(System.JobAttempt)'
426426

427-
- template: /eng/common/templates/jobs/source-build.yml
427+
- template: /eng/common/templates/jobs/source-build.yml

0 commit comments

Comments
 (0)