|
@@ -47,19 +47,14 @@ namespace GodotTools.Build
|
|
|
private static bool PrintBuildOutput =>
|
|
|
(bool)EditorSettings.GetSetting("mono/builds/print_build_output");
|
|
|
|
|
|
- private static Process LaunchBuild(string solution, IEnumerable<string> targets, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
|
|
|
+ private static Process LaunchBuild(BuildInfo buildInfo)
|
|
|
{
|
|
|
(string msbuildPath, BuildTool buildTool) = MsBuildFinder.FindMsBuild();
|
|
|
|
|
|
if (msbuildPath == null)
|
|
|
throw new FileNotFoundException("Cannot find the MSBuild executable.");
|
|
|
|
|
|
- var customPropertiesList = new List<string>();
|
|
|
-
|
|
|
- if (customProperties != null)
|
|
|
- customPropertiesList.AddRange(customProperties);
|
|
|
-
|
|
|
- string compilerArgs = BuildArguments(buildTool, solution, targets, config, loggerOutputDir, customPropertiesList);
|
|
|
+ string compilerArgs = BuildArguments(buildTool, buildInfo);
|
|
|
|
|
|
var startInfo = new ProcessStartInfo(msbuildPath, compilerArgs);
|
|
|
|
|
@@ -100,19 +95,7 @@ namespace GodotTools.Build
|
|
|
|
|
|
public static int Build(BuildInfo buildInfo)
|
|
|
{
|
|
|
- return Build(buildInfo.Solution, buildInfo.Targets, buildInfo.Configuration,
|
|
|
- buildInfo.LogsDirPath, buildInfo.CustomProperties);
|
|
|
- }
|
|
|
-
|
|
|
- public static Task<int> BuildAsync(BuildInfo buildInfo)
|
|
|
- {
|
|
|
- return BuildAsync(buildInfo.Solution, buildInfo.Targets, buildInfo.Configuration,
|
|
|
- buildInfo.LogsDirPath, buildInfo.CustomProperties);
|
|
|
- }
|
|
|
-
|
|
|
- public static int Build(string solution, string[] targets, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
|
|
|
- {
|
|
|
- using (var process = LaunchBuild(solution, targets, config, loggerOutputDir, customProperties))
|
|
|
+ using (var process = LaunchBuild(buildInfo))
|
|
|
{
|
|
|
process.WaitForExit();
|
|
|
|
|
@@ -120,9 +103,9 @@ namespace GodotTools.Build
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static async Task<int> BuildAsync(string solution, IEnumerable<string> targets, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
|
|
|
+ public static async Task<int> BuildAsync(BuildInfo buildInfo)
|
|
|
{
|
|
|
- using (var process = LaunchBuild(solution, targets, config, loggerOutputDir, customProperties))
|
|
|
+ using (var process = LaunchBuild(buildInfo))
|
|
|
{
|
|
|
await process.WaitForExitAsync();
|
|
|
|
|
@@ -130,17 +113,18 @@ namespace GodotTools.Build
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static string BuildArguments(BuildTool buildTool, string solution, IEnumerable<string> targets, string config, string loggerOutputDir, IEnumerable<string> customProperties)
|
|
|
+ private static string BuildArguments(BuildTool buildTool, BuildInfo buildInfo)
|
|
|
{
|
|
|
string arguments = string.Empty;
|
|
|
|
|
|
if (buildTool == BuildTool.DotnetCli)
|
|
|
arguments += "msbuild "; // `dotnet msbuild` command
|
|
|
|
|
|
- arguments += $@"""{solution}"" /v:normal /t:{string.Join(",", targets)} ""/p:{"Configuration=" + config}"" " +
|
|
|
- $@"""/l:{typeof(GodotBuildLogger).FullName},{GodotBuildLogger.AssemblyPath};{loggerOutputDir}""";
|
|
|
+ arguments += $@"""{buildInfo.Solution}"" /t:{string.Join(",", buildInfo.Targets)} " +
|
|
|
+ $@"""/p:{"Configuration=" + buildInfo.Configuration}"" /v:normal " +
|
|
|
+ $@"""/l:{typeof(GodotBuildLogger).FullName},{GodotBuildLogger.AssemblyPath};{buildInfo.LogsDirPath}""";
|
|
|
|
|
|
- foreach (string customProperty in customProperties)
|
|
|
+ foreach (string customProperty in buildInfo.CustomProperties)
|
|
|
{
|
|
|
arguments += " /p:" + customProperty;
|
|
|
}
|