Browse Source

Extract constants

net11
Christoph Wille 2 weeks ago
parent
commit
6ab2e2b60e
  1. 2
      ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs
  2. 16
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

2
ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
CompilerOptions.UseRoslyn1_3_2 => ("1.3.2", "14", null),
CompilerOptions.UseRoslyn2_10_0 => ("2.10.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v2.2"),
CompilerOptions.UseRoslyn3_11_0 => ("3.11.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v5.0"),
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : ".NETCoreApp,Version=v10.0")
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : CurrentNetCoreAppVersion)
};
var vbcPath = roslynToolset.GetVBCompiler(roslynVersion);

16
ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

@ -93,6 +93,10 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -93,6 +93,10 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
public static partial class Tester
{
public const string CurrentNetCoreVersion = "11.0";
public const string CurrentNetCoreAppVersion = ".NETCoreApp,Version=v11.0";
public const string CurrentNetCoreRefAsmVersion = "11.0.0-preview.2.26159.112";
public static readonly string TesterPath;
public static readonly string TestCasePath;
@ -108,9 +112,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -108,9 +112,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
TesterPath = Path.GetDirectoryName(typeof(Tester).Assembly.Location);
TestCasePath = Path.Combine(TesterPath, "../../../../TestCases");
#if DEBUG
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Debug/net11.0");
testRunnerBasePath = Path.Combine(TesterPath, $"../../../../../ICSharpCode.Decompiler.TestRunner/bin/Debug/net{CurrentNetCoreVersion}");
#else
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net11.0");
testRunnerBasePath = Path.Combine(TesterPath, $"../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net{CurrentNetCoreVersion});
#endif
// To parse: <Project><ItemGroup><PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0-3.final" />
packagesPropsFile = Path.Combine(TesterPath, "../../../../../Directory.Packages.props");
@ -136,7 +140,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -136,7 +140,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
await vswhereToolset.Fetch().ConfigureAwait(false);
await RefAssembliesToolset.Fetch("5.0.0", sourcePath: "ref/net5.0").ConfigureAwait(false);
await RefAssembliesToolset.Fetch("10.0.0", sourcePath: "ref/net10.0").ConfigureAwait(false);
await RefAssembliesToolset.Fetch("11.0.0-preview.2.26159.112", sourcePath: "ref/net11.0").ConfigureAwait(false);
await RefAssembliesToolset.Fetch(CurrentNetCoreRefAsmVersion, sourcePath: $"ref/net{CurrentNetCoreVersion}").ConfigureAwait(false);
#if DEBUG
await BuildTestRunner("win-x86", "Debug").ConfigureAwait(false);
@ -342,7 +346,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -342,7 +346,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
};
static readonly Dictionary<string, Lazy<string>> targetFrameworkAttributeSnippetFiles = new() {
{ ".NETCoreApp,Version=v11.0", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v11.0")) },
{ CurrentNetCoreAppVersion, new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(CurrentNetCoreAppVersion)) },
{ ".NETCoreApp,Version=v5.0", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v5.0")) },
{ ".NETCoreApp,Version=v2.2", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v2.2")) },
};
@ -524,7 +528,7 @@ namespace System.Runtime.CompilerServices @@ -524,7 +528,7 @@ namespace System.Runtime.CompilerServices
CompilerOptions.UseRoslyn1_3_2 => ("1.3.2", "6", null),
CompilerOptions.UseRoslyn2_10_0 => ("2.10.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v2.2"),
CompilerOptions.UseRoslyn3_11_0 => ("3.11.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v5.0"),
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : ".NETCoreApp,Version=v11.0")
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : CurrentNetCoreAppVersion)
};
var cscPath = roslynToolset.GetCSharpCompiler(roslynVersion);
@ -774,7 +778,7 @@ namespace System.Runtime.CompilerServices @@ -774,7 +778,7 @@ namespace System.Runtime.CompilerServices
}
var compilation = CSharpCompilation.Create(Path.GetFileNameWithoutExtension(assemblyName),
syntaxTrees, coreDefaultReferences.Select(r => MetadataReference.CreateFromFile(Path.Combine(RefAssembliesToolset.GetPath(".NETCoreApp,Version=v11.0"), r))),
syntaxTrees, coreDefaultReferences.Select(r => MetadataReference.CreateFromFile(Path.Combine(RefAssembliesToolset.GetPath(CurrentNetCoreAppVersion), r))),
new CSharpCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
platform: Platform.AnyCpu,

Loading…
Cancel
Save