You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
@@ -16,33 +16,24 @@ namespace GodotSharpTools.Build
|
|||||||
private extern static void godot_icall_BuildInstance_ExitCallback(string solution, string config, int exitCode);
|
private extern static void godot_icall_BuildInstance_ExitCallback(string solution, string config, int exitCode);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
private extern static MSBuildInfo godot_icall_BuildInstance_get_MSBuildInfo();
|
private extern static void godot_icall_BuildInstance_get_MSBuildInfo(ref string msbuildPath, ref string frameworkPath);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
private struct MSBuildInfo
|
private struct MSBuildInfo
|
||||||
{
|
{
|
||||||
string path;
|
public string path;
|
||||||
string frameworkPathOverride;
|
public string frameworkPathOverride;
|
||||||
|
|
||||||
public string MSBuildPath
|
|
||||||
{
|
|
||||||
get { return path; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FrameworkPathOverride
|
|
||||||
{
|
|
||||||
get { return frameworkPathOverride; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MSBuildInfo GetMSBuildInfo()
|
private static MSBuildInfo GetMSBuildInfo()
|
||||||
{
|
{
|
||||||
MSBuildInfo ret = godot_icall_BuildInstance_get_MSBuildInfo();
|
MSBuildInfo msbuildInfo = new MSBuildInfo();
|
||||||
|
|
||||||
if (ret.MSBuildPath == null)
|
godot_icall_BuildInstance_get_MSBuildInfo(ref msbuildInfo.path, ref msbuildInfo.frameworkPathOverride);
|
||||||
|
|
||||||
|
if (msbuildInfo.path == null)
|
||||||
throw new FileNotFoundException("Cannot find the MSBuild executable.");
|
throw new FileNotFoundException("Cannot find the MSBuild executable.");
|
||||||
|
|
||||||
return ret;
|
return msbuildInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string solution;
|
private string solution;
|
||||||
@@ -70,12 +61,12 @@ namespace GodotSharpTools.Build
|
|||||||
if (customProperties != null)
|
if (customProperties != null)
|
||||||
customPropertiesList.AddRange(customProperties);
|
customPropertiesList.AddRange(customProperties);
|
||||||
|
|
||||||
if (msbuildInfo.FrameworkPathOverride.Length > 0)
|
if (msbuildInfo.frameworkPathOverride != null)
|
||||||
customPropertiesList.Add("FrameworkPathOverride=" + msbuildInfo.FrameworkPathOverride);
|
customPropertiesList.Add("FrameworkPathOverride=" + msbuildInfo.frameworkPathOverride);
|
||||||
|
|
||||||
string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customPropertiesList);
|
string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customPropertiesList);
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo(msbuildInfo.MSBuildPath, compilerArgs);
|
ProcessStartInfo startInfo = new ProcessStartInfo(msbuildInfo.path, compilerArgs);
|
||||||
|
|
||||||
// No console output, thanks
|
// No console output, thanks
|
||||||
startInfo.RedirectStandardOutput = true;
|
startInfo.RedirectStandardOutput = true;
|
||||||
@@ -114,12 +105,12 @@ namespace GodotSharpTools.Build
|
|||||||
if (customProperties != null)
|
if (customProperties != null)
|
||||||
customPropertiesList.AddRange(customProperties);
|
customPropertiesList.AddRange(customProperties);
|
||||||
|
|
||||||
if (msbuildInfo.FrameworkPathOverride.Length > 0)
|
if (msbuildInfo.frameworkPathOverride.Length > 0)
|
||||||
customPropertiesList.Add("FrameworkPathOverride=" + msbuildInfo.FrameworkPathOverride);
|
customPropertiesList.Add("FrameworkPathOverride=" + msbuildInfo.frameworkPathOverride);
|
||||||
|
|
||||||
string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customPropertiesList);
|
string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customPropertiesList);
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo(msbuildInfo.MSBuildPath, compilerArgs);
|
ProcessStartInfo startInfo = new ProcessStartInfo(msbuildInfo.path, compilerArgs);
|
||||||
|
|
||||||
// No console output, thanks
|
// No console output, thanks
|
||||||
startInfo.RedirectStandardOutput = true;
|
startInfo.RedirectStandardOutput = true;
|
||||||
|
|||||||
@@ -71,15 +71,10 @@ String _find_build_engine_on_unix(const String &p_name) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MonoString **godot_icall_BuildInstance_get_MSBuildInfo() {
|
void godot_icall_BuildInstance_get_MSBuildInfo(MonoString **r_msbuild_path, MonoString **r_framework_path) {
|
||||||
|
|
||||||
GodotSharpBuilds::BuildTool build_tool = GodotSharpBuilds::BuildTool(int(EditorSettings::get_singleton()->get("mono/builds/build_tool")));
|
GodotSharpBuilds::BuildTool build_tool = GodotSharpBuilds::BuildTool(int(EditorSettings::get_singleton()->get("mono/builds/build_tool")));
|
||||||
|
|
||||||
MonoString *res[2] = {
|
|
||||||
NULL, // MSBuildPath
|
|
||||||
NULL // FrameworkPathOverride
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(WINDOWS_ENABLED)
|
#if defined(WINDOWS_ENABLED)
|
||||||
switch (build_tool) {
|
switch (build_tool) {
|
||||||
case GodotSharpBuilds::MSBUILD: {
|
case GodotSharpBuilds::MSBUILD: {
|
||||||
@@ -89,12 +84,12 @@ MonoString **godot_icall_BuildInstance_get_MSBuildInfo() {
|
|||||||
if (!msbuild_tools_path.ends_with("\\"))
|
if (!msbuild_tools_path.ends_with("\\"))
|
||||||
msbuild_tools_path += "\\";
|
msbuild_tools_path += "\\";
|
||||||
|
|
||||||
res[0] = GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
|
*r_msbuild_path = GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
|
||||||
|
|
||||||
// FrameworkPathOverride
|
// FrameworkPathOverride
|
||||||
res[1] = GDMonoMarshal::mono_string_from_godot(GDMono::get_singleton()->get_mono_reg_info().assembly_dir);
|
*r_framework_path = GDMonoMarshal::mono_string_from_godot(GDMono::get_singleton()->get_mono_reg_info().assembly_dir);
|
||||||
|
|
||||||
return res;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
if (OS::get_singleton()->is_stdout_verbose())
|
||||||
@@ -107,8 +102,9 @@ MonoString **godot_icall_BuildInstance_get_MSBuildInfo() {
|
|||||||
WARN_PRINTS("Cannot find msbuild ('mono/builds/build_tool'). Tried with path: " + msbuild_path);
|
WARN_PRINTS("Cannot find msbuild ('mono/builds/build_tool'). Tried with path: " + msbuild_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
res[0] = GDMonoMarshal::mono_string_from_godot(msbuild_path);
|
*r_msbuild_path = GDMonoMarshal::mono_string_from_godot(msbuild_path);
|
||||||
return res;
|
|
||||||
|
return;
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
ERR_EXPLAIN("You don't deserve to live");
|
ERR_EXPLAIN("You don't deserve to live");
|
||||||
@@ -121,19 +117,20 @@ MonoString **godot_icall_BuildInstance_get_MSBuildInfo() {
|
|||||||
if (build_tool != GodotSharpBuilds::XBUILD) {
|
if (build_tool != GodotSharpBuilds::XBUILD) {
|
||||||
if (msbuild_path.empty()) {
|
if (msbuild_path.empty()) {
|
||||||
WARN_PRINT("Cannot find msbuild ('mono/builds/build_tool').");
|
WARN_PRINT("Cannot find msbuild ('mono/builds/build_tool').");
|
||||||
return res;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (xbuild_path.empty()) {
|
if (xbuild_path.empty()) {
|
||||||
WARN_PRINT("Cannot find xbuild ('mono/builds/build_tool').");
|
WARN_PRINT("Cannot find xbuild ('mono/builds/build_tool').");
|
||||||
return res;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res[0] = GDMonoMarshal::mono_string_from_godot(build_tool != GodotSharpBuilds::XBUILD ? msbuild_path : xbuild_path);
|
*r_msbuild_path = GDMonoMarshal::mono_string_from_godot(build_tool != GodotSharpBuilds::XBUILD ? msbuild_path : xbuild_path);
|
||||||
return res;
|
|
||||||
|
return;
|
||||||
#else
|
#else
|
||||||
return res;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user