Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test reference assemblies forward #73266

Merged
merged 9 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@
"problemMatcher": "$msCompile",
"group": "build"
},
{
"label": "build Roslyn.sln",
jaredpar marked this conversation as resolved.
Show resolved Hide resolved
"command": "dotnet",
"type": "shell",
"args": [
"build",
"-p:RunAnalyzersDuringBuild=false",
"-p:GenerateFullPaths=true",
"Roslyn.sln"
],
"problemMatcher": "$msCompile",
"group": "build"
},
{
"label": "build current project",
"type": "shell",
Expand Down
12 changes: 6 additions & 6 deletions eng/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@
<PackageVersion Include="runtime.linux-x64.Microsoft.NETCore.ILAsm" Version="$(ILAsmPackageVersion)" />
<PackageVersion Include="runtime.osx-x64.Microsoft.NETCore.ILAsm" Version="$(ILAsmPackageVersion)" />
<PackageVersion Include="Basic.CompilerLog.Util" Version="0.6.1" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="1.2.4" />
<PackageVersion Include="Basic.Reference.Assemblies.Net50" Version="1.2.4" />
<PackageVersion Include="Basic.Reference.Assemblies.Net60" Version="1.2.4" />
<PackageVersion Include="Basic.Reference.Assemblies.Net70" Version="1.3.0" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net50" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net60" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net70" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.4.5" />
<PackageVersion Include="Basic.Reference.Assemblies.Net461" Version="1.3.0" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard13" Version="1.2.4" />
<PackageVersion Include="Basic.Reference.Assemblies.Net461" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard13" Version="1.6.0" />
<PackageVersion Include="Microsoft.TeamFoundationServer.Client" Version="19.232.0-preview" />
<!--
Microsoft.TeamFoundationServer.Client is referencing System.Data.SqlClient causing CG alert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ string getSdkDirectory(TempRoot temp)
if (ExecutionConditionUtil.IsCoreClr)
{
var dir = temp.CreateDirectory();
File.WriteAllBytes(Path.Combine(dir.Path, "mscorlib.dll"), Net461.References.mscorlib.ImageBytes);
File.WriteAllBytes(Path.Combine(dir.Path, "mscorlib.dll"), Net461.ReferenceInfos.mscorlib.ImageBytes);
return dir.Path;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11986,7 +11986,7 @@ public sealed class DiagnosticDescriptor
var minSystemCollectionsImmutableImage = CSharpCompilation.Create(
"System.Collections.Immutable",
new[] { SyntaxFactory.ParseSyntaxTree(minSystemCollectionsImmutableSource) },
new MetadataReference[] { NetStandard13.SystemRuntime },
new MetadataReference[] { NetStandard13.References.SystemRuntime },
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, cryptoPublicKey: TestResources.TestKeys.PublicKey_b03f5f7f11d50a3a)).EmitToArray();

var minSystemCollectionsImmutableRef = MetadataReference.CreateFromImage(minSystemCollectionsImmutableImage);
Expand All @@ -11996,7 +11996,7 @@ public sealed class DiagnosticDescriptor
new[] { SyntaxFactory.ParseSyntaxTree(minCodeAnalysisSource) },
new MetadataReference[]
{
NetStandard13.SystemRuntime,
NetStandard13.References.SystemRuntime,
minSystemCollectionsImmutableRef
},
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, cryptoPublicKey: TestResources.TestKeys.PublicKey_31bf3856ad364e35)).EmitToArray();
Expand Down Expand Up @@ -12087,7 +12087,7 @@ public override void Initialize(AnalysisContext context)
minCodeAnalysisRef,
minSystemCollectionsImmutableRef
};
references = references.Concat(NetStandard13.All).ToArray();
references = references.Concat(NetStandard13.References.All).ToArray();

var analyzerImage = CSharpCompilation.Create(
analyzerAssemblyName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49419,7 +49419,7 @@ static explicit operator byte(I1 x)
public void RuntimeFeature_01()
{
var compilation1 = CreateCompilation("", options: TestOptions.DebugDll,
references: new[] { Net461.mscorlib },
references: new[] { Net461.References.mscorlib },
targetFramework: TargetFramework.Empty);

Assert.False(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation);
Expand All @@ -49430,7 +49430,7 @@ public void RuntimeFeature_01()
public void RuntimeFeature_02()
{
var compilation1 = CreateCompilation("", options: TestOptions.DebugDll,
references: new[] { Net70.SystemRuntime },
references: new[] { Net70.References.SystemRuntime },
targetFramework: TargetFramework.Empty);

Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation);
Expand Down Expand Up @@ -49730,7 +49730,7 @@ public static class RuntimeFeature
";

var compilation1 = CreateCompilation(source, options: TestOptions.DebugDll,
references: new[] { Net461.mscorlib },
references: new[] { Net461.References.mscorlib },
targetFramework: TargetFramework.Empty);

Assert.False(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public class TestAnalyzer : DiagnosticAnalyzer
new SyntaxTree[] { CSharp.SyntaxFactory.ParseSyntaxTree(analyzerSource) },
new MetadataReference[]
{
NetStandard20.mscorlib,
NetStandard20.netstandard,
NetStandard20.SystemRuntime,
NetStandard20.References.mscorlib,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: was looking at the code structure in the basic-reference-assemblies repo (for example), consider putting some xml doc comments on References and ReferenceInfos.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looking at that code isn't going to be particularly useful. It's 99% just generated code.

XML docs are a good idea though. Will add those

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jaredpar/basic-reference-assemblies@5eeecbf

Those docs will show up next upgrade of these packages

NetStandard20.References.netstandard,
NetStandard20.References.SystemRuntime,
MetadataReference.CreateFromFile(immutable.Path),
MetadataReference.CreateFromFile(analyzer.Path)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private TempFile CreateNetStandardDll(TempDirectory directory, string assemblyNa
var comp = CSharpCompilation.Create(
assemblyName,
sources,
references: NetStandard20.All,
references: NetStandard20.References.All,
options: options);

var file = directory.CreateFile($"{assemblyName}.dll");
Expand Down Expand Up @@ -112,7 +112,7 @@ public void DifferingMvidsDifferentDirectory()
var directory = Temp.CreateDirectory();
var assemblyLoader = DefaultAnalyzerAssemblyLoader.CreateNonLockingLoader(directory.CreateDirectory("shadow").Path);

var key = NetStandard20.netstandard.GetAssemblyIdentity().PublicKey;
var key = NetStandard20.References.netstandard.GetAssemblyIdentity().PublicKey;
var mvidAlpha1 = CreateNetStandardDll(directory.CreateDirectory("mvid1"), "MvidAlpha", "1.0.0.0", key, "class C { }");
var mvidAlpha2 = CreateNetStandardDll(directory.CreateDirectory("mvid2"), "MvidAlpha", "1.0.0.0", key, "class D { }");

Expand All @@ -137,7 +137,7 @@ public void DifferingMvidsSameDirectory()
var directory = Temp.CreateDirectory();
var assemblyLoader = DefaultAnalyzerAssemblyLoader.CreateNonLockingLoader(directory.CreateDirectory("shadow").Path);

var key = NetStandard20.netstandard.GetAssemblyIdentity().PublicKey;
var key = NetStandard20.References.netstandard.GetAssemblyIdentity().PublicKey;
var mvidAlpha1 = CreateNetStandardDll(directory, "MvidAlpha", "1.0.0.0", key, "class C { }");

var result = AnalyzerConsistencyChecker.Check(
Expand Down Expand Up @@ -168,7 +168,7 @@ public void DifferingMvidsSameDirectory()
public void LoadingLibraryFromCompiler()
{
var directory = Temp.CreateDirectory();
_ = CreateNetStandardDll(directory, "System.Memory", "2.0.0.0", NetStandard20.netstandard.GetAssemblyIdentity().PublicKey);
_ = CreateNetStandardDll(directory, "System.Memory", "2.0.0.0", NetStandard20.References.netstandard.GetAssemblyIdentity().PublicKey);

// This test must use the DefaultAnalyzerAssemblyLoader as we want assembly binding redirects
// to take affect here.
Expand Down Expand Up @@ -226,7 +226,7 @@ public void AssemblyLoadException()
public void LoadingSimpleLibrary()
{
var directory = Temp.CreateDirectory();
var key = NetStandard20.netstandard.GetAssemblyIdentity().PublicKey;
var key = NetStandard20.References.netstandard.GetAssemblyIdentity().PublicKey;
var compFile = CreateNetStandardDll(directory, "netstandardRef", "1.0.0.0", key);

var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(compFile.Path));
Expand Down
6 changes: 3 additions & 3 deletions src/Compilers/Test/Core/AssemblyLoadTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,9 @@ private static string GenerateDll(string assemblyName, TempDirectory directory,
syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(SourceText.From(csSource, encoding: null, SourceHashAlgorithms.Default)) },
references: (new MetadataReference[]
{
NetStandard20.mscorlib,
NetStandard20.netstandard,
NetStandard20.SystemRuntime
NetStandard20.References.mscorlib,
NetStandard20.References.netstandard,
NetStandard20.References.SystemRuntime
}).Concat(additionalReferences),
options: options);

Expand Down
6 changes: 3 additions & 3 deletions src/Compilers/Test/Core/Platform/Desktop/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public class TestAnalyzer : DiagnosticAnalyzer
new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(SourceText.From(analyzerSource, encoding: null, SourceHashAlgorithms.Default)) },
new MetadataReference[]
{
NetStandard20.mscorlib,
NetStandard20.netstandard,
NetStandard20.SystemRuntime,
NetStandard20.References.mscorlib,
NetStandard20.References.netstandard,
NetStandard20.References.SystemRuntime,
MetadataReference.CreateFromFile(immutable.Path),
MetadataReference.CreateFromFile(analyzer.Path)
},
Expand Down
Loading