Skip to content

Commit

Permalink
Rebuild Microsoft.CodeAnalysis
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson committed Feb 9, 2021
1 parent 0b2b376 commit dbc5eba
Show file tree
Hide file tree
Showing 36 changed files with 773 additions and 448 deletions.
8 changes: 5 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
"name": "Launch BuildValidator.dll",
"type": "coreclr",
"request": "launch",
// "preLaunchTask": "build",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/artifacts/bin/BuildValidator/Debug/netcoreapp3.1/BuildValidator.dll",
"args": [
"/verbose"
"--assembliesPath", "./artifacts/obj/RunTests",
"--debugPath", "./artifacts/BuildValidator",
"--sourcePath", "."
],
"cwd": "${workspaceFolder}/artifacts/bin/BuildValidator",
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole"
},
Expand Down
35 changes: 35 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,38 @@ jobs:
continueOnError: true
condition: not(succeeded())

- job: Correctness_Rebuild
pool:
vmImage: windows-2019
timeoutInMinutes: 90
steps:
- template: eng/pipelines/checkout-windows-task.yml

- task: PowerShell@2
displayName: Restore
inputs:
filePath: eng/build.ps1
arguments: -configuration Debug -prepareMachine -ci -restore -binaryLog

- task: PowerShell@2
displayName: Build
inputs:
filePath: eng/build.ps1
arguments: -configuration Debug -prepareMachine -ci -build -bootstrap -publish -binaryLog -skipDocumentation

- script: .\artifacts\bin\BuildValidator\Debug\net472\BuildValidator.exe --assembliesPath .\artifacts\obj\Microsoft.CodeAnalysis --debugPath .\artifacts\BuildValidator --sourcePath .
displayName: Run BuildValidator

- task: PublishBuildArtifacts@1
displayName: Publish BuildValidator debug outputs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/BuildValidator'
ArtifactName: 'BuildValidator_DebugOut'
publishLocation: Container
continueOnError: true
condition: failed()

- template: eng/pipelines/publish-logs.yml
parameters:
jobName: Correctness_Rebuild
configuration: Debug
3 changes: 2 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<MicrosoftIdentityModelClientsActiveDirectoryVersion>3.13.8</MicrosoftIdentityModelClientsActiveDirectoryVersion>
<MicrosoftInternalPerformanceCodeMarkersDesignTimeVersion>15.8.27812-alpha</MicrosoftInternalPerformanceCodeMarkersDesignTimeVersion>
<MicrosoftInternalVisualStudioShellInterop140DesignTimeVersion>14.3.25407-alpha</MicrosoftInternalVisualStudioShellInterop140DesignTimeVersion>
<MicrosoftMetadataVisualizerVersion>1.0.0-beta3.20174.1</MicrosoftMetadataVisualizerVersion>
<MicrosoftMetadataVisualizerVersion>1.0.0-beta3.21075.2</MicrosoftMetadataVisualizerVersion>
<MicrosoftMSXMLVersion>8.0.0</MicrosoftMSXMLVersion>
<MicrosoftNETBuildExtensionsVersion>2.2.101</MicrosoftNETBuildExtensionsVersion>
<MicrosoftNETCorePlatformsVersion>2.1.2</MicrosoftNETCorePlatformsVersion>
Expand Down Expand Up @@ -205,6 +205,7 @@
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
<SystemCompositionVersion>1.0.31</SystemCompositionVersion>
<SystemCodeDomVersion>4.7.0</SystemCodeDomVersion>
<SystemCommandLineVersion>2.0.0-beta1.20574.7</SystemCommandLineVersion>
<SystemCommandLineExperimentalVersion>0.3.0-alpha.19577.1</SystemCommandLineExperimentalVersion>
<SystemComponentModelCompositionVersion>4.5.0</SystemComponentModelCompositionVersion>
<SystemDrawingCommonVersion>4.5.0</SystemDrawingCommonVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/build-utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ function Make-BootstrapBuild([switch]$force32 = $false) {

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
$packageFile = Get-ChildItem -Path $dir -Filter "$packageName.*.nupkg"
Unzip "$dir\$packageFile" $dir
Unzip (Join-Path $dir $packageFile) $dir

Write-Host "Cleaning Bootstrap compiler artifacts"
Run-MSBuild $projectPath "/t:Clean" -logFileName "BootstrapClean"
Expand Down
2 changes: 1 addition & 1 deletion eng/targets/Services.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.SymbolFinder" ClassName="Microsoft.CodeAnalysis.Remote.RemoteSymbolFinderService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.FindUsages" ClassName="Microsoft.CodeAnalysis.Remote.RemoteFindUsagesService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.NavigateToSearch" ClassName="Microsoft.CodeAnalysis.Remote.RemoteNavigateToSearchService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.NavigationBarItem" ClassName="Microsoft.CodeAnalysis.Remote.RemoteNavigationBarItemService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.NavigationBar" ClassName="Microsoft.CodeAnalysis.Remote.RemoteNavigationBarItemService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.MissingImportDiscovery" ClassName="Microsoft.CodeAnalysis.Remote.RemoteMissingImportDiscoveryService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.ExtensionMethodImportCompletion" ClassName="Microsoft.CodeAnalysis.Remote.RemoteExtensionMethodImportCompletionService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.DependentTypeFinder" ClassName="Microsoft.CodeAnalysis.Remote.RemoteDependentTypeFinderService+Factory" IsBrokered="true" />
Expand Down
41 changes: 41 additions & 0 deletions eng/test-rebuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<#
This script tests that Roslyn artifacts are rebuildable--i.e. that the source code and resources can be identified
#>

[CmdletBinding(PositionalBinding=$false)]
param(
[string]$configuration = "Debug",
[switch]$ci = $false,
[switch]$help)

Set-StrictMode -version 2.0
$ErrorActionPreference="Stop"

function Print-Usage() {
Write-Host "Usage: test-rebuild.ps1"
Write-Host " -configuration Build configuration ('Debug' or 'Release')"
}

try {
if ($help) {
Print-Usage
exit 0
}

. (Join-Path $PSScriptRoot "build-utils.ps1")
Push-Location $RepoRoot

Write-Host "Building Roslyn"
Exec-Block { & (Join-Path $PSScriptRoot "build.ps1") -restore -build -ci:$ci -runAnalyzers:$true -configuration:$configuration -pack -binaryLog -useGlobalNuGetCache:$false -warnAsError:$true}
& "artifacts\bin\BuildValidator\$configuration\net472\BuildValidator.exe" --assembliesPath "$ArtifactsDir/obj/Microsoft.CodeAnalysis"

exit 0
}
catch [exception] {
Write-Host $_
Write-Host $_.Exception
exit 1
}
finally {
Pop-Location
}
12 changes: 7 additions & 5 deletions src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2016,11 +2016,13 @@ async partial void M() {}

AssertEx.AssertEqualToleratingWhitespaceDifferences(@"
MethodDebugInformation (index: 0x31, size: 20):
==================================================
1: nil
2: nil
3: nil
4:
================================================
IL
================================================
1: nil
2: nil
3: nil
4:
{
Kickoff Method: 0x06000001 (MethodDef)
Locals: 0x11000002 (StandAloneSig)
Expand Down
25 changes: 13 additions & 12 deletions src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1599,12 +1599,14 @@ public class C

AssertEx.AssertEqualToleratingWhitespaceDifferences(@"
MethodDebugInformation (index: 0x31, size: 40):
==================================================
1: nil
2: nil
3: nil
4: nil
5:
================================================
IL
================================================
1: nil
2: nil
3: nil
4: nil
5:
{
Kickoff Method: 0x06000001 (MethodDef)
Locals: 0x11000001 (StandAloneSig)
Expand All @@ -1615,12 +1617,11 @@ public class C
IL_0030: <hidden>
IL_0037: (5, 44) - (5, 45)
}
6: nil
7: nil
8: nil
9: nil
a: nil
",
6: nil
7: nil
8: nil
9: nil
a: nil",
writer.ToString());
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Compilers/CSharp/Test/Emit/PDB/PDBSourceLinkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public static void Main()
debugEntryPoint: null,
sourceLinkStream: new MemoryStream(new byte[] { 1, 2, 3 }),
embeddedTexts: null,
pdbOptionsBlobReader: null,
testData: new CompilationTestData()
{
SymWriterFactory = metadataProvider => new SymUnmanagedWriterWithoutSourceLinkSupport(metadataProvider)
Expand Down
4 changes: 4 additions & 0 deletions src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public void SymWriterErrors()
debugEntryPoint: null,
sourceLinkStream: null,
embeddedTexts: null,
pdbOptionsBlobReader: null,
testData: new CompilationTestData() { SymWriterFactory = _ => new MockSymUnmanagedWriter() });

result.Diagnostics.Verify(
Expand Down Expand Up @@ -219,6 +220,7 @@ public void SymWriterErrors2()
debugEntryPoint: null,
sourceLinkStream: null,
embeddedTexts: null,
pdbOptionsBlobReader: null,
testData: new CompilationTestData() { SymWriterFactory = SymWriterTestUtilities.ThrowingFactory });

result.Diagnostics.Verify(
Expand Down Expand Up @@ -250,6 +252,7 @@ public void SymWriterErrors3()
debugEntryPoint: null,
sourceLinkStream: null,
embeddedTexts: null,
pdbOptionsBlobReader: null,
testData: new CompilationTestData() { SymWriterFactory = SymWriterTestUtilities.ThrowingFactory });

result.Diagnostics.Verify(
Expand Down Expand Up @@ -281,6 +284,7 @@ public void SymWriterErrors4()
debugEntryPoint: null,
sourceLinkStream: null,
embeddedTexts: null,
pdbOptionsBlobReader: null,
testData: new CompilationTestData() { SymWriterFactory = _ => throw new DllNotFoundException("xxx") });

result.Diagnostics.Verify(
Expand Down
1 change: 1 addition & 0 deletions src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,7 @@ private void CompileAndEmit(
peStreamProvider,
refPeStreamProviderOpt,
pdbStreamProviderOpt,
pdbOptionsBlobReader: null,
testSymWriterFactory: null,
diagnostics: diagnostics,
emitOptions: emitOptions,
Expand Down
38 changes: 38 additions & 0 deletions src/Compilers/Core/Portable/Compilation/Compilation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,35 @@ public EmitResult Emit(
IEnumerable<EmbeddedText>? embeddedTexts = null,
Stream? metadataPEStream = null,
CancellationToken cancellationToken = default(CancellationToken))
{
return Emit(
peStream,
pdbStream,
xmlDocumentationStream,
win32Resources,
manifestResources,
options,
debugEntryPoint,
sourceLinkStream,
embeddedTexts,
metadataPEStream,
pdbOptionsBlobReader: null,
cancellationToken);
}

internal EmitResult Emit(
Stream peStream,
Stream? pdbStream,
Stream? xmlDocumentationStream,
Stream? win32Resources,
IEnumerable<ResourceDescription>? manifestResources,
EmitOptions? options,
IMethodSymbol? debugEntryPoint,
Stream? sourceLinkStream,
IEnumerable<EmbeddedText>? embeddedTexts,
Stream? metadataPEStream,
BlobReader? pdbOptionsBlobReader,
CancellationToken cancellationToken)
{
if (peStream == null)
{
Expand Down Expand Up @@ -2535,6 +2564,7 @@ public EmitResult Emit(
debugEntryPoint,
sourceLinkStream,
embeddedTexts,
pdbOptionsBlobReader,
testData: null,
cancellationToken: cancellationToken);
}
Expand All @@ -2554,6 +2584,7 @@ internal EmitResult Emit(
IMethodSymbol? debugEntryPoint,
Stream? sourceLinkStream,
IEnumerable<EmbeddedText>? embeddedTexts,
BlobReader? pdbOptionsBlobReader,
CompilationTestData? testData,
CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -2634,6 +2665,7 @@ internal EmitResult Emit(
new SimpleEmitStreamProvider(peStream),
(metadataPEStream != null) ? new SimpleEmitStreamProvider(metadataPEStream) : null,
(pdbStream != null) ? new SimpleEmitStreamProvider(pdbStream) : null,
pdbOptionsBlobReader,
testData?.SymWriterFactory,
diagnostics,
emitOptions: options,
Expand Down Expand Up @@ -2795,6 +2827,7 @@ internal bool SerializeToPeStream(
EmitStreamProvider peStreamProvider,
EmitStreamProvider? metadataPEStreamProvider,
EmitStreamProvider? pdbStreamProvider,
BlobReader? pdbOptionsBlobReader,
Func<ISymWriterMetadataProvider, SymUnmanagedWriter>? testSymWriterFactory,
DiagnosticBag diagnostics,
EmitOptions emitOptions,
Expand Down Expand Up @@ -2868,6 +2901,7 @@ internal bool SerializeToPeStream(
getPortablePdbStream,
nativePdbWriter,
pePdbFilePath,
pdbOptionsBlobReader,
emitOptions.EmitMetadataOnly,
emitOptions.IncludePrivateMembers,
deterministic,
Expand Down Expand Up @@ -2949,6 +2983,7 @@ internal static bool SerializePeToStream(
Func<Stream?>? getPortablePdbStreamOpt,
Cci.PdbWriter? nativePdbWriterOpt,
string? pdbPathOpt,
BlobReader? pdbOptionsBlobReader,
bool metadataOnly,
bool includePrivateMembers,
bool isDeterministic,
Expand All @@ -2966,6 +3001,7 @@ internal static bool SerializePeToStream(
getPeStream,
getPortablePdbStreamOpt,
nativePdbWriterOpt,
pdbOptionsBlobReader,
pdbPathOpt,
metadataOnly,
deterministicPrimaryOutput,
Expand All @@ -2988,6 +3024,7 @@ internal static bool SerializePeToStream(
getMetadataPeStreamOpt,
getPortablePdbStreamOpt: null,
nativePdbWriterOpt: null,
pdbOptionsBlobReader: null,
pdbPathOpt: null,
metadataOnly: true,
isDeterministic: true,
Expand Down Expand Up @@ -3043,6 +3080,7 @@ internal static bool SerializePeToStream(
metadataStream,
ilStream,
(nativePdbWriterOpt == null) ? pdbStream : null,
pdbOptionsBlobReader: null,
out MetadataSizes metadataSizes);

writer.GetMethodTokens(updatedMethods);
Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/Core/Portable/Compilation/CompilationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public abstract class CompilationOptions
/// <summary>
/// Emit mode that favors debuggability.
/// </summary>
public bool DebugPlusMode { get; set; }
internal bool DebugPlusMode { get; set; }

/// <summary>
/// Specifies whether to import members with accessibility other than public or protected by default.
Expand Down Expand Up @@ -262,7 +262,7 @@ protected set
private readonly Lazy<ImmutableArray<Diagnostic>> _lazyErrors;

// Expects correct arguments.
public CompilationOptions(
internal CompilationOptions(
OutputKind outputKind,
bool reportSuppressedDiagnostics,
string? moduleName,
Expand Down
4 changes: 3 additions & 1 deletion src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<NoStdLib>true</NoStdLib>
<ApplyNgenOptimization Condition="'$(TargetFramework)' == 'netstandard2.0'">partial</ApplyNgenOptimization>
<GeneratePerformanceSensitiveAttribute>true</GeneratePerformanceSensitiveAttribute>

<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- NuGet -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.CodeAnalysis.Common</PackageId>
Expand Down Expand Up @@ -51,6 +52,7 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler" />
<InternalsVisibleTo Include="csc" />
<InternalsVisibleTo Include="csi" />
<InternalsVisibleTo Include="BuildValidator" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Scripting" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.Scripting" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.Scripting" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ internal static class CompilationOptionNames
public const string Nullable = "nullable";
public const string Define = "define";
public const string Strict = "strict";
public const string SourceFiles = "source-files";
public const string SourceFileCount = "source-file-count";
}
}
Loading

0 comments on commit dbc5eba

Please sign in to comment.