2019-12-26 23:01:54 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-09-04 17:31:34 -04:00
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using UnrealBuildTool;
|
2020-12-21 23:07:37 -04:00
|
|
|
using EpicGames.Core;
|
2021-06-11 18:20:44 -04:00
|
|
|
using UnrealBuildBase;
|
2023-08-01 10:02:58 -04:00
|
|
|
using Microsoft.Extensions.Logging;
|
2014-09-04 17:31:34 -04:00
|
|
|
|
|
|
|
|
namespace AutomationTool
|
|
|
|
|
{
|
|
|
|
|
class LinuxHostPlatform : HostPlatform
|
|
|
|
|
{
|
2021-04-14 13:24:20 -04:00
|
|
|
static string CachedFrameworkMsbuildTool = "";
|
2020-02-28 16:03:47 -05:00
|
|
|
|
2021-04-14 13:24:20 -04:00
|
|
|
public override string GetFrameworkMsbuildExe()
|
2014-09-04 17:31:34 -04:00
|
|
|
{
|
2023-08-01 10:02:58 -04:00
|
|
|
// Look for dotnet, we only support dotnet.
|
2021-04-14 13:24:20 -04:00
|
|
|
if (string.IsNullOrEmpty(CachedFrameworkMsbuildTool))
|
2020-02-28 16:03:47 -05:00
|
|
|
{
|
2023-08-01 10:02:58 -04:00
|
|
|
bool CanUseMsBuild = string.IsNullOrEmpty(CommandUtils.WhichApp("dotnet")) == false;
|
2020-02-28 16:03:47 -05:00
|
|
|
|
|
|
|
|
if (CanUseMsBuild)
|
|
|
|
|
{
|
2023-08-01 10:02:58 -04:00
|
|
|
Logger.LogInformation($"using {CommandUtils.WhichApp("dotnet")}!");
|
|
|
|
|
|
|
|
|
|
CachedFrameworkMsbuildTool = "dotnet msbuild";
|
2020-02-28 16:03:47 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-08-01 10:02:58 -04:00
|
|
|
throw new BuildException("Unable to find installation of dotnet.");
|
2020-02-28 16:03:47 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-14 13:24:20 -04:00
|
|
|
return CachedFrameworkMsbuildTool;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-04 17:31:34 -04:00
|
|
|
public override string RelativeBinariesFolder
|
|
|
|
|
{
|
|
|
|
|
get { return @"Engine/Binaries/Linux/"; }
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-27 15:14:40 -04:00
|
|
|
public override string GetUnrealExePath(string UnrealExe)
|
2014-09-04 17:31:34 -04:00
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
if(Path.IsPathRooted(UnrealExe))
|
2019-02-28 10:51:25 -05:00
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
return CommandUtils.CombinePaths(UnrealExe);
|
2019-02-28 10:51:25 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-27 15:14:40 -04:00
|
|
|
int CmdExeIndex = UnrealExe.IndexOf("-Cmd.exe");
|
2015-01-08 14:44:38 -05:00
|
|
|
if (CmdExeIndex != -1)
|
|
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
UnrealExe = UnrealExe.Substring (0, CmdExeIndex);
|
2015-01-08 14:44:38 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
CmdExeIndex = UnrealExe.IndexOf (".exe");
|
2015-01-08 14:44:38 -05:00
|
|
|
if (CmdExeIndex != -1)
|
|
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
UnrealExe = UnrealExe.Substring (0, CmdExeIndex);
|
2015-01-08 14:44:38 -05:00
|
|
|
}
|
|
|
|
|
}
|
2021-10-27 15:14:40 -04:00
|
|
|
return CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, RelativeBinariesFolder, UnrealExe);
|
2014-09-04 17:31:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string LocalBuildsLogFolder
|
|
|
|
|
{
|
2015-04-13 16:47:25 -04:00
|
|
|
// @FIXME: should use xdg-user-dir DOCUMENTS
|
|
|
|
|
get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Documents/Unreal Engine/LocalBuildLogs"); }
|
2014-09-04 17:31:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string P4Exe
|
|
|
|
|
{
|
2020-12-01 17:42:21 -04:00
|
|
|
get { return "p4"; }
|
2014-09-04 17:31:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Process CreateProcess(string AppName)
|
|
|
|
|
{
|
|
|
|
|
var NewProcess = new Process();
|
|
|
|
|
return NewProcess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetupOptionsForRun(ref string AppName, ref CommandUtils.ERunOptions Options, ref string CommandLine)
|
|
|
|
|
{
|
2023-08-01 10:02:58 -04:00
|
|
|
if (AppName == "sh" || AppName == "codesign")
|
2014-09-04 17:31:34 -04:00
|
|
|
{
|
|
|
|
|
Options &= ~CommandUtils.ERunOptions.AppMustExist;
|
|
|
|
|
}
|
|
|
|
|
if (AppName.EndsWith(".exe") || ((AppName.Contains("/Binaries/Win64/") || AppName.Contains("/Binaries/Linux/")) && string.IsNullOrEmpty(Path.GetExtension(AppName))))
|
|
|
|
|
{
|
|
|
|
|
if (AppName.Contains("/Binaries/Win64/") || AppName.Contains("/Binaries/Linux/"))
|
|
|
|
|
{
|
|
|
|
|
AppName = AppName.Replace("/Binaries/Win64/", "/Binaries/Linux/");
|
|
|
|
|
AppName = AppName.Replace("-cmd.exe", "");
|
|
|
|
|
AppName = AppName.Replace("-Cmd.exe", "");
|
|
|
|
|
AppName = AppName.Replace(".exe", "");
|
|
|
|
|
}
|
2023-08-01 10:02:58 -04:00
|
|
|
// some of our C# applications are converted to dotnet core, do not run those via dotnet
|
2021-01-08 09:42:20 -04:00
|
|
|
else if (AppName.Contains("UnrealBuildTool") || AppName.Contains("AutomationTool"))
|
|
|
|
|
{
|
|
|
|
|
Options &= ~CommandUtils.ERunOptions.AppMustExist;
|
|
|
|
|
}
|
2014-09-04 17:31:34 -04:00
|
|
|
else
|
|
|
|
|
{
|
2023-08-01 10:02:58 -04:00
|
|
|
// It's a C# app, so run it with dotnet
|
2014-09-04 17:31:34 -04:00
|
|
|
CommandLine = "\"" + AppName + "\" " + (String.IsNullOrEmpty(CommandLine) ? "" : CommandLine);
|
2023-08-01 10:02:58 -04:00
|
|
|
AppName = "dotnet";
|
2014-09-04 17:31:34 -04:00
|
|
|
Options &= ~CommandUtils.ERunOptions.AppMustExist;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetConsoleCtrlHandler(ProcessManager.CtrlHandlerDelegate Handler)
|
|
|
|
|
{
|
2023-08-01 10:02:58 -04:00
|
|
|
// @todo: add dotnet support
|
2014-09-04 17:31:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override UnrealTargetPlatform HostEditorPlatform
|
|
|
|
|
{
|
|
|
|
|
get { return UnrealTargetPlatform.Linux; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string PdbExtension
|
|
|
|
|
{
|
|
|
|
|
get { return ".exe.mdb"; }
|
|
|
|
|
}
|
|
|
|
|
static string[] SystemServices = new string[]
|
|
|
|
|
{
|
|
|
|
|
// TODO: Add any system process names here
|
|
|
|
|
};
|
|
|
|
|
public override string[] DontKillProcessList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return SystemServices;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|