void XGEFinishBuildWithUBT(XGEItem Item) { // allow the platform to perform any actions after building a target (seems almost like this should be done in UBT) Platform.Platforms[Item.Platform].PostBuildTarget(this, Item.ProjectName, Item.UProjectPath, Item.Config); foreach (string ManifestItem in Item.Manifest.BuildProducts) { if (!FileExists_NoExceptions(ManifestItem)) { throw new AutomationException("BUILD FAILED {0} was in manifest but was not produced.", ManifestItem); } AddBuildProduct(ManifestItem); } }
XGEItem XGEPrepareBuildWithUBT(string ProjectName, string TargetName, UnrealBuildTool.UnrealTargetPlatform Platform, string Config, string UprojectPath, bool ForceMonolithic = false, bool ForceNonUnity = false, bool ForceDebugInfo = false, string InAddArgs = "", bool ForceUnity = false, Dictionary<string, string> EnvVars = null) { string AddArgs = ""; if (string.IsNullOrEmpty(UprojectPath) == false) { AddArgs += " " + CommandUtils.MakePathSafeToUseWithCommandLine(UprojectPath); } AddArgs += " " + InAddArgs; if (ForceMonolithic) { AddArgs += " -monolithic"; } if (ForceNonUnity) { AddArgs += " -disableunity"; } if (ForceUnity) { AddArgs += " -forceunity"; } if (ForceDebugInfo) { AddArgs += " -forcedebuginfo"; } if(AddArgs.Contains("PostedRocket")) { if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealBuildTool.UnrealTargetPlatform.Win64) { BaseUBTDirectory = @"Rocket/TempInst/Windows"; } if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealBuildTool.UnrealTargetPlatform.Mac) { BaseUBTDirectory = @"Rocket/TempInst/Mac"; } } PrepareUBT(); string UBTManifest = GetUBTManifest(UprojectPath, AddArgs); DeleteFile(UBTManifest); XGEItem Result = new XGEItem(); ClearExportedXGEXML(); RunUBT(CmdEnv, UBTExecutable: UBTExecutable, Project: ProjectName, Target: TargetName, Platform: Platform.ToString(), Config: Config, AdditionalArgs: "-generatemanifest -nobuilduht -xgeexport" + AddArgs, EnvVars: EnvVars); PrepareManifest(UBTManifest); Result.Platform = Platform; Result.Config = Config; Result.ProjectName = string.IsNullOrEmpty(ProjectName) ? TargetName : ProjectName; // use the target as the project if no project is set Result.UProjectPath = UprojectPath; Result.Manifest = ReadManifest(UBTManifest); Result.OutputCaption = String.Format("{0}-{1}-{2}", Path.GetFileNameWithoutExtension(Result.ProjectName), Platform.ToString(), Config.ToString()); DeleteFile(UBTManifest); Result.CommandLine = UBTExecutable + " " + UBTCommandline(Project: ProjectName, Target: TargetName, Platform: Platform.ToString(), Config: Config, AdditionalArgs: "-noxge -nobuilduht" + AddArgs); Result.XgeXmlFiles = new List<string>(); foreach (var XGEFile in FindXGEFiles()) { if (!FileExists_NoExceptions(XGEFile)) { throw new AutomationException("BUILD FAILED: Couldn't find file: {0}", XGEFile); } int FileNum = 0; string OutFile; while (true) { OutFile = CombinePaths(CmdEnv.LogFolder, String.Format("UBTExport.{0}.xge.xml", FileNum)); FileInfo ItemInfo = new FileInfo(OutFile); if (!ItemInfo.Exists) { break; } FileNum++; } CopyFile(XGEFile, OutFile); Result.XgeXmlFiles.Add(OutFile); } ClearExportedXGEXML(); return Result; }
XGEItem XGEPrepareBuildWithUBT(string TargetName, UnrealBuildTool.UnrealTargetPlatform Platform, string Config, FileReference UprojectPath, bool ForceMonolithic = false, bool ForceNonUnity = false, bool ForceDebugInfo = false, string InAddArgs = "", bool ForceUnity = false, Dictionary<string, string> EnvVars = null) { string AddArgs = ""; if (UprojectPath != null) { AddArgs += " " + CommandUtils.MakePathSafeToUseWithCommandLine(UprojectPath.FullName); } AddArgs += " " + InAddArgs; if (ForceMonolithic) { AddArgs += " -monolithic"; } if (ForceNonUnity) { AddArgs += " -disableunity"; } if (ForceUnity) { AddArgs += " -forceunity"; } if (ForceDebugInfo) { AddArgs += " -forcedebuginfo"; } PrepareUBT(); string UBTManifest = GetUBTManifest(UprojectPath, AddArgs); DeleteFile(UBTManifest); XGEItem Result = new XGEItem(); ClearExportedXGEXML(); using(TelemetryStopwatch GenerateManifestStopwatch = new TelemetryStopwatch("GenerateXGEManifest.{0}.{1}.{2}", TargetName, Platform.ToString(), Config)) { RunUBT(CmdEnv, UBTExecutable: UBTExecutable, Project: UprojectPath, Target: TargetName, Platform: Platform.ToString(), Config: Config, AdditionalArgs: "-generatemanifest -nobuilduht -xgeexport" + AddArgs, EnvVars: EnvVars); } PrepareManifest(UBTManifest, true); Result.Platform = Platform; Result.Config = Config; Result.TargetName = TargetName; Result.UProjectPath = UprojectPath; Result.Manifest = ReadManifest(UBTManifest); Result.OutputCaption = String.Format("{0}-{1}-{2}", TargetName, Platform.ToString(), Config.ToString()); DeleteFile(UBTManifest); Result.CommandLine = UBTExecutable + " " + UBTCommandline(Project: UprojectPath, Target: TargetName, Platform: Platform.ToString(), Config: Config, AdditionalArgs: "-noxge -nobuilduht" + AddArgs); Result.XgeXmlFiles = new List<string>(); foreach (var XGEFile in FindXGEFiles()) { if (!FileExists_NoExceptions(XGEFile)) { throw new AutomationException("BUILD FAILED: Couldn't find file: {0}", XGEFile); } int FileNum = 0; string OutFile; while (true) { OutFile = CombinePaths(CmdEnv.LogFolder, String.Format("UBTExport.{0}.xge.xml", FileNum)); FileInfo ItemInfo = new FileInfo(OutFile); if (!ItemInfo.Exists) { break; } FileNum++; } CopyFile(XGEFile, OutFile); Result.XgeXmlFiles.Add(OutFile); } ClearExportedXGEXML(); return Result; }