ApiSolutionGenerator.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace GodotTools.ProjectEditor
  4. {
  5. public static class ApiSolutionGenerator
  6. {
  7. public static void GenerateApiSolution(string solutionDir,
  8. string coreProjDir, IEnumerable<string> coreCompileItems,
  9. string editorProjDir, IEnumerable<string> editorCompileItems)
  10. {
  11. var solution = new DotNetSolution(ApiAssemblyNames.SolutionName);
  12. solution.DirectoryPath = solutionDir;
  13. // GodotSharp project
  14. const string coreApiAssemblyName = ApiAssemblyNames.Core;
  15. string coreGuid = ProjectGenerator.GenCoreApiProject(coreProjDir, coreCompileItems);
  16. var coreProjInfo = new DotNetSolution.ProjectInfo
  17. {
  18. Guid = coreGuid,
  19. PathRelativeToSolution = Path.Combine(coreApiAssemblyName, $"{coreApiAssemblyName}.csproj")
  20. };
  21. coreProjInfo.Configs.Add("Debug");
  22. coreProjInfo.Configs.Add("Release");
  23. solution.AddNewProject(coreApiAssemblyName, coreProjInfo);
  24. // GodotSharpEditor project
  25. const string editorApiAssemblyName = ApiAssemblyNames.Editor;
  26. string editorGuid = ProjectGenerator.GenEditorApiProject(editorProjDir,
  27. $"../{coreApiAssemblyName}/{coreApiAssemblyName}.csproj", editorCompileItems);
  28. var editorProjInfo = new DotNetSolution.ProjectInfo();
  29. editorProjInfo.Guid = editorGuid;
  30. editorProjInfo.PathRelativeToSolution = Path.Combine(editorApiAssemblyName, $"{editorApiAssemblyName}.csproj");
  31. editorProjInfo.Configs.Add("Debug");
  32. editorProjInfo.Configs.Add("Release");
  33. solution.AddNewProject(editorApiAssemblyName, editorProjInfo);
  34. // Save solution
  35. solution.Save();
  36. }
  37. }
  38. }