reorder solution configurations + migration
This commit is contained in:
parent
98cdf50a55
commit
ce01b83c4a
3 changed files with 34 additions and 15 deletions
|
@ -1,6 +1,8 @@
|
|||
using GodotTools.Core;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace GodotTools.ProjectEditor
|
||||
{
|
||||
|
@ -118,5 +120,25 @@ EndProject";
|
|||
const string ProjectPlatformsConfig =
|
||||
@" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU
|
||||
{{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU";
|
||||
|
||||
public static void FixConfigurations(string slnPath)
|
||||
{
|
||||
if (!File.Exists(slnPath))
|
||||
return;
|
||||
|
||||
var input = File.ReadAllText(slnPath);
|
||||
var dict = new Dictionary<string, string>
|
||||
{
|
||||
{"Debug|Any CPU", "Tools|Any CPU"},
|
||||
{"Release|Any CPU", "ExportDebug|Any CPU"},
|
||||
{"Tools|Any CPU", "ExportRelease|Any CPU"}
|
||||
};
|
||||
|
||||
var regex = new Regex(string.Join("|",dict.Keys.Select(Regex.Escape)));
|
||||
var result = regex.Replace(input,m => dict[m.Value]);
|
||||
|
||||
if (result != input)
|
||||
File.WriteAllText(slnPath, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,18 +32,6 @@ namespace GodotTools
|
|||
ProjectUtils.AddItemToProjectChecked(projectPath, itemType, include);
|
||||
}
|
||||
|
||||
public static void FixApiHintPath(string projectPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
ProjectUtils.FixApiHintPath(projectPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GD.PushError(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
private static ulong ConvertToTimestamp(this DateTime value)
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace GodotTools
|
|||
{
|
||||
Guid = guid,
|
||||
PathRelativeToSolution = name + ".csproj",
|
||||
Configs = new List<string> { "Debug", "Release", "Tools" }
|
||||
Configs = new List<string> { "Tools", "ExportDebug", "ExportRelease" }
|
||||
};
|
||||
|
||||
solution.AddNewProject(name, projectInfo);
|
||||
|
@ -400,9 +400,18 @@ namespace GodotTools
|
|||
}
|
||||
|
||||
if (File.Exists(GodotSharpDirs.ProjectSlnPath) && File.Exists(GodotSharpDirs.ProjectCsProjPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure the existing project has Api assembly references configured correctly
|
||||
CsProjOperations.FixApiHintPath(GodotSharpDirs.ProjectCsProjPath);
|
||||
ProjectUtils.FixApiHintPath(GodotSharpDirs.ProjectCsProjPath);
|
||||
// Make sure SolutionConfigurations are Tool, ExportDebug and ExportRelease
|
||||
DotNetSolution.FixConfigurations(GodotSharpDirs.ProjectSlnPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GD.PushError(e.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue