diff options
Diffstat (limited to 'modules/mono/editor')
5 files changed, 54 insertions, 70 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs index 1edc426e00..233aab45b3 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs @@ -85,7 +85,7 @@ namespace GodotTools.ProjectEditor void AddPropertyIfNotPresent(string name, string condition, string value) { if (root.PropertyGroups - .Any(g => g.Condition == string.Empty || g.Condition == condition && + .Any(g => (g.Condition == string.Empty || g.Condition == condition) && g.Properties .Any(p => p.Name == name && p.Value == value && diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs index f849356919..d8cb9024c3 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs @@ -137,7 +137,7 @@ namespace GodotTools.Build private static string BuildArguments(string solution, string config, string loggerOutputDir, List<string> customProperties) { - string arguments = $@"""{solution}"" /v:normal /t:Rebuild ""/p:{"Configuration=" + config}"" " + + string arguments = $@"""{solution}"" /v:normal /t:Build ""/p:{"Configuration=" + config}"" " + $@"""/l:{typeof(GodotBuildLogger).FullName},{GodotBuildLogger.AssemblyPath};{loggerOutputDir}"""; foreach (string customProperty in customProperties) diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs index f0068385f4..926aabdf89 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs @@ -15,7 +15,6 @@ namespace GodotTools.Build { private static string _msbuildToolsPath = string.Empty; private static string _msbuildUnixPath = string.Empty; - private static string _xbuildUnixPath = string.Empty; public static string FindMsBuild() { @@ -44,7 +43,6 @@ namespace GodotTools.Build return Path.Combine(_msbuildToolsPath, "MSBuild.exe"); } - case GodotSharpBuilds.BuildTool.MsBuildMono: { string msbuildPath = Path.Combine(Internal.MonoWindowsInstallRoot, "bin", "msbuild.bat"); @@ -56,19 +54,6 @@ namespace GodotTools.Build return msbuildPath; } - - case GodotSharpBuilds.BuildTool.XBuild: - { - string xbuildPath = Path.Combine(Internal.MonoWindowsInstallRoot, "bin", "xbuild.bat"); - - if (!File.Exists(xbuildPath)) - { - throw new FileNotFoundException($"Cannot find executable for '{GodotSharpBuilds.PropNameXbuild}'. Tried with path: {xbuildPath}"); - } - - return xbuildPath; - } - default: throw new IndexOutOfRangeException("Invalid build tool in editor settings"); } @@ -76,20 +61,7 @@ namespace GodotTools.Build if (OS.IsUnix()) { - if (buildTool == GodotSharpBuilds.BuildTool.XBuild) - { - if (_xbuildUnixPath.Empty() || !File.Exists(_xbuildUnixPath)) - { - // Try to search it again if it wasn't found last time or if it was removed from its location - _xbuildUnixPath = FindBuildEngineOnUnix("msbuild"); - } - - if (_xbuildUnixPath.Empty()) - { - throw new FileNotFoundException($"Cannot find binary for '{GodotSharpBuilds.PropNameXbuild}'"); - } - } - else + if (buildTool == GodotSharpBuilds.BuildTool.MsBuildMono) { if (_msbuildUnixPath.Empty() || !File.Exists(_msbuildUnixPath)) { @@ -101,9 +73,13 @@ namespace GodotTools.Build { throw new FileNotFoundException($"Cannot find binary for '{GodotSharpBuilds.PropNameMsbuildMono}'"); } - } - return buildTool != GodotSharpBuilds.BuildTool.XBuild ? _msbuildUnixPath : _xbuildUnixPath; + return _msbuildUnixPath; + } + else + { + throw new IndexOutOfRangeException("Invalid build tool in editor settings"); + } } throw new PlatformNotSupportedException(); diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpBuilds.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpBuilds.cs index a884b0ead0..de3a4d9a6e 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpBuilds.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpBuilds.cs @@ -18,7 +18,6 @@ namespace GodotTools public const string PropNameMsbuildMono = "MSBuild (Mono)"; public const string PropNameMsbuildVs = "MSBuild (VS Build Tools)"; - public const string PropNameXbuild = "xbuild (Deprecated)"; public const string MsBuildIssuesFileName = "msbuild_issues.csv"; public const string MsBuildLogFileName = "msbuild_log.txt"; @@ -26,8 +25,7 @@ namespace GodotTools public enum BuildTool { MsBuildMono, - MsBuildVs, - XBuild // Deprecated + MsBuildVs } private static void RemoveOldIssuesFile(MonoBuildInfo buildInfo) @@ -64,7 +62,7 @@ namespace GodotTools private static string GetIssuesFilePath(MonoBuildInfo buildInfo) { - return Path.Combine(Godot.ProjectSettings.LocalizePath(buildInfo.LogsDirPath), MsBuildIssuesFileName); + return Path.Combine(buildInfo.LogsDirPath, MsBuildIssuesFileName); } private static void PrintVerbose(string text) @@ -202,6 +200,9 @@ namespace GodotTools // case the user decided to delete them at some point after they were loaded. Internal.UpdateApiAssembliesFromPrebuilt(); + var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings(); + var buildTool = (BuildTool)editorSettings.GetSetting("mono/builds/build_tool"); + using (var pr = new EditorProgress("mono_project_debug_build", "Building project solution...", 1)) { pr.Step("Building project solution", 0); @@ -209,7 +210,7 @@ namespace GodotTools var buildInfo = new MonoBuildInfo(GodotSharpDirs.ProjectSlnPath, config); // Add Godot defines - string constants = OS.IsWindows() ? "GodotDefineConstants=\"" : "GodotDefineConstants=\\\""; + string constants = buildTool == BuildTool.MsBuildVs ? "GodotDefineConstants=\"" : "GodotDefineConstants=\\\""; foreach (var godotDefine in godotDefines) constants += $"GODOT_{godotDefine.ToUpper().Replace("-", "_").Replace(" ", "_").Replace(";", "_")};"; @@ -217,7 +218,7 @@ namespace GodotTools if (Internal.GodotIsRealTDouble()) constants += "GODOT_REAL_T_IS_DOUBLE;"; - constants += OS.IsWindows() ? "\"" : "\\\""; + constants += buildTool == BuildTool.MsBuildVs ? "\"" : "\\\""; buildInfo.CustomProperties.Add(constants); @@ -267,8 +268,8 @@ namespace GodotTools ["name"] = "mono/builds/build_tool", ["hint"] = Godot.PropertyHint.Enum, ["hint_string"] = OS.IsWindows() ? - $"{PropNameMsbuildMono},{PropNameMsbuildVs},{PropNameXbuild}" : - $"{PropNameMsbuildMono},{PropNameXbuild}" + $"{PropNameMsbuildMono},{PropNameMsbuildVs}" : + $"{PropNameMsbuildMono}" }); EditorDef("mono/builds/print_build_output", false); diff --git a/modules/mono/editor/GodotTools/GodotTools/MonoBuildTab.cs b/modules/mono/editor/GodotTools/GodotTools/MonoBuildTab.cs index 75fdacc0da..3a74fa2f66 100644 --- a/modules/mono/editor/GodotTools/GodotTools/MonoBuildTab.cs +++ b/modules/mono/editor/GodotTools/GodotTools/MonoBuildTab.cs @@ -61,41 +61,48 @@ namespace GodotTools { using (var file = new Godot.File()) { - Error openError = file.Open(csvFile, Godot.File.ModeFlags.Read); - - if (openError != Error.Ok) - return; - - while (!file.EofReached()) + try { - string[] csvColumns = file.GetCsvLine(); + Error openError = file.Open(csvFile, Godot.File.ModeFlags.Read); - if (csvColumns.Length == 1 && csvColumns[0].Empty()) + if (openError != Error.Ok) return; - if (csvColumns.Length != 7) + while (!file.EofReached()) { - GD.PushError($"Expected 7 columns, got {csvColumns.Length}"); - continue; + string[] csvColumns = file.GetCsvLine(); + + if (csvColumns.Length == 1 && csvColumns[0].Empty()) + return; + + if (csvColumns.Length != 7) + { + GD.PushError($"Expected 7 columns, got {csvColumns.Length}"); + continue; + } + + var issue = new BuildIssue + { + Warning = csvColumns[0] == "warning", + File = csvColumns[1], + Line = int.Parse(csvColumns[2]), + Column = int.Parse(csvColumns[3]), + Code = csvColumns[4], + Message = csvColumns[5], + ProjectFile = csvColumns[6] + }; + + if (issue.Warning) + WarningCount += 1; + else + ErrorCount += 1; + + issues.Add(issue); } - - var issue = new BuildIssue - { - Warning = csvColumns[0] == "warning", - File = csvColumns[1], - Line = int.Parse(csvColumns[2]), - Column = int.Parse(csvColumns[3]), - Code = csvColumns[4], - Message = csvColumns[5], - ProjectFile = csvColumns[6] - }; - - if (issue.Warning) - WarningCount += 1; - else - ErrorCount += 1; - - issues.Add(issue); + } + finally + { + file.Close(); // Disposing it is not enough. We need to call Close() } } } |