mirror of
https://github.com/godotengine/godot.git
synced 2024-11-14 08:03:05 +00:00
Merge pull request #30842 from neikeq/fix-custom-props-msbuild
Mono: Fix custom defines for Mono's MSBuild; remove xbuild
This commit is contained in:
commit
6697ad2c4f
@ -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)
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user