// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Diagnostics;
using EpicGames.Core;
using Microsoft.Extensions.Logging;
using System.Runtime.CompilerServices;
namespace AutomationTool
{
///
/// Host platform abstraction
///
public abstract class HostPlatform
{
protected static ILogger Logger => Log.Logger;
///
/// Current running host platform.
///
public static readonly HostPlatform Current = Initialize();
///
/// Initializes the current platform.
///
private static HostPlatform Initialize()
{
switch (RuntimePlatform.Current)
{
case RuntimePlatform.Type.Windows: return new WindowsHostPlatform();
case RuntimePlatform.Type.Mac: return new MacHostPlatform();
case RuntimePlatform.Type.Linux: return new LinuxHostPlatform();
}
throw new Exception ("Unhandled runtime platform " + Environment.OSVersion.Platform);
}
///
/// Gets the build executable filename for NET Framework projects e.g. msbuild
///
///
abstract public string GetFrameworkMsbuildExe();
///
/// Folder under UE/ to the platform's binaries.
///
abstract public string RelativeBinariesFolder { get; }
///
/// Full path to the UnrealEditor executable for the current platform.
///
///
///
abstract public string GetUnrealExePath(string UnrealExe);
///
/// Log folder for local builds.
///
abstract public string LocalBuildsLogFolder { get; }
///
/// Name of the p4 executable.
///
abstract public string P4Exe { get; }
///
/// Creates a process and sets it up for the current platform.
///
///
///
abstract public Process CreateProcess(string AppName);
///
/// Sets any additional options for running an executable.
///
///
///
///
abstract public void SetupOptionsForRun(ref string AppName, ref CommandUtils.ERunOptions Options, ref string CommandLine);
///
/// Sets the console control handler for the current platform.
///
///
abstract public void SetConsoleCtrlHandler(ProcessManager.CtrlHandlerDelegate Handler);
///
/// Returns the type of the host editor platform.
///
abstract public UnrealBuildTool.UnrealTargetPlatform HostEditorPlatform { get; }
///
/// Returns the type of the current running host platform
///
public static UnrealBuildTool.UnrealTargetPlatform Platform { get => Current.HostEditorPlatform; }
///
/// Returns the pdb file extenstion for the host platform.
///
abstract public string PdbExtension { get; }
///
/// List of processes that can't not be killed
///
abstract public string[] DontKillProcessList { get; }
}
}