public ModuleDepPaths GatherDeps() { string RootPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../")); INCLUDE_ROOT = Path.Combine(RootPath, GRPC_STRIPPED_FOLDER); LIB_ROOT = Path.Combine(RootPath, GRPC_LIBS_FOLDER); List <string> headers = new List <string>(); List <string> libs = new List <string>(); string PlatformLibRoot = ""; if (Platform == UnrealTargetPlatform.Win64) { PlatformLibRoot = Path.Combine(LIB_ROOT, Platform.ToString()); libs.AddRange(FindFilesInDirectory(PlatformLibRoot, "lib")); } else { PlatformLibRoot = Path.Combine(LIB_ROOT, Platform.ToString()); libs.AddRange(FindFilesInDirectory(PlatformLibRoot, "a")); } clog("PlatformLibRoot: " + PlatformLibRoot); headers.Add(Path.Combine(INCLUDE_ROOT, "include")); headers.Add(Path.Combine(INCLUDE_ROOT, "third_party", "protobuf", "src")); return(new ModuleDepPaths(headers.ToArray(), libs.ToArray())); }
/// <summary> /// Given a platform and a client/server flag, returns the name Unreal refers to it as. E.g. "WindowsClient", "LinuxServer". /// </summary> /// <param name="InTargetPlatform"></param> /// <param name="InTargetType"></param> /// <returns></returns> public static string GetPlatformName(UnrealTargetPlatform TargetPlatform, UnrealTargetRole ProcessType, bool UsesSharedBuildType) { string Platform = ""; bool IsDesktop = UnrealBuildTool.Utils.GetPlatformsInClass(UnrealPlatformClass.Desktop).Contains(TargetPlatform); // These platforms can be built as either game, server or client if (IsDesktop) { Platform = (TargetPlatform == UnrealTargetPlatform.Win32 || TargetPlatform == UnrealTargetPlatform.Win64) ? "Windows" : TargetPlatform.ToString(); if (ProcessType == UnrealTargetRole.Client) { if (UsesSharedBuildType) { Platform += "NoEditor"; } else { Platform += "Client"; } } else if (ProcessType == UnrealTargetRole.Server) { if (UsesSharedBuildType) { Platform += "NoEditor"; } else { Platform += "Server"; } } } else if (TargetPlatform == UnrealTargetPlatform.Android) { // TODO: hardcoded ETC2 for now, need to determine cook flavor used. // actual flavour required may depend on the target HW... if (UsesSharedBuildType) { Platform = TargetPlatform.ToString() + "_ETC2"; } else { Platform = TargetPlatform.ToString() + "_ETC2Client"; } } else { Platform = TargetPlatform.ToString(); } return(Platform); }
/** * Return the VisualStudio platform name for this build platform * * @param InPlatform The UnrealTargetPlatform being built * @param InConfiguration The UnrealTargetConfiguration being built * * @return string The name of the platform that VisualStudio recognizes */ public override string GetVisualStudioPlatformName(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration) { if (InPlatform == UnrealTargetPlatform.WinRT) { return "WinRT"; } return InPlatform.ToString(); }
/// <summary> /// Gets the standard path for an manifest /// </summary> /// <param name="DirectoryName">The directory containing this manifest</param> /// <param name="AppName">The modular app name being built</param> /// <param name="Configuration">The target configuration</param> /// <param name="Platform">The target platform</param> /// <param name="BuildArchitecture">The architecture of the target platform</param> /// <returns>Filename for the app receipt</returns> public static string GetStandardFileName(string AppName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string BuildArchitecture, bool bIsGameDirectory) { string BaseName = AppName; if(Configuration != UnrealTargetConfiguration.Development && !(Configuration == UnrealTargetConfiguration.DebugGame && !bIsGameDirectory)) { BaseName += String.Format("-{0}-{1}", Platform.ToString(), Configuration.ToString()); } return String.Format("{0}{1}.modules", BaseName, BuildArchitecture); }
/** * Retrieve the CPPTargetPlatform for the given UnrealTargetPlatform * * @param InUnrealTargetPlatform The UnrealTargetPlatform being build * * @return CPPTargetPlatform The CPPTargetPlatform to compile for */ public override CPPTargetPlatform GetCPPTargetPlatform(UnrealTargetPlatform InUnrealTargetPlatform) { switch (InUnrealTargetPlatform) { case UnrealTargetPlatform.Mac: return CPPTargetPlatform.Mac; } throw new BuildException("MacPlatform::GetCPPTargetPlatform: Invalid request for {0}", InUnrealTargetPlatform.ToString()); }
/** * Retrieve the UEBuildPlatform instance for the given TargetPlatform * * @param InPlatform The UnrealTargetPlatform being built * @param bInAllowFailure If true, do not throw an exception and return null * * @return UEBuildPlatform The instance of the build platform */ public static UEBuildPlatform GetBuildPlatform(UnrealTargetPlatform InPlatform, bool bInAllowFailure = false) { if (BuildPlatformDictionary.ContainsKey(InPlatform) == true) { return BuildPlatformDictionary[InPlatform]; } if (bInAllowFailure == true) { return null; } throw new BuildException("GetBuildPlatform: No BuildPlatform found for {0}", InPlatform.ToString()); }
/// <summary> /// Retrieve the UEPlatformProjectGenerator instance for the given TargetPlatform /// </summary> /// <param name="InPlatform"> The UnrealTargetPlatform being built</param> /// <param name="bInAllowFailure"> If true, do not throw an exception and return null</param> /// <returns>UEPlatformProjectGenerator The instance of the project generator</returns> public static UEPlatformProjectGenerator GetPlatformProjectGenerator(UnrealTargetPlatform InPlatform, bool bInAllowFailure = false) { if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true) { return ProjectGeneratorDictionary[InPlatform]; } if (bInAllowFailure == true) { return null; } throw new BuildException("GetPlatformProjectGenerator: No PlatformProjectGenerator found for {0}", InPlatform.ToString()); }
/// <summary> /// Register the given platforms UEPlatformProjectGenerator instance /// </summary> /// <param name="InPlatform"> The UnrealTargetPlatform to register with</param> /// <param name="InProjectGenerator">The UEPlatformProjectGenerator instance to use for the InPlatform</param> public static void RegisterPlatformProjectGenerator(UnrealTargetPlatform InPlatform, UEPlatformProjectGenerator InProjectGenerator) { // Make sure the build platform is legal var BuildPlatform = UEBuildPlatform.GetBuildPlatform(InPlatform, true); if (BuildPlatform != null) { if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true) { Log.TraceInformation("RegisterPlatformProjectGenerator Warning: Registering project generator {0} for {1} when it is already set to {2}", InProjectGenerator.ToString(), InPlatform.ToString(), ProjectGeneratorDictionary[InPlatform].ToString()); ProjectGeneratorDictionary[InPlatform] = InProjectGenerator; } else { ProjectGeneratorDictionary.Add(InPlatform, InProjectGenerator); } } else { Log.TraceVerbose("Skipping project file generator registration for {0} due to no valid BuildPlatform.", InPlatform.ToString()); } }
/** * Register the given platforms UEBuildDeploy instance * * @param InPlatform The UnrealTargetPlatform to register with * @param InBuildDeploy The UEBuildDeploy instance to use for the InPlatform */ public static void RegisterBuildDeploy(UnrealTargetPlatform InPlatform, UEBuildDeploy InBuildDeploy) { if (BuildDeployDictionary.ContainsKey(InPlatform) == true) { Log.TraceWarning("RegisterBuildDeply Warning: Registering build deploy {0} for {1} when it is already set to {2}", InBuildDeploy.ToString(), InPlatform.ToString(), BuildDeployDictionary[InPlatform].ToString()); BuildDeployDictionary[InPlatform] = InBuildDeploy; } else { BuildDeployDictionary.Add(InPlatform, InBuildDeploy); } }
public BenchmarkBuildTask(FileReference InProjectFile, string InTarget, UnrealTargetPlatform InPlatform, BuildOptions InOptions, string InUBTArgs = "", int CoreCount = 0) { bool IsVanillaUE4 = InProjectFile == null; string ModuleName = IsVanillaUE4 ? "UE4" : InProjectFile.GetFileNameWithoutAnyExtensions(); TaskName = string.Format("{0} {1} {2}", ModuleName, InTarget, InPlatform); Command = new BuildTarget(); Command.ProjectName = IsVanillaUE4 ? null : ModuleName; Command.Platforms = InPlatform.ToString(); Command.Targets = InTarget; Command.NoTools = true; Command.Clean = InOptions.HasFlag(BuildOptions.Clean); Command.UBTArgs = InUBTArgs; bool WithAccel = !InOptions.HasFlag(BuildOptions.NoAcceleration); if (!WithAccel || !SupportsAcceleration) { string Arg = string.Format("No{0}", AccelerationName); Command.UBTArgs += " -" + Arg; TaskModifiers.Add(Arg); Command.Params = new[] { Arg }; // need to also pass it to this if (CoreCount > 0) { TaskModifiers.Add(string.Format("{0}c", CoreCount)); Command.UBTArgs += string.Format(" -MaxParallelActions={0}", CoreCount); } } else { TaskModifiers.Add(AccelerationName); } if (!string.IsNullOrEmpty(InUBTArgs)) { TaskModifiers.Add(InUBTArgs); } }
public BenchmarkCookTask(FileReference InProjectFile, UnrealTargetPlatform InPlatform, bool bCookAsClient, DDCTaskOptions InOptions, string InCookArgs) : base(InProjectFile, InOptions, InCookArgs) { CookArgs = InCookArgs; CookAsClient = bCookAsClient; var PlatformToCookPlatform = new Dictionary <UnrealTargetPlatform, string> { { UnrealTargetPlatform.Win64, "WindowsClient" }, { UnrealTargetPlatform.Mac, "MacClient" }, { UnrealTargetPlatform.Linux, "LinuxClient" }, { UnrealTargetPlatform.Android, "Android_ASTCClient" } }; CookPlatformName = InPlatform.ToString(); if (PlatformToCookPlatform.ContainsKey(InPlatform)) { CookPlatformName = PlatformToCookPlatform[InPlatform]; } TaskName = string.Format("Cook {0} {1}", ProjectName, CookPlatformName); }
/// <summary> /// Return the VisualStudio platform name for this build platform /// </summary> /// <param name="InPlatform"> The UnrealTargetPlatform being built</param> /// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param> /// <returns>string The name of the platform that VisualStudio recognizes</returns> public virtual string GetVisualStudioPlatformName(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration) { // By default, return the platform string return InPlatform.ToString(); }
/** * Retrieve the CPPTargetPlatform for the given UnrealTargetPlatform * * @param InUnrealTargetPlatform The UnrealTargetPlatform being build * * @return CPPTargetPlatform The CPPTargetPlatform to compile for */ public override CPPTargetPlatform GetCPPTargetPlatform(UnrealTargetPlatform InUnrealTargetPlatform) { switch (InUnrealTargetPlatform) { case UnrealTargetPlatform.Win32: return CPPTargetPlatform.Win32; case UnrealTargetPlatform.Win64: return CPPTargetPlatform.Win64; } throw new BuildException("WindowsPlatform::GetCPPTargetPlatform: Invalid request for {0}", InUnrealTargetPlatform.ToString()); }
/// <summary> /// Return a list of "test name", "UAT command" pairs for testing a monolithic /// </summary> public virtual Dictionary<string, string> GUBP_GetGameTests_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform AltHostPlatform, UnrealTargetPlatform Platform) { var Result = new Dictionary<string, string>(); if ((Platform == HostPlatform || Platform == AltHostPlatform) && Type == TargetType.Game) // for now, we will only run these for the dev config of the host platform { Result.Add("CookedGameTest", "BuildCookRun -run -skipcook -stage -pak -deploy -unattended -nullrhi -NoP4 -platform=" + Platform.ToString()); Result.Add("CookedGameAutomationTest", "BuildCookRun -run -skipcook -stage -pak -deploy -RunAutomationTests -unattended -nullrhi -NoP4 -platform=" + Platform.ToString()); } return Result; }
public static string GetDebugFilesManifestFileName(UnrealTargetPlatform PlatformType) { return("Manifest_DebugFiles_" + PlatformType.ToString() + ".txt"); }
public IOSPlatform(UnrealTargetPlatform TargetPlatform) :base(TargetPlatform) { PlatformName = TargetPlatform.ToString(); SDKName = (TargetPlatform == UnrealTargetPlatform.TVOS) ? "appletvos" : "iphoneos"; }
/// <summary> /// Returns a path to the client binaries folder. /// </summary> /// <param name="RawProjectPath">Full project path.</param> /// <param name="Platform">Platform type.</param> /// <returns>Path to the binaries folder.</returns> public static string GetProjectClientBinariesFolder(string ProjectClientBinariesPath, UnrealTargetPlatform Platform = UnrealTargetPlatform.Unknown) { if (Platform != UnrealTargetPlatform.Unknown) { ProjectClientBinariesPath = CommandUtils.CombinePaths(ProjectClientBinariesPath, Platform.ToString()); } return ProjectClientBinariesPath; }
public static string StaticGetFullName(BranchInfo.BranchUProject InGameProj, UnrealTargetPlatform InHostPlatform, UnrealTargetPlatform InClientTargetPlatform, UnrealTargetConfiguration InClientConfig) { string Infix = "_" + InClientTargetPlatform.ToString(); Infix += "_" + InClientConfig.ToString(); return InGameProj.GameName + Infix + "_TestBuild" + HostPlatformNode.StaticGetHostPlatformSuffix(InHostPlatform); }
public static IEnumerable <T> CreateFromPath <T>(UnrealTargetPlatform InPlatform, string InProjectName, string InPath, string InExecutableExtension) where T : StagedBuild { string BuildPath = InPath; List <T> DiscoveredBuilds = new List <T>(); // Turn FooGame into just Foo as we need to check for client/server builds too string ShortName = Regex.Replace(InProjectName, "Game", "", RegexOptions.IgnoreCase); string ContentPath = Path.Combine(InPath, InProjectName, "Content", "Paks"); if (Directory.Exists(ContentPath)) { string EngineBinaryPath = Path.Combine(InPath, "Engine", "Binaries", InPlatform.ToString()); string GameBinaryPath = Path.Combine(InPath, InProjectName, "Binaries", InPlatform.ToString()); // Executable will either be Project*.exe or for content-only UE4Game.exe string[] ExecutableMatches = new string[] { ShortName + "*" + InExecutableExtension, "UE4Game*" + InExecutableExtension, }; // check // 1) Path/Project/Binaries/Platform // 2) Path (content only builds on some platforms write out a stub exe here) // 3) path/Engine/Binaries/Platform string[] ExecutablePaths = new string[] { Path.Combine(InPath, InProjectName, "Binaries", InPlatform.ToString()), Path.Combine(InPath), Path.Combine(InPath, "Engine", "Binaries", InPlatform.ToString()), }; List <FileSystemInfo> Binaries = new List <FileSystemInfo>(); foreach (var BinaryPath in ExecutablePaths) { if (Directory.Exists(BinaryPath)) { DirectoryInfo Di = new DirectoryInfo(BinaryPath); foreach (var FileMatch in ExecutableMatches) { // Look at files & directories since apps on Mac are bundles FileSystemInfo[] AppFiles = Di.GetFileSystemInfos(FileMatch); Binaries.AddRange(AppFiles); } } } foreach (FileSystemInfo App in Binaries) { UnrealTargetConfiguration Config = UnrealHelpers.GetConfigurationFromExecutableName(InProjectName, App.Name); UnrealTargetRole Role = UnrealHelpers.GetRoleFromExecutableName(InProjectName, App.Name); if (Config != UnrealTargetConfiguration.Unknown && Role != UnrealTargetRole.Unknown) { // store the exe path as relative to the staged dir path T NewBuild = Activator.CreateInstance(typeof(T), new object[] { InPlatform, Config, Role, InPath, Utils.SystemHelpers.MakePathRelative(App.FullName, InPath) }) as T; if (App.Name.StartsWith("UE4Game", StringComparison.OrdinalIgnoreCase)) { NewBuild.Flags |= BuildFlags.ContentOnlyProject; } DiscoveredBuilds.Add(NewBuild); } } } return(DiscoveredBuilds); }
/// <summary> /// Retrieves and saves all artifacts from the provided session role. Artifacts are saved to the destination path /// </summary> /// <param name="InContext"></param> /// <param name="InRunningRole"></param> /// <param name="InDestArtifactPath"></param> /// <returns></returns> public UnrealRoleArtifacts SaveRoleArtifacts(UnrealTestContext InContext, UnrealSessionInstance.RoleInstance InRunningRole, string InDestArtifactPath) { bool IsServer = InRunningRole.Role.RoleType.IsServer(); string RoleName = (InRunningRole.Role.IsDummy() ? "Dummy" : "") + InRunningRole.Role.RoleType.ToString(); UnrealTargetPlatform Platform = InRunningRole.Role.Platform; string RoleConfig = InRunningRole.Role.Configuration.ToString(); Directory.CreateDirectory(InDestArtifactPath); // Don't archive editor data, there can be a *lot* of stuff in that saved folder! bool IsEditor = InRunningRole.Role.RoleType.UsesEditor(); bool IsDevBuild = InContext.TestParams.ParseParam("dev"); string DestSavedDir = Path.Combine(InDestArtifactPath, "Saved"); string SourceSavedDir = ""; // save the contents of the saved directory SourceSavedDir = InRunningRole.AppInstance.ArtifactPath; // save the output from TTY string ArtifactLogPath = Path.Combine(InDestArtifactPath, RoleName + "Output.log"); // Write a brief Gauntlet header to aid debugging StringBuilder LogOut = new StringBuilder(); LogOut.AppendLine("------ Gauntlet Test ------"); LogOut.AppendFormat("Role: {0}\r\n", InRunningRole.Role); LogOut.AppendFormat("Automation Command: {0}\r\n", Environment.CommandLine); LogOut.AppendLine("---------------------------"); // Write instance stdout stream LogOut.Append(InRunningRole.AppInstance.StdOut); File.WriteAllText(ArtifactLogPath, LogOut.ToString()); Log.Info("Wrote Log to {0}", ArtifactLogPath); if (IsServer == false) { // gif-ify and jpeg-ify any screenshots try { string ScreenshotPath = Path.Combine(SourceSavedDir, "Screenshots", Platform.ToString()).ToLower(); if (Directory.Exists(ScreenshotPath) && Directory.GetFiles(ScreenshotPath).Length > 0) { Log.Info("Downsizing and gifying session images at {0}", ScreenshotPath); // downsize first so gif-step is quicker and takes less resoruces. Utils.Image.ConvertImages(ScreenshotPath, ScreenshotPath, "jpg", true); string GifPath = Path.Combine(InDestArtifactPath, RoleName + "Test.gif"); if (Utils.Image.SaveImagesAsGif(ScreenshotPath, GifPath)) { Log.Info("Saved gif to {0}", GifPath); } } } catch (Exception Ex) { Log.Info("Failed to downsize and gif-ify images! {0}", Ex); } } // don't archive data in dev mode, because peoples saved data could be huuuuuuuge! if (IsEditor == false) { LogLevel OldLevel = Log.Level; Log.Level = LogLevel.Normal; if (Directory.Exists(SourceSavedDir)) { Utils.SystemHelpers.CopyDirectory(SourceSavedDir, DestSavedDir); Log.Info("Archived artifacts to to {0}", DestSavedDir); } else { Log.Info("Archive path '{0}' was not found!", SourceSavedDir); } Log.Level = OldLevel; } else { if (IsEditor) { Log.Info("Skipping archival of assets for editor {0}", RoleName); } else if (IsDevBuild) { Log.Info("Skipping archival of assets for dev build"); } } // TODO REMOVEME- this should go elsewhere, likely a util that can be called or inserted by relevant test nodes. if (IsServer == false) { // Copy over PSOs try { if (InContext.Options.LogPSO) { foreach (var ThisFile in CommandUtils.FindFiles_NoExceptions(true, "*.rec.upipelinecache", true, DestSavedDir)) { bool Copied = false; var JustFile = Path.GetFileName(ThisFile); if (JustFile.StartsWith("++")) { var Parts = JustFile.Split(new Char[] { '+', '-' }).Where(A => A != "").ToArray(); if (Parts.Count() >= 2) { string ProjectName = Parts[0].ToString(); string BuildRoot = CommandUtils.CombinePaths(CommandUtils.RootBuildStorageDirectory()); string SrcBuildPath = CommandUtils.CombinePaths(BuildRoot, ProjectName); string SrcBuildPath2 = CommandUtils.CombinePaths(BuildRoot, ProjectName.Replace("Game", "").Replace("game", "")); if (!CommandUtils.DirectoryExists(SrcBuildPath)) { SrcBuildPath = SrcBuildPath2; } if (CommandUtils.DirectoryExists(SrcBuildPath)) { var JustBuildFolder = JustFile.Replace("-" + Parts.Last(), ""); string PlatformStr = Platform.ToString(); string SrcCLMetaPath = CommandUtils.CombinePaths(SrcBuildPath, JustBuildFolder, PlatformStr, "MetaData"); if (CommandUtils.DirectoryExists(SrcCLMetaPath)) { string SrcCLMetaPathCollected = CommandUtils.CombinePaths(SrcCLMetaPath, "CollectedPSOs"); if (!CommandUtils.DirectoryExists(SrcCLMetaPathCollected)) { Log.Info("Creating Directory {0}", SrcCLMetaPathCollected); CommandUtils.CreateDirectory(SrcCLMetaPathCollected); } if (CommandUtils.DirectoryExists(SrcCLMetaPathCollected)) { string DestFile = CommandUtils.CombinePaths(SrcCLMetaPathCollected, JustFile); CommandUtils.CopyFile_NoExceptions(ThisFile, DestFile, true); if (CommandUtils.FileExists(true, DestFile)) { Log.Info("Deleting local file, copied to {0}", DestFile); CommandUtils.DeleteFile_NoExceptions(ThisFile, true); Copied = true; } } } } } } if (!Copied) { Log.Warning("Could not find anywhere to put this file {0}", JustFile); } } } } catch (Exception Ex) { Log.Info("Failed to copy upipelinecaches to the network {0}", Ex); } } // END REMOVEME UnrealLogParser LogParser = new UnrealLogParser(InRunningRole.AppInstance.StdOut); int ExitCode = InRunningRole.AppInstance.ExitCode; LogParser.GetTestExitCode(out ExitCode); UnrealRoleArtifacts Artifacts = new UnrealRoleArtifacts(InRunningRole.Role, InRunningRole.AppInstance, InDestArtifactPath, ArtifactLogPath, LogParser); return(Artifacts); }
/** * Return the VisualStudio platform name for this build platform * * @param InPlatform The UnrealTargetPlatform being built * @param InConfiguration The UnrealTargetConfiguration being built * * @return string The name of the platform that VisualStudio recognizes */ public override string GetVisualStudioPlatformName(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration) { if (InPlatform == UnrealTargetPlatform.Android) { return "Tegra-Android"; } return InPlatform.ToString(); }
public static string GetUFSDeployedManifestFileName(UnrealTargetPlatform PlatformType) { return "Manifest_UFSFiles_" + PlatformType.ToString() + ".txt"; }
public static string GetDebugFilesManifestFileName(UnrealTargetPlatform PlatformType) { return "Manifest_DebugFiles_" + PlatformType.ToString() + ".txt"; }
public FormalBuildTestNode(GUBP.GUBPBranchConfig InBranchConfig, BranchInfo.BranchUProject InGameProj, UnrealTargetPlatform InHostPlatform, UnrealTargetPlatform InClientTargetPlatform, UnrealTargetConfiguration InClientConfig ) : base(InHostPlatform) { BranchConfig = InBranchConfig; GameProj = InGameProj; ClientTargetPlatform = InClientTargetPlatform; ClientConfig = InClientConfig; GameOrClient = TargetRules.TargetType.Game; // verify we actually built these var WorkingGameProject = InGameProj; if (!WorkingGameProject.Properties.Targets.ContainsKey(TargetRules.TargetType.Editor)) { // this is a codeless project, use the base project WorkingGameProject = BranchConfig.Branch.BaseEngineProject; } if (!WorkingGameProject.Properties.Targets.ContainsKey(GameOrClient)) { throw new AutomationException("Can't make a game build for {0} because it doesn't have a {1} target.", WorkingGameProject.GameName, GameOrClient.ToString()); } if (!WorkingGameProject.Properties.Targets[GameOrClient].Rules.GUBP_GetPlatforms_MonolithicOnly(HostPlatform).Contains(ClientTargetPlatform)) { throw new AutomationException("Can't make a game/client build for {0} because we didn't build platform {1}.", WorkingGameProject.GameName, ClientTargetPlatform.ToString()); } if (!WorkingGameProject.Properties.Targets[GameOrClient].Rules.GUBP_GetConfigs_MonolithicOnly(HostPlatform, ClientTargetPlatform).Contains(ClientConfig)) { throw new AutomationException("Can't make a game/client build for {0} because we didn't build platform {1} config {2}.", WorkingGameProject.GameName, ClientTargetPlatform.ToString(), ClientConfig.ToString()); } AddDependency(FormalBuildNode.StaticGetFullName(GameProj, HostPlatform, new List<UnrealTargetPlatform>() { ClientTargetPlatform }, InClientConfigs: new List<UnrealTargetConfiguration>() { ClientConfig }, InClientNotGame: GameOrClient == TargetRules.TargetType.Client)); }
public override void AddNodes(GUBP bp, GUBP.GUBPBranchConfig BranchConfig, UnrealTargetPlatform HostPlatform, List<UnrealTargetPlatform> ActivePlatforms) { if (!BranchConfig.BranchOptions.bNoInstalledEngine) { // Add the aggregate for making a rocket build if(!BranchConfig.HasNode(WaitToMakeRocketBuild.StaticGetFullName())) { BranchConfig.AddNode(new WaitToMakeRocketBuild(BranchConfig)); } // Find all the target platforms for this host platform. List<UnrealTargetPlatform> TargetPlatforms = GetTargetPlatforms(bp, HostPlatform); // Remove any platforms that aren't available on this machine TargetPlatforms.RemoveAll(x => !ActivePlatforms.Contains(x)); // Get the temp directory for stripped files for this host string StrippedDir = Path.GetFullPath(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Saved", "Rocket", HostPlatform.ToString())); // Get the temp directory for signed files for this host string SignedDir = Path.GetFullPath(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Saved", "Rocket", "Signed", HostPlatform.ToString())); // Strip the host platform if (StripRocketNode.IsRequiredForPlatform(HostPlatform)) { BranchConfig.AddNode(new StripRocketToolsNode(BranchConfig, HostPlatform, StrippedDir)); BranchConfig.AddNode(new StripRocketEditorNode(BranchConfig, HostPlatform, StrippedDir)); } BranchConfig.AddNode(new SignRocketToolsNode(BranchConfig, HostPlatform, SignedDir)); BranchConfig.AddNode(new SignRocketEditorNode(BranchConfig, HostPlatform, SignedDir)); // Strip all the target platforms that are built on this host foreach (UnrealTargetPlatform TargetPlatform in TargetPlatforms) { if (GetSourceHostPlatform(BranchConfig.HostPlatforms, HostPlatform, TargetPlatform) == HostPlatform && StripRocketNode.IsRequiredForPlatform(TargetPlatform)) { BranchConfig.AddNode(new StripRocketMonolithicsNode(BranchConfig, HostPlatform, TargetPlatform, StrippedDir)); } if (GetSourceHostPlatform(BranchConfig.HostPlatforms, HostPlatform, TargetPlatform) == HostPlatform && SignRocketNode.IsRequiredForPlatform(TargetPlatform)) { BranchConfig.AddNode(new SignRocketMonolithicsNode(BranchConfig, HostPlatform, TargetPlatform, SignedDir)); } } // Build the DDC BranchConfig.AddNode(new BuildDerivedDataCacheNode(BranchConfig, HostPlatform, GetCookPlatforms(HostPlatform, TargetPlatforms), CurrentFeaturePacks)); // Generate a list of files that needs to be copied for each target platform BranchConfig.AddNode(new FilterRocketNode(BranchConfig, HostPlatform, TargetPlatforms, CurrentFeaturePacks, CurrentTemplates)); // Copy the install to the output directory string LocalOutputDir = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "LocalBuilds", "Rocket", CommandUtils.GetGenericPlatformName(HostPlatform)); BranchConfig.AddNode(new GatherRocketNode(BranchConfig, HostPlatform, TargetPlatforms, LocalOutputDir)); // Add a node for GitHub promotions if(HostPlatform == UnrealTargetPlatform.Win64) { string GitConfigRelativePath = "Engine/Build/Git/UnrealBot.ini"; if(CommandUtils.FileExists(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, GitConfigRelativePath))) { BranchConfig.AddNode(new BuildGitPromotable(HostPlatform, BranchConfig.HostPlatforms, GitConfigRelativePath)); } } // Get the output directory for the build zips string PublishedEngineDir; if (ShouldDoSeriousThingsLikeP4CheckinAndPostToMCP(BranchConfig)) { PublishedEngineDir = CommandUtils.CombinePaths(CommandUtils.RootBuildStorageDirectory(), "Rocket", "Automated", GetBuildLabel(), CommandUtils.GetGenericPlatformName(HostPlatform)); } else { PublishedEngineDir = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "LocalBuilds", "RocketPublish", CommandUtils.GetGenericPlatformName(HostPlatform)); } // Publish the install to the network BranchConfig.AddNode(new PublishRocketNode(HostPlatform, LocalOutputDir, PublishedEngineDir)); BranchConfig.AddNode(new PublishRocketSymbolsNode(BranchConfig, HostPlatform, TargetPlatforms, PublishedEngineDir + "Symbols")); } }
private void BuildAndCookPlatform(UnrealTargetPlatform Platform) { LogInformation("Building {0}...", Platform.ToString()); RunBCR(string.Format("-project={0} -platform={1} -build -cook -stage -pak -deploy", ProjectToRun, Platform)); }
/// <summary> /// Returns a path to the client binaries folder. /// </summary> /// <param name="RawProjectPath">Full project path.</param> /// <param name="Platform">Platform type.</param> /// <returns>Path to the binaries folder.</returns> public static string GetProjectClientBinariesFolder(string ProjectClientBinariesPath, UnrealTargetPlatform Platform = UnrealTargetPlatform.Unknown) { if (Platform != UnrealTargetPlatform.Unknown) { ProjectClientBinariesPath = CommandUtils.CombinePaths(ProjectClientBinariesPath, Platform.ToString()); } return(ProjectClientBinariesPath); }
/// <summary> /// Returns a path to the client binaries folder. /// </summary> /// <param name="RawProjectPath">Full project path.</param> /// <param name="Platform">Platform type.</param> /// <returns>Path to the binaries folder.</returns> public static DirectoryReference GetProjectClientBinariesFolder(DirectoryReference ProjectClientBinariesPath, UnrealTargetPlatform Platform = UnrealTargetPlatform.Unknown) { if (Platform != UnrealTargetPlatform.Unknown) { ProjectClientBinariesPath = DirectoryReference.Combine(ProjectClientBinariesPath, Platform.ToString()); } return(ProjectClientBinariesPath); }
public static string StaticGetFullName(UnrealTargetPlatform InHostPlatform, UnrealTargetPlatform Plat) { return Plat.ToString() + "_EditorPlatform" + StaticGetHostPlatformSuffix(InHostPlatform); }
public static string GetUFSDeployedManifestFileName(UnrealTargetPlatform PlatformType) { return("Manifest_UFSFiles_" + PlatformType.ToString() + ".txt"); }
/// <summary> /// Determine the output path for a target's executable /// </summary> /// <param name="BaseDirectory">The base directory for the executable; typically either the engine directory or project directory.</param> /// <param name="BinaryName">Name of the binary</param> /// <param name="Platform">Target platform to build for</param> /// <param name="Configuration">Target configuration being built</param> /// <param name="UndecoratedConfiguration">The configuration which doesn't have a "-{Platform}-{Configuration}" suffix added to the binary</param> /// <param name="bIncludesGameModules">Whether this executable contains game modules</param> /// <param name="ExeSubFolder">Subfolder for executables. May be null.</param> /// <returns>List of executable paths for this target</returns> public static string[] MakeExecutablePaths(string BaseDirectory, string BinaryName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, UnrealTargetConfiguration UndecoratedConfiguration, bool bIncludesGameModules, string ExeSubFolder) { // Get the configuration for the executable. If we're building DebugGame, and this executable only contains engine modules, use the same name as development. UnrealTargetConfiguration ExeConfiguration = Configuration; if(Configuration == UnrealTargetConfiguration.DebugGame && !bIncludesGameModules) { ExeConfiguration = UnrealTargetConfiguration.Development; } // Build the binary path string BinaryPath = Path.Combine(BaseDirectory, "Binaries", Platform.ToString()); if (!String.IsNullOrEmpty(ExeSubFolder)) { BinaryPath = Path.Combine(BinaryPath, ExeSubFolder); } BinaryPath = Path.Combine(BinaryPath, MakeBinaryFileName(BinaryName, Platform, ExeConfiguration, UndecoratedConfiguration, UEBuildBinaryType.Executable)); // Allow the platform to customize the output path (and output several executables at once if necessary) return UEBuildPlatform.GetBuildPlatform(Platform).FinalizeBinaryPaths(BinaryPath); }
/// <summary> /// Returns the standard path to the build receipt for a given target /// </summary> /// <param name="DirectoryName">Base directory for the target being built; either the project directory or engine directory.</param> /// <param name="TargetName">The target being built</param> /// <param name="Configuration">The target configuration</param> /// <param name="Platform">The target platform</param> /// <returns>Path to the receipt for this target</returns> public static string GetDefaultPath(string BaseDir, string TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string BuildArchitecture) { return Path.Combine(BaseDir, "Build", "Receipts", String.Format("{0}-{1}-{2}{3}.target.xml", TargetName, Platform.ToString(), Configuration.ToString(), BuildArchitecture)); }
// Anonymous function that writes project configuration data private void WriteConfiguration(string ProjectName, UnrealTargetConfiguration Configuration, UnrealTargetPlatform Platform, string TargetFilePath, TargetRules TargetRulesObject, StringBuilder VCProjectFileContent, StringBuilder VCUserFileContent) { UEPlatformProjectGenerator ProjGenerator = UEPlatformProjectGenerator.GetPlatformProjectGenerator(Platform, true); if (((ProjGenerator == null) && (Platform != UnrealTargetPlatform.Unknown))) { return; } string UProjectPath = ""; bool bIsProjectTarget = UnrealBuildTool.HasUProjectFile() && Utils.IsFileUnderDirectory(TargetFilePath, UnrealBuildTool.GetUProjectPath()); // @todo Rocket: HACK: Only use long project names on the UBT command-line for out-of-root projects for now. We need to revisit all uses of HasUProjectFile and short names in general to fix this. if (bIsProjectTarget && !UnrealBuildTool.RunningRocket() && Utils.IsFileUnderDirectory(UnrealBuildTool.GetUProjectFile(), ProjectFileGenerator.RootRelativePath)) { bIsProjectTarget = false; } if (bIsProjectTarget) { UProjectPath = "\"$(SolutionDir)$(SolutionName).uproject\""; } string ProjectConfigName = StubProjectConfigurationName; string ProjectPlatformName = StubProjectPlatformName; MakeProjectPlatformAndConfigurationNames(Platform, Configuration, TargetRulesObject.ConfigurationName, out ProjectPlatformName, out ProjectConfigName); var ConfigAndPlatformName = ProjectConfigName + "|" + ProjectPlatformName; string ConditionString = "Condition=\"'$(Configuration)|$(Platform)'=='" + ConfigAndPlatformName + "'\""; { VCProjectFileContent.Append( " <ImportGroup " + ConditionString + " Label=\"PropertySheets\">" + ProjectFileGenerator.NewLine + " <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />" + ProjectFileGenerator.NewLine + " </ImportGroup>" + ProjectFileGenerator.NewLine); VCProjectFileContent.Append( " <PropertyGroup " + ConditionString + ">" + ProjectFileGenerator.NewLine); if (IsStubProject) { string ProjectRelativeUnusedDirectory = NormalizeProjectPath(Path.Combine(ProjectFileGenerator.EngineRelativePath, BuildConfiguration.BaseIntermediateFolder, "Unused")); VCProjectFileContent.Append( " <OutDir></OutDir>" + ProjectFileGenerator.NewLine + " <IntDir>" + ProjectRelativeUnusedDirectory + Path.DirectorySeparatorChar + "</IntDir>" + ProjectFileGenerator.NewLine + " <NMakeBuildCommandLine/>" + ProjectFileGenerator.NewLine + " <NMakeReBuildCommandLine/>" + ProjectFileGenerator.NewLine + " <NMakeCleanCommandLine/>" + ProjectFileGenerator.NewLine + " <NMakeOutput/>" + ProjectFileGenerator.NewLine); } else { string TargetName = Utils.GetFilenameWithoutAnyExtensions(TargetFilePath); var UBTPlatformName = IsStubProject ? StubProjectPlatformName : Platform.ToString(); var UBTConfigurationName = IsStubProject ? StubProjectConfigurationName : Configuration.ToString(); // Setup output path UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform); // Figure out if this is a monolithic build bool bShouldCompileMonolithic = BuildPlatform.ShouldCompileMonolithicBinary(Platform); bShouldCompileMonolithic |= TargetRulesObject.ShouldCompileMonolithic(Platform, Configuration); // Get the output directory string RootDirectory = Path.GetFullPath(ProjectFileGenerator.EngineRelativePath); if ((TargetRules.IsAGame(TargetRulesObject.Type) || TargetRulesObject.Type == TargetRules.TargetType.Server) && bShouldCompileMonolithic && !TargetRulesObject.bOutputToEngineBinaries) { if (UnrealBuildTool.HasUProjectFile() && Utils.IsFileUnderDirectory(TargetFilePath, UnrealBuildTool.GetUProjectPath())) { RootDirectory = Path.GetFullPath(UnrealBuildTool.GetUProjectPath()); } else { string UnrealProjectPath = UProjectInfo.GetProjectFilePath(ProjectName); if (!String.IsNullOrEmpty(UnrealProjectPath)) { RootDirectory = Path.GetDirectoryName(Path.GetFullPath(UnrealProjectPath)); } } } // Get the output directory string OutputDirectory = Path.Combine(RootDirectory, "Binaries", UBTPlatformName); // Get the executable name (minus any platform or config suffixes) string BaseExeName = TargetName; if (!bShouldCompileMonolithic && TargetRulesObject.Type != TargetRules.TargetType.Program) { // Figure out what the compiled binary will be called so that we can point the IDE to the correct file string TargetConfigurationName = TargetRulesObject.ConfigurationName; if (TargetConfigurationName != TargetRules.TargetType.Game.ToString() && TargetConfigurationName != TargetRules.TargetType.RocketGame.ToString() && TargetConfigurationName != TargetRules.TargetType.Program.ToString()) { BaseExeName = "UE4" + TargetConfigurationName; } } // Make the output file path string NMakePath = Path.Combine(OutputDirectory, BaseExeName); if (Configuration != UnrealTargetConfiguration.Development && (Configuration != UnrealTargetConfiguration.DebugGame || bShouldCompileMonolithic)) { NMakePath += "-" + UBTPlatformName + "-" + UBTConfigurationName; } NMakePath += BuildPlatform.GetActiveArchitecture(); NMakePath += BuildPlatform.GetBinaryExtension(UEBuildBinaryType.Executable); NMakePath = BuildPlatform.ModifyNMakeOutput(NMakePath); string PathStrings = (ProjGenerator != null) ? ProjGenerator.GetVisualStudioPathsEntries(Platform, Configuration, TargetRulesObject.Type, TargetFilePath, ProjectFilePath, NMakePath) : ""; if (string.IsNullOrEmpty(PathStrings) || (PathStrings.Contains("<IntDir>") == false)) { string ProjectRelativeUnusedDirectory = "$(ProjectDir)..\\Build\\Unused"; VCProjectFileContent.Append( PathStrings + " <OutDir>" + ProjectRelativeUnusedDirectory + Path.DirectorySeparatorChar + "</OutDir>" + ProjectFileGenerator.NewLine + " <IntDir>" + ProjectRelativeUnusedDirectory + Path.DirectorySeparatorChar + "</IntDir>" + ProjectFileGenerator.NewLine); } else { VCProjectFileContent.Append(PathStrings); } // Force specification of TargetName on XboxOne so that the manifest can identify the correct executable to the debugger. if (Platform == UnrealTargetPlatform.XboxOne) { VCProjectFileContent.Append(" <TargetName>$(ProjectName)"); if (Configuration != UnrealTargetConfiguration.Development) { VCProjectFileContent.Append(UBTConfigurationName); } VCProjectFileContent.Append("</TargetName>" + ProjectFileGenerator.NewLine); } // This is the standard UE4 based project NMake build line: // ..\..\Build\BatchFiles\Build.bat <TARGETNAME> <PLATFORM> <CONFIGURATION> // ie ..\..\Build\BatchFiles\Build.bat BlankProgram Win64 Debug string ProjectPlatformConfiguration = " " + TargetName + " " + UBTPlatformName + " " + UBTConfigurationName; string BatchFilesDirectoryName = Path.Combine(ProjectFileGenerator.EngineRelativePath, "Build", "BatchFiles"); // NMake Build command line VCProjectFileContent.Append(" <NMakeBuildCommandLine>"); VCProjectFileContent.Append(EscapePath(NormalizeProjectPath(Path.Combine(BatchFilesDirectoryName, "Build.bat"))) + ProjectPlatformConfiguration.ToString()); if (bIsProjectTarget) { VCProjectFileContent.Append(" " + UProjectPath + (UnrealBuildTool.RunningRocket() ? " -rocket" : "")); } VCProjectFileContent.Append("</NMakeBuildCommandLine>" + ProjectFileGenerator.NewLine); // NMake ReBuild command line VCProjectFileContent.Append(" <NMakeReBuildCommandLine>"); VCProjectFileContent.Append(EscapePath(NormalizeProjectPath(Path.Combine(BatchFilesDirectoryName, "Rebuild.bat"))) + ProjectPlatformConfiguration.ToString()); if (bIsProjectTarget) { VCProjectFileContent.Append(" " + UProjectPath + (UnrealBuildTool.RunningRocket() ? " -rocket" : "")); } VCProjectFileContent.Append("</NMakeReBuildCommandLine>" + ProjectFileGenerator.NewLine); // NMake Clean command line VCProjectFileContent.Append(" <NMakeCleanCommandLine>"); VCProjectFileContent.Append(EscapePath(NormalizeProjectPath(Path.Combine(BatchFilesDirectoryName, "Clean.bat"))) + ProjectPlatformConfiguration.ToString()); if (bIsProjectTarget) { VCProjectFileContent.Append(" " + UProjectPath + (UnrealBuildTool.RunningRocket() ? " -rocket" : "")); } VCProjectFileContent.Append("</NMakeCleanCommandLine>" + ProjectFileGenerator.NewLine); VCProjectFileContent.Append(" <NMakeOutput>"); VCProjectFileContent.Append(NormalizeProjectPath(NMakePath)); VCProjectFileContent.Append("</NMakeOutput>" + ProjectFileGenerator.NewLine); } VCProjectFileContent.Append(" </PropertyGroup>" + ProjectFileGenerator.NewLine); if (VCUserFileContent != null) { if (UnrealBuildTool.HasUProjectFile()) { if ((Platform == UnrealTargetPlatform.Win32) || (Platform == UnrealTargetPlatform.Win64)) { VCUserFileContent.Append( " <PropertyGroup " + ConditionString + ">" + ProjectFileGenerator.NewLine); if ((TargetRulesObject.Type != TargetRules.TargetType.RocketGame) && (TargetRulesObject.Type != TargetRules.TargetType.Game)) { string DebugOptions = UProjectPath; if(DebugOptions.Length == 0 && TargetRulesObject.Type == TargetRules.TargetType.Editor && ProjectName != "UE4") { DebugOptions += ProjectName; } if (Configuration == UnrealTargetConfiguration.Debug || Configuration == UnrealTargetConfiguration.DebugGame) { DebugOptions += " -debug"; } else if (Configuration == UnrealTargetConfiguration.Shipping) { DebugOptions += " -shipping"; } VCUserFileContent.Append( " <LocalDebuggerCommandArguments>" + DebugOptions + "</LocalDebuggerCommandArguments>" + ProjectFileGenerator.NewLine ); } VCUserFileContent.Append( " <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>" + ProjectFileGenerator.NewLine ); VCUserFileContent.Append( " </PropertyGroup>" + ProjectFileGenerator.NewLine ); } } string PlatformUserFileStrings = (ProjGenerator != null) ? ProjGenerator.GetVisualStudioUserFileStrings(Platform, Configuration, ConditionString, TargetRulesObject, TargetFilePath, ProjectFilePath) : ""; VCUserFileContent.Append(PlatformUserFileStrings); } } string LayoutDirString = (ProjGenerator != null) ? ProjGenerator.GetVisualStudioLayoutDirSection(Platform, Configuration, ConditionString, TargetRulesObject.Type, TargetFilePath, ProjectFilePath) : ""; VCProjectFileContent.Append(LayoutDirString); }
/// <summary> /// Return a list of "test name", "UAT command" pairs for testing a monolithic /// </summary> public virtual Dictionary<string, string> GUBP_GetClientServerTests_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform AltHostPlatform, UnrealTargetPlatform ServerPlatform, UnrealTargetPlatform ClientPlatform) { var Result = new Dictionary<string, string>(); #if false // needs work if ((ServerPlatform == HostPlatform || ServerPlatform == AltHostPlatform) && (ClientPlatform == HostPlatform || ClientPlatform == AltHostPlatform) && Type == TargetType.Game) // for now, we will only run these for the dev config of the host platform and only the game executable, not sure how to deal with a client only executable { Result.Add("CookedNetTest", "BuildCookRun -run -skipcook -stage -pak -deploy -unattended -server -nullrhi -NoP4 -addcmdline=\"-nosteam\" -platform=" + ClientPlatform.ToString() + " -serverplatform=" + ServerPlatform.ToString()); } #endif return Result; }
/** Given a UBT-built binary name (e.g. "Core"), returns a relative path to the binary for the current build configuration (e.g. "../Binaries/Win64/Core-Win64-Debug.lib") */ public static string[] MakeBinaryPaths(string ModuleName, string BinaryName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, UEBuildBinaryType BinaryType, TargetRules.TargetType? TargetType, PluginInfo PluginInfo, string AppName, bool bForceNameAsForDevelopment = false, string ExeBinariesSubFolder = null) { // Determine the binary extension for the platform and binary type. var BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform); string BinaryExtension = BuildPlatform.GetBinaryExtension(BinaryType); UnrealTargetConfiguration LocalConfig = Configuration; if(Configuration == UnrealTargetConfiguration.DebugGame && !String.IsNullOrEmpty(ModuleName) && !RulesCompiler.IsGameModule(ModuleName)) { LocalConfig = UnrealTargetConfiguration.Development; } string ModuleBinariesSubDir = ""; if (BinaryType == UEBuildBinaryType.DynamicLinkLibrary && (string.IsNullOrEmpty(ModuleName) == false)) { // Allow for modules to specify sub-folders in the Binaries folder var RulesFilename = RulesCompiler.GetModuleFilename(ModuleName); // Plugins can be binary-only and can have no rules object if (PluginInfo == null || !String.IsNullOrEmpty(RulesFilename)) { ModuleRules ModuleRulesObj = RulesCompiler.CreateModuleRules(ModuleName, new TargetInfo(Platform, Configuration, TargetType), out RulesFilename); if (ModuleRulesObj != null) { ModuleBinariesSubDir = ModuleRulesObj.BinariesSubFolder; } } } else if ( BinaryType == UEBuildBinaryType.Executable && string.IsNullOrEmpty(ExeBinariesSubFolder) == false ) { ModuleBinariesSubDir = ExeBinariesSubFolder; } //@todo.Rocket: This just happens to work since exp and lib files go into intermediate... // Build base directory string ("../Binaries/<Platform>/") string BinariesDirName; if(TargetType.HasValue && TargetType.Value == TargetRules.TargetType.Program && UnrealBuildTool.HasUProjectFile() && !ProjectFileGenerator.bGenerateProjectFiles) { BinariesDirName = Path.Combine( UnrealBuildTool.GetUProjectPath(), "Binaries" ); } else if( PluginInfo != null ) { BinariesDirName = Path.Combine( PluginInfo.Directory, "Binaries" ); } else { BinariesDirName = Path.Combine( "..", "Binaries" ); } var BaseDirectory = Path.Combine( BinariesDirName, Platform.ToString()); if (ModuleBinariesSubDir.Length > 0) { BaseDirectory = Path.Combine(BaseDirectory, ModuleBinariesSubDir); } string BinarySuffix = ""; if ((PluginInfo != null) && (BinaryType != UEBuildBinaryType.DynamicLinkLibrary)) { BinarySuffix = "-Static"; } // append the architecture to the end of the binary name BinarySuffix = BuildPlatform.ApplyArchitectureName(BinarySuffix); string OutBinaryPath = ""; // Append binary file name string Prefix = ""; if (Platform == UnrealTargetPlatform.Linux && (BinaryType == UEBuildBinaryType.DynamicLinkLibrary || BinaryType == UEBuildBinaryType.StaticLibrary)) { Prefix = "lib"; } if (LocalConfig == UnrealTargetConfiguration.Development || bForceNameAsForDevelopment) { OutBinaryPath = Path.Combine(BaseDirectory, String.Format("{3}{0}{1}{2}", BinaryName, BinarySuffix, BinaryExtension, Prefix)); } else { OutBinaryPath = Path.Combine(BaseDirectory, String.Format("{5}{0}-{1}-{2}{3}{4}", BinaryName, Platform.ToString(), LocalConfig.ToString(), BinarySuffix, BinaryExtension, Prefix)); } return BuildPlatform.FinalizeBinaryPaths(OutBinaryPath); }
/// <summary> /// Makes a filename (without path) for a compiled binary (e.g. "Core-Win64-Debug.lib") */ /// </summary> /// <param name="BinaryName">The name of this binary</param> /// <param name="Platform">The platform being built for</param> /// <param name="Configuration">The configuration being built</param> /// <param name="UndecoratedConfiguration">The target configuration which doesn't require a platform and configuration suffix. Development by default.</param> /// <param name="BinaryType">Type of binary</param> /// <returns>Name of the binary</returns> public static string MakeBinaryFileName(string BinaryName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, UnrealTargetConfiguration UndecoratedConfiguration, UEBuildBinaryType BinaryType) { StringBuilder Result = new StringBuilder(); if (Platform == UnrealTargetPlatform.Linux && (BinaryType == UEBuildBinaryType.DynamicLinkLibrary || BinaryType == UEBuildBinaryType.StaticLibrary)) { Result.Append("lib"); } Result.Append(BinaryName); if(Configuration != UndecoratedConfiguration) { Result.AppendFormat("-{0}-{1}", Platform.ToString(), Configuration.ToString()); } IUEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform); Result.Append(BuildPlatform.ApplyArchitectureName("")); if (BuildConfiguration.bRunUnrealCodeAnalyzer) { Result.AppendFormat("-{0}.analysis", BuildConfiguration.UCAModuleToAnalyze); } else { Result.Append(BuildPlatform.GetBinaryExtension(BinaryType)); } return Result.ToString(); }
public override string ToString() { return(Type.ToString()); }
public override string ToString() { return(Architecture == "" ? Platform.ToString() : Platform.ToString() + "_" + Architecture); }
private static ProcessResult RunDedicatedServer(ProjectParams Params, string ServerLogFile, string AdditionalCommandLine) { ProjectParams ServerParams = new ProjectParams(Params); ServerParams.Device = Params.ServerDevice; if (ServerParams.ServerTargetPlatforms.Count == 0) { throw new AutomationException("No ServerTargetPlatform set for RunDedicatedServer."); } var DeployContextList = CreateDeploymentContext(ServerParams, true); if (DeployContextList.Count == 0) { throw new AutomationException("No DeployContextList for RunDedicatedServer."); } var SC = DeployContextList[0]; var ServerApp = CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries/Win64/UE4Editor.exe"); if (ServerParams.Cook) { List <string> Exes = SC.StageTargetPlatform.GetExecutableNames(SC); ServerApp = Exes[0]; } var Args = ServerParams.Cook ? "" : (SC.ProjectArgForCommandLines + " "); Console.WriteLine(Params.ServerDeviceAddress); UnrealTargetPlatform ServerPlatform = ServerParams.ServerTargetPlatforms[0]; if (ServerParams.Cook && ServerPlatform == UnrealTargetPlatform.Linux && !String.IsNullOrEmpty(ServerParams.ServerDeviceAddress)) { ServerApp = @"C:\Windows\system32\cmd.exe"; string plinkPath = CombinePaths(Environment.GetEnvironmentVariable("LINUX_ROOT"), "bin/PLINK.exe "); string exePath = CombinePaths(SC.ShortProjectName, "Binaries", ServerPlatform.ToString(), SC.ShortProjectName + "Server"); if (ServerParams.ServerConfigsToBuild[0] != UnrealTargetConfiguration.Development) { exePath += "-" + ServerPlatform.ToString() + "-" + ServerParams.ServerConfigsToBuild[0].ToString(); } exePath = CombinePaths("LinuxServer", exePath.ToLower()).Replace("\\", "/"); Args = String.Format("/k {0} -batch -ssh -t -i {1} {2}@{3} {4} {5} {6} -server -Messaging", plinkPath, ServerParams.DevicePassword, ServerParams.DeviceUsername, ServerParams.ServerDeviceAddress, exePath, Args, ServerParams.MapToRun); } else { var Map = ServerParams.MapToRun; if (!String.IsNullOrEmpty(ServerParams.AdditionalServerMapParams)) { Map += ServerParams.AdditionalServerMapParams; } if (Params.FakeClient) { Map += "?fake"; } Args += String.Format("{0} -server -abslog={1} -unattended -FORCELOGFLUSH -log -Messaging -nomcp", Map, CommandUtils.MakePathSafeToUseWithCommandLine(ServerLogFile)); } if (ServerParams.UsePak(SC.StageTargetPlatform) || ServerParams.SignedPak) { if (ServerParams.SignedPak) { Args += " -signedpak"; } else { Args += " -pak"; } } if (IsBuildMachine || Params.Unattended) { Args += " -buildmachine"; } Args += " -CrashForUAT"; Args += " " + AdditionalCommandLine; if (ServerParams.Cook && ServerPlatform == UnrealTargetPlatform.Linux && !String.IsNullOrEmpty(ServerParams.ServerDeviceAddress)) { Args += String.Format(" 2>&1 > {0}", ServerLogFile); } PushDir(Path.GetDirectoryName(ServerApp)); var Result = Run(ServerApp, Args, null, ERunOptions.AllowSpew | ERunOptions.NoWaitForExit | ERunOptions.AppMustExist | ERunOptions.NoStdOutRedirect); PopDir(); return(Result); }
/// <summary> /// Given a target platform and configuration, generates a platform and configuration name string to use in Visual Studio projects. /// Unlike with solution configurations, Visual Studio project configurations only support certain types of platforms, so we'll /// generate a configuration name that has the platform "built in", and use a default platform type /// </summary> /// <param name="Platform">Actual platform</param> /// <param name="Configuration">Actual configuration</param> /// <param name="TargetConfigurationName">The configuration name from the target rules, or null if we don't have one</param> /// <param name="ProjectPlatformName">Name of platform string to use for Visual Studio project</param> /// <param name="ProjectConfigurationName">Name of configuration string to use for Visual Studio project</param> public void MakeProjectPlatformAndConfigurationNames(UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string TargetConfigurationName, out string ProjectPlatformName, out string ProjectConfigurationName) { if (IsStubProject) { if (Platform != UnrealTargetPlatform.Unknown || Configuration != UnrealTargetConfiguration.Unknown) { throw new BuildException("Stub project was expecting platform and configuration type to be set to Unknown"); } ProjectPlatformName = StubProjectPlatformName; ProjectConfigurationName = StubProjectConfigurationName; } else { // If this is a C# project, then the project platform name must always be "Any CPU" if (this is VCSharpProjectFile) { ProjectConfigurationName = Configuration.ToString(); ProjectPlatformName = VCProjectFileGenerator.DotNetPlatformName; } else { var PlatformProjectGenerator = UEPlatformProjectGenerator.GetPlatformProjectGenerator(Platform, bInAllowFailure: true); // Check to see if this platform is supported directly by Visual Studio projects. bool HasActualVSPlatform = (PlatformProjectGenerator != null) ? PlatformProjectGenerator.HasVisualStudioSupport(Platform, Configuration) : false; if (HasActualVSPlatform) { // Great! Visual Studio supports this platform natively, so we don't need to make up // a fake project configuration name. // Allow the platform to specify the name used in VisualStudio. // Note that the actual name of the platform on the Visual Studio side may be different than what // UnrealBuildTool calls it (e.g. "Win64" -> "x64".) GetVisualStudioPlatformName() will figure this out. ProjectConfigurationName = Configuration.ToString(); ProjectPlatformName = PlatformProjectGenerator.GetVisualStudioPlatformName(Platform, Configuration); } else { // Visual Studio doesn't natively support this platform, so we fake it by mapping it to // a project configuration that has the platform name in that configuration as a suffix, // and then using "Win32" as the actual VS platform name ProjectConfigurationName = ProjectConfigurationNameOverride == "" ? Platform.ToString() + "_" + Configuration.ToString() : ProjectConfigurationNameOverride; ProjectPlatformName = ProjectPlatformNameOverride == "" ? VCProjectFileGenerator.DefaultPlatformName : ProjectPlatformNameOverride; } if( !String.IsNullOrEmpty( TargetConfigurationName ) ) { ProjectConfigurationName += "_" + TargetConfigurationName; } } } }
/// <summary> /// Given a platform, a build config, and true/false for client, returns the path to the binary for that config. E.g. /// Win64, Shipping, false = Binaries\Win64\FooServer-Win64-Shipping.exe /// </summary> /// <param name="TargetPlatform"></param> /// <param name="BuildConfig"></param> /// <param name="IsClient"></param> /// <returns></returns> virtual public string GetRelativeExecutablePath(UnrealTargetRole TargetType, UnrealTargetPlatform TargetPlatform, UnrealTargetConfiguration TargetConfiguration) { string ExePath; if (TargetType.UsesEditor()) { ExePath = string.Format("Engine/Binaries/{0}/UE4Editor{1}", BuildHostPlatform.Current.Platform, Platform.GetExeExtension(TargetPlatform)); } else { string BuildType = ""; if (TargetType == UnrealTargetRole.Client) { if (!UsesSharedBuildType) { BuildType = "Client"; } } else if (TargetType == UnrealTargetRole.Server) { if (!UsesSharedBuildType) { BuildType = "Server"; } } bool IsRunningDev = Globals.Params.ParseParam("dev"); // Turn FooGame into Foo string ExeBase = ProjectName.Replace("Game", ""); if (TargetPlatform == UnrealTargetPlatform.Android) { // use the archive results for android. //var AndroidSource = new AndroidBuild(ProjectName, GetPlatformPath(TargetType, TargetPlatform), TargetConfiguration); // We always (currently..) need to be able to replace the command line BuildFlags Flags = BuildFlags.CanReplaceCommandLine; if (IsRunningDev) { Flags |= BuildFlags.CanReplaceExecutable; } if (Globals.Params.ParseParam("bulk")) { Flags |= BuildFlags.Bulk; } else if (Globals.Params.ParseParam("notbulk")) { Flags |= BuildFlags.NotBulk; } var Build = GetMatchingBuilds(TargetType, TargetPlatform, TargetConfiguration, Flags).FirstOrDefault(); if (Build != null) { AndroidBuild AndroidBuild = Build as AndroidBuild; ExePath = AndroidBuild.SourceApkPath; } else { throw new AutomationException("No suitable build for {0} found at {1}", TargetPlatform, string.Join(",", BuildPaths)); } //ExePath = AndroidSource.SourceApkPath; } else { string ExeFileName = string.Format("{0}{1}", ExeBase, BuildType); if (TargetConfiguration != UnrealTargetConfiguration.Development) { ExeFileName += string.Format("-{0}-{1}", TargetPlatform.ToString(), TargetConfiguration.ToString()); } ExeFileName += Platform.GetExeExtension(TargetPlatform); string BasePath = GetPlatformPath(TargetType, TargetPlatform); string ProjectBinary = string.Format("{0}\\Binaries\\{1}\\{2}", ProjectName, TargetPlatform.ToString(), ExeFileName); string StubBinary = Path.Combine(BasePath, ExeFileName); string DevBinary = Path.Combine(Environment.CurrentDirectory, ProjectBinary); string NonCodeProjectName = "UE4Game" + Platform.GetExeExtension(TargetPlatform); string NonCodeProjectBinary = Path.Combine(BasePath, "Engine", "Binaries", TargetPlatform.ToString()); NonCodeProjectBinary = Path.Combine(NonCodeProjectBinary, NonCodeProjectName); // check the project binaries folder if (File.Exists(Path.Combine(BasePath, ProjectBinary))) { ExePath = ProjectBinary; } else if (File.Exists(StubBinary)) { ExePath = Path.Combine(BasePath, ExeFileName); } else if (IsRunningDev && File.Exists(DevBinary)) { ExePath = DevBinary; } else if (File.Exists(NonCodeProjectBinary)) { ExePath = NonCodeProjectBinary; } else { List <string> CheckedFiles = new List <String>() { Path.Combine(BasePath, ProjectBinary), StubBinary, NonCodeProjectBinary }; if (IsRunningDev) { CheckedFiles.Add(DevBinary); } throw new AutomationException("Executable not found, upstream compile job may have failed. Could not find executable {0} within {1}, binaries checked: {2}", ExeFileName, BasePath, String.Join(" - ", CheckedFiles)); } } } return(Utils.SystemHelpers.CorrectDirectorySeparators(ExePath)); }
public override void AddNodes(GUBP bp, UnrealTargetPlatform HostPlatform) { if(!bp.BranchOptions.bNoInstalledEngine) { // Find all the target platforms for this host platform. List<UnrealTargetPlatform> TargetPlatforms = GetTargetPlatforms(bp, HostPlatform); // Remove any platforms that aren't available on this machine TargetPlatforms.RemoveAll(x => !bp.ActivePlatforms.Contains(x)); // Get the temp directory for stripped files for this host string StrippedDir = Path.GetFullPath(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Saved", "Rocket", HostPlatform.ToString())); // Strip the host platform if (StripRocketNode.IsRequiredForPlatform(HostPlatform)) { bp.AddNode(new StripRocketToolsNode(HostPlatform, StrippedDir)); bp.AddNode(new StripRocketEditorNode(HostPlatform, StrippedDir)); } // Strip all the target platforms that are built on this host foreach (UnrealTargetPlatform TargetPlatform in TargetPlatforms) { if (GetSourceHostPlatform(bp, HostPlatform, TargetPlatform) == HostPlatform && StripRocketNode.IsRequiredForPlatform(TargetPlatform)) { bp.AddNode(new StripRocketMonolithicsNode(bp, HostPlatform, TargetPlatform, StrippedDir)); } } // Build the DDC bp.AddNode(new BuildDerivedDataCacheNode(HostPlatform, GetCookPlatforms(HostPlatform, TargetPlatforms), CurrentFeaturePacks)); // Generate a list of files that needs to be copied for each target platform bp.AddNode(new FilterRocketNode(bp, HostPlatform, TargetPlatforms, CurrentFeaturePacks, CurrentTemplates)); // Copy the install to the output directory string LocalOutputDir = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "LocalBuilds", "Rocket", CommandUtils.GetGenericPlatformName(HostPlatform)); bp.AddNode(new GatherRocketNode(HostPlatform, TargetPlatforms, LocalOutputDir)); // Add the aggregate node for the entire install GUBP.GUBPNode PromotableNode = bp.FindNode(GUBP.SharedAggregatePromotableNode.StaticGetFullName()); PromotableNode.AddDependency(FilterRocketNode.StaticGetFullName(HostPlatform)); PromotableNode.AddDependency(BuildDerivedDataCacheNode.StaticGetFullName(HostPlatform)); // Add a node for GitHub promotions if(HostPlatform == UnrealTargetPlatform.Win64) { string GitConfigRelativePath = "Engine/Build/Git/UnrealBot.ini"; if(CommandUtils.FileExists(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, GitConfigRelativePath))) { bp.AddNode(new BuildGitPromotable(bp, HostPlatform, GitConfigRelativePath)); PromotableNode.AddDependency(BuildGitPromotable.StaticGetFullName(HostPlatform)); } } // Get the output directory for the build zips string PublishedEngineDir; if(ShouldDoSeriousThingsLikeP4CheckinAndPostToMCP()) { PublishedEngineDir = CommandUtils.CombinePaths(CommandUtils.RootSharedTempStorageDirectory(), "Rocket", "Automated", GetBuildLabel(), CommandUtils.GetGenericPlatformName(HostPlatform)); } else { PublishedEngineDir = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "LocalBuilds", "RocketPublish", CommandUtils.GetGenericPlatformName(HostPlatform)); } // Publish the install to the network bp.AddNode(new PublishRocketNode(HostPlatform, LocalOutputDir, PublishedEngineDir)); bp.AddNode(new PublishRocketSymbolsNode(bp, HostPlatform, TargetPlatforms, PublishedEngineDir + "Symbols")); // Add a dependency on this being published as part of the shared promotable being labeled GUBP.SharedLabelPromotableSuccessNode LabelPromotableNode = (GUBP.SharedLabelPromotableSuccessNode)bp.FindNode(GUBP.SharedLabelPromotableSuccessNode.StaticGetFullName()); LabelPromotableNode.AddDependency(PublishRocketNode.StaticGetFullName(HostPlatform)); LabelPromotableNode.AddDependency(PublishRocketSymbolsNode.StaticGetFullName(HostPlatform)); // Add dependencies on a promotable to do these steps too GUBP.WaitForSharedPromotionUserInput WaitForPromotionNode = (GUBP.WaitForSharedPromotionUserInput)bp.FindNode(GUBP.WaitForSharedPromotionUserInput.StaticGetFullName(true)); WaitForPromotionNode.AddDependency(PublishRocketNode.StaticGetFullName(HostPlatform)); WaitForPromotionNode.AddDependency(PublishRocketSymbolsNode.StaticGetFullName(HostPlatform)); // Push everything behind the promotion triggers if we're doing things on the build machines if(ShouldDoSeriousThingsLikeP4CheckinAndPostToMCP() || bp.ParseParam("WithRocketPromotable")) { string WaitForTrigger = GUBP.WaitForSharedPromotionUserInput.StaticGetFullName(false); GatherRocketNode GatherRocket = (GatherRocketNode)bp.FindNode(GatherRocketNode.StaticGetFullName(HostPlatform)); GatherRocket.AddDependency(WaitForTrigger); PublishRocketSymbolsNode PublishRocketSymbols = (PublishRocketSymbolsNode)bp.FindNode(PublishRocketSymbolsNode.StaticGetFullName(HostPlatform)); PublishRocketSymbols.AddDependency(WaitForTrigger); } } }
public bool IsTestBlacklisted(string InNodeName, UnrealTargetPlatform InPlatform, string InBranchName) { // find any references to this test irrespective of platform & branch IEnumerable <BlacklistEntry> Entries = BlacklistEntries.Where(E => E.TestName == InNodeName); string NormalizedBranchName = InBranchName.Replace("/", "+"); // Filter by branch Entries = Entries.Where(E => E.BranchName == "*" || string.Equals(E.BranchName, NormalizedBranchName, StringComparison.OrdinalIgnoreCase)); // Filter by branch Entries = Entries.Where(E => E.Platforms.Length == 0 || E.Platforms.Contains(InPlatform.ToString())); return(Entries.Count() > 0); }