// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace AutomationTool
{
///
/// Host platform abstraction
///
public abstract class HostPlatform
{
private static HostPlatform RunningPlatform;
///
/// Current running host platform.
///
public static HostPlatform Current
{
get
{
if (RunningPlatform == null)
{
throw new AutomationException("UnrealAutomationTool host platform not initialized.");
}
return RunningPlatform;
}
}
///
/// Initializes the current platform.
///
internal static void Initialize()
{
PlatformID Platform = Environment.OSVersion.Platform;
switch (Platform)
{
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
case PlatformID.WinCE:
RunningPlatform = new WindowsHostPlatform();
break;
case PlatformID.Unix:
if (File.Exists ("/System/Library/CoreServices/SystemVersion.plist"))
{
RunningPlatform = new MacHostPlatform();
}
else
{
RunningPlatform = new LinuxHostPlatform();
}
break;
case PlatformID.MacOSX:
RunningPlatform = new MacHostPlatform();
break;
default:
throw new Exception ("Unhandled runtime platform " + Platform);
}
}
///
/// Sets .Net framework environment variables.
///
abstract public void SetFrameworkVars();
///
/// Gets the build executable filename.
///
///
abstract public string GetMsBuildExe();
///
/// Gets the dev environment executable name.
///
///
abstract public string GetMsDevExe();
///
/// Folder under UE4/ to the platform's binaries.
///
abstract public string RelativeBinariesFolder { get; }
///
/// Full path to the UE4 Editor executable for the current platform.
///
///
///
abstract public string GetUE4ExePath(string UE4Exe);
///
/// 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);
///
/// Platform specific override to skip loading/compiling unsupported modules
///
/// Module name
/// True if module should be compiled or loaded
abstract public bool IsScriptModuleSupported(string ModuleName);
///
/// Gets UBT project name for the current platform.
///
abstract public string UBTProjectName { get; }
///
/// Returns the type of the host editor platform.
///
abstract public UnrealBuildTool.UnrealTargetPlatform HostEditorPlatform { get; }
///
/// 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; }
}
}