Skip to content

Commit bf2a49d

Browse files
Rebuild Microsoft.CodeAnalysis (#50968)
Co-authored-by: Jared Parsons <jaredpparsons@gmail.com>
1 parent b272206 commit bf2a49d

39 files changed

Lines changed: 1173 additions & 371 deletions

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
55
"version": "0.2.0",
66
"configurations": [
7+
{
8+
"name": "Launch BuildValidator.dll",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/artifacts/bin/BuildValidator/Debug/netcoreapp3.1/BuildValidator.dll",
14+
"args": [
15+
"--assembliesPath", "./artifacts/obj/RunTests",
16+
"--debugPath", "./artifacts/BuildValidator",
17+
"--sourcePath", "."
18+
],
19+
"cwd": "${workspaceFolder}",
20+
"stopAtEntry": false,
21+
"console": "internalConsole"
22+
},
723
{
824
"name": "Launch RunTests.dll",
925
"type": "coreclr",

azure-pipelines.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,38 @@ jobs:
213213
continueOnError: true
214214
condition: not(succeeded())
215215

216+
- job: Correctness_Rebuild
217+
pool:
218+
vmImage: windows-2019
219+
timeoutInMinutes: 90
220+
steps:
221+
- template: eng/pipelines/checkout-windows-task.yml
222+
223+
- task: PowerShell@2
224+
displayName: Restore
225+
inputs:
226+
filePath: eng/build.ps1
227+
arguments: -configuration Debug -prepareMachine -ci -restore -binaryLog
228+
229+
- task: PowerShell@2
230+
displayName: Build
231+
inputs:
232+
filePath: eng/build.ps1
233+
arguments: -configuration Debug -prepareMachine -ci -build -bootstrap -publish -binaryLog -skipDocumentation
234+
235+
- script: .\artifacts\bin\BuildValidator\Debug\net472\BuildValidator.exe --assembliesPath .\artifacts\obj\Microsoft.CodeAnalysis --debugPath .\artifacts\BuildValidator --sourcePath .
236+
displayName: Run BuildValidator
237+
238+
- task: PublishBuildArtifacts@1
239+
displayName: Publish BuildValidator debug outputs
240+
inputs:
241+
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/BuildValidator'
242+
ArtifactName: 'BuildValidator_DebugOut'
243+
publishLocation: Container
244+
continueOnError: true
245+
condition: failed()
246+
247+
- template: eng/pipelines/publish-logs.yml
248+
parameters:
249+
jobName: Correctness_Rebuild
250+
configuration: Debug

eng/Versions.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<MicrosoftIdentityModelClientsActiveDirectoryVersion>3.13.8</MicrosoftIdentityModelClientsActiveDirectoryVersion>
9797
<MicrosoftInternalPerformanceCodeMarkersDesignTimeVersion>15.8.27812-alpha</MicrosoftInternalPerformanceCodeMarkersDesignTimeVersion>
9898
<MicrosoftInternalVisualStudioShellInterop140DesignTimeVersion>14.3.25407-alpha</MicrosoftInternalVisualStudioShellInterop140DesignTimeVersion>
99-
<MicrosoftMetadataVisualizerVersion>1.0.0-beta3.20174.1</MicrosoftMetadataVisualizerVersion>
99+
<MicrosoftMetadataVisualizerVersion>1.0.0-beta3.21075.2</MicrosoftMetadataVisualizerVersion>
100100
<MicrosoftMSXMLVersion>8.0.0</MicrosoftMSXMLVersion>
101101
<MicrosoftNETBuildExtensionsVersion>2.2.101</MicrosoftNETBuildExtensionsVersion>
102102
<MicrosoftNETCorePlatformsVersion>2.1.2</MicrosoftNETCorePlatformsVersion>
@@ -205,6 +205,7 @@
205205
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
206206
<SystemCompositionVersion>1.0.31</SystemCompositionVersion>
207207
<SystemCodeDomVersion>4.7.0</SystemCodeDomVersion>
208+
<SystemCommandLineVersion>2.0.0-beta1.20574.7</SystemCommandLineVersion>
208209
<SystemCommandLineExperimentalVersion>0.3.0-alpha.19577.1</SystemCommandLineExperimentalVersion>
209210
<SystemComponentModelCompositionVersion>4.5.0</SystemComponentModelCompositionVersion>
210211
<SystemDrawingCommonVersion>4.5.0</SystemDrawingCommonVersion>

eng/build-utils.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function Make-BootstrapBuild([switch]$force32 = $false) {
333333

334334
Run-MSBuild $projectPath "/restore /t:Pack /p:RoslynEnforceCodeStyle=false /p:RunAnalyzersDuringBuild=false /p:DotNetUseShippingVersions=true /p:InitialDefineConstants=BOOTSTRAP /p:PackageOutputPath=`"$dir`" /p:EnableNgenOptimization=false /p:PublishWindowsPdb=false $force32Flag" -logFileName "Bootstrap" -configuration $bootstrapConfiguration -runAnalyzers
335335
$packageFile = Get-ChildItem -Path $dir -Filter "$packageName.*.nupkg"
336-
Unzip "$dir\$packageFile" $dir
336+
Unzip (Join-Path $dir $packageFile) $dir
337337

338338
Write-Host "Cleaning Bootstrap compiler artifacts"
339339
Run-MSBuild $projectPath "/t:Clean" -logFileName "BootstrapClean"

eng/test-rebuild.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<#
2+
This script tests that Roslyn artifacts are rebuildable--i.e. that the source code and resources can be identified
3+
#>
4+
5+
[CmdletBinding(PositionalBinding=$false)]
6+
param(
7+
[string]$configuration = "Debug",
8+
[switch]$ci = $false,
9+
[switch]$help)
10+
11+
Set-StrictMode -version 2.0
12+
$ErrorActionPreference="Stop"
13+
14+
function Print-Usage() {
15+
Write-Host "Usage: test-rebuild.ps1"
16+
Write-Host " -configuration Build configuration ('Debug' or 'Release')"
17+
Write-Host " -ci Set when running on CI server"
18+
Write-Host " -help Print help and exit"
19+
}
20+
21+
try {
22+
if ($help) {
23+
Print-Usage
24+
exit 0
25+
}
26+
27+
. (Join-Path $PSScriptRoot "build-utils.ps1")
28+
Push-Location $RepoRoot
29+
30+
Write-Host "Building Roslyn"
31+
Exec-Console (Join-Path $PSScriptRoot "build.ps1") "-restore -build -ci:$ci -configuration:$configuration -pack -binaryLog"
32+
Exec-Console "artifacts\bin\BuildValidator\$configuration\net472\BuildValidator.exe" "--assembliesPath '$ArtifactsDir/obj/Microsoft.CodeAnalysis'"
33+
34+
exit 0
35+
}
36+
catch [exception] {
37+
Write-Host $_
38+
Write-Host $_.Exception
39+
exit 1
40+
}
41+
finally {
42+
Pop-Location
43+
}

src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,11 +2016,13 @@ async partial void M() {}
20162016

20172017
AssertEx.AssertEqualToleratingWhitespaceDifferences(@"
20182018
MethodDebugInformation (index: 0x31, size: 20):
2019-
==================================================
2020-
1: nil
2021-
2: nil
2022-
3: nil
2023-
4:
2019+
================================================
2020+
IL
2021+
================================================
2022+
1: nil
2023+
2: nil
2024+
3: nil
2025+
4:
20242026
{
20252027
Kickoff Method: 0x06000001 (MethodDef)
20262028
Locals: 0x11000002 (StandAloneSig)

src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,12 +1599,14 @@ public class C
15991599

16001600
AssertEx.AssertEqualToleratingWhitespaceDifferences(@"
16011601
MethodDebugInformation (index: 0x31, size: 40):
1602-
==================================================
1603-
1: nil
1604-
2: nil
1605-
3: nil
1606-
4: nil
1607-
5:
1602+
================================================
1603+
IL
1604+
================================================
1605+
1: nil
1606+
2: nil
1607+
3: nil
1608+
4: nil
1609+
5:
16081610
{
16091611
Kickoff Method: 0x06000001 (MethodDef)
16101612
Locals: 0x11000001 (StandAloneSig)
@@ -1615,12 +1617,11 @@ public class C
16151617
IL_0030: <hidden>
16161618
IL_0037: (5, 44) - (5, 45)
16171619
}
1618-
6: nil
1619-
7: nil
1620-
8: nil
1621-
9: nil
1622-
a: nil
1623-
",
1620+
6: nil
1621+
7: nil
1622+
8: nil
1623+
9: nil
1624+
a: nil",
16241625
writer.ToString());
16251626
}
16261627
}

src/Compilers/CSharp/Test/Emit/PDB/PDBSourceLinkTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public static void Main()
154154
debugEntryPoint: null,
155155
sourceLinkStream: new MemoryStream(new byte[] { 1, 2, 3 }),
156156
embeddedTexts: null,
157+
pdbOptionsBlobReader: null,
157158
testData: new CompilationTestData()
158159
{
159160
SymWriterFactory = metadataProvider => new SymUnmanagedWriterWithoutSourceLinkSupport(metadataProvider)

src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ public void SymWriterErrors()
188188
debugEntryPoint: null,
189189
sourceLinkStream: null,
190190
embeddedTexts: null,
191+
pdbOptionsBlobReader: null,
191192
testData: new CompilationTestData() { SymWriterFactory = _ => new MockSymUnmanagedWriter() });
192193

193194
result.Diagnostics.Verify(
@@ -219,6 +220,7 @@ public void SymWriterErrors2()
219220
debugEntryPoint: null,
220221
sourceLinkStream: null,
221222
embeddedTexts: null,
223+
pdbOptionsBlobReader: null,
222224
testData: new CompilationTestData() { SymWriterFactory = SymWriterTestUtilities.ThrowingFactory });
223225

224226
result.Diagnostics.Verify(
@@ -250,6 +252,7 @@ public void SymWriterErrors3()
250252
debugEntryPoint: null,
251253
sourceLinkStream: null,
252254
embeddedTexts: null,
255+
pdbOptionsBlobReader: null,
253256
testData: new CompilationTestData() { SymWriterFactory = SymWriterTestUtilities.ThrowingFactory });
254257

255258
result.Diagnostics.Verify(
@@ -281,6 +284,7 @@ public void SymWriterErrors4()
281284
debugEntryPoint: null,
282285
sourceLinkStream: null,
283286
embeddedTexts: null,
287+
pdbOptionsBlobReader: null,
284288
testData: new CompilationTestData() { SymWriterFactory = _ => throw new DllNotFoundException("xxx") });
285289

286290
result.Diagnostics.Verify(

src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,7 @@ private void CompileAndEmit(
12661266
peStreamProvider,
12671267
refPeStreamProviderOpt,
12681268
pdbStreamProviderOpt,
1269+
pdbOptionsBlobReader: null,
12691270
testSymWriterFactory: null,
12701271
diagnostics: diagnostics,
12711272
emitOptions: emitOptions,

0 commit comments

Comments
 (0)