Constants.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. using System.IO;
  2. using System.Reflection;
  3. using Microsoft.CodeAnalysis.Testing;
  4. namespace Godot.SourceGenerators.Tests;
  5. public static class Constants
  6. {
  7. public static Assembly GodotSharpAssembly => typeof(GodotObject).Assembly;
  8. // Can't find what needs updating to be able to access ReferenceAssemblies.Net.Net80, so we're making our own one.
  9. public static ReferenceAssemblies Net80 => new ReferenceAssemblies(
  10. "net8.0",
  11. new PackageIdentity("Microsoft.NETCore.App.Ref", "8.0.0"),
  12. Path.Combine("ref", "net8.0")
  13. );
  14. public static string ExecutingAssemblyPath { get; }
  15. public static string SourceFolderPath { get; }
  16. public static string GeneratedSourceFolderPath { get; }
  17. static Constants()
  18. {
  19. ExecutingAssemblyPath = Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location!)!);
  20. var testDataPath = Path.Combine(ExecutingAssemblyPath, "TestData");
  21. SourceFolderPath = Path.Combine(testDataPath, "Sources");
  22. GeneratedSourceFolderPath = Path.Combine(testDataPath, "GeneratedSources");
  23. }
  24. }