godot/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ApiSolutionGenerator.cs
Ignacio Etcheverry 270af6fa08 Re-write mono module editor code in C#
Make the build system automatically build the C# Api assemblies to be shipped with the editor.
Make the editor, editor player and debug export templates use Api assemblies built with debug symbols.
Always run MSBuild to build the editor tools and Api assemblies when building Godot.
Several bugs fixed related to assembly hot reloading and restoring state.
Fix StringExtensions internal calls not being registered correctly, resulting in MissingMethodException.
2019-07-05 09:38:23 +02:00

53 lines
1.8 KiB
C#

using System.Collections.Generic;
using System.IO;
namespace GodotTools.ProjectEditor
{
public static class ApiSolutionGenerator
{
public static void GenerateApiSolution(string solutionDir,
string coreProjDir, IEnumerable<string> coreCompileItems,
string editorProjDir, IEnumerable<string> editorCompileItems)
{
var solution = new DotNetSolution(ApiAssemblyNames.SolutionName);
solution.DirectoryPath = solutionDir;
// GodotSharp project
const string coreApiAssemblyName = ApiAssemblyNames.Core;
string coreGuid = ProjectGenerator.GenCoreApiProject(coreProjDir, coreCompileItems);
var coreProjInfo = new DotNetSolution.ProjectInfo
{
Guid = coreGuid,
PathRelativeToSolution = Path.Combine(coreApiAssemblyName, $"{coreApiAssemblyName}.csproj")
};
coreProjInfo.Configs.Add("Debug");
coreProjInfo.Configs.Add("Release");
solution.AddNewProject(coreApiAssemblyName, coreProjInfo);
// GodotSharpEditor project
const string editorApiAssemblyName = ApiAssemblyNames.Editor;
string editorGuid = ProjectGenerator.GenEditorApiProject(editorProjDir,
$"../{coreApiAssemblyName}/{coreApiAssemblyName}.csproj", editorCompileItems);
var editorProjInfo = new DotNetSolution.ProjectInfo();
editorProjInfo.Guid = editorGuid;
editorProjInfo.PathRelativeToSolution = Path.Combine(editorApiAssemblyName, $"{editorApiAssemblyName}.csproj");
editorProjInfo.Configs.Add("Debug");
editorProjInfo.Configs.Add("Release");
solution.AddNewProject(editorApiAssemblyName, editorProjInfo);
// Save solution
solution.Save();
}
}
}