/// <summary> /// Execute the task. /// </summary> /// <param name="Job">Information about the current job</param> /// <param name="BuildProducts">Set of build products produced by this node.</param> /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param> public override void Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet) { // Figure out the project that this target belongs to FileReference ProjectFile = null; if (Parameters.Project != null) { ProjectFile = new FileReference(Parameters.Project); if (!FileReference.Exists(ProjectFile)) { throw new AutomationException("Missing project file - {0}", ProjectFile.FullName); } } // Execute the cooker using (TelemetryStopwatch CookStopwatch = new TelemetryStopwatch("Cook.{0}.{1}", (ProjectFile == null)? "UE4" : ProjectFile.GetFileNameWithoutExtension(), Parameters.Platform)) { string[] Maps = (Parameters.Maps == null)? null : Parameters.Maps.Split(new char[] { '+' }); string Arguments = (Parameters.Versioned ? "" : "-Unversioned ") + "-LogCmds=\"LogSavePackage Warning\" " + Parameters.Arguments; CommandUtils.CookCommandlet(ProjectFile, "UE4Editor-Cmd.exe", Maps, null, null, null, Parameters.Platform, Arguments); } // Find all the cooked files List <FileReference> CookedFiles = new List <FileReference>(); foreach (string Platform in Parameters.Platform.Split('+')) { DirectoryReference PlatformCookedDirectory = DirectoryReference.Combine(ProjectFile.Directory, "Saved", "Cooked", Platform); if (!DirectoryReference.Exists(PlatformCookedDirectory)) { throw new AutomationException("Cook output directory not found ({0})", PlatformCookedDirectory.FullName); } List <FileReference> PlatformCookedFiles = DirectoryReference.EnumerateFiles(PlatformCookedDirectory, "*", System.IO.SearchOption.AllDirectories).ToList(); if (PlatformCookedFiles.Count == 0) { throw new AutomationException("Cooking did not produce any files in {0}", PlatformCookedDirectory.FullName); } CookedFiles.AddRange(PlatformCookedFiles); DirectoryReference PackagingFilesDirectory = DirectoryReference.Combine(ProjectFile.Directory, "Saved", "TmpPackaging", Platform); if (DirectoryReference.Exists(PackagingFilesDirectory)) { List <FileReference> PackagingFiles = DirectoryReference.EnumerateFiles(PackagingFilesDirectory, "*", System.IO.SearchOption.AllDirectories).ToList(); CookedFiles.AddRange(PackagingFiles); } } // Apply the optional tag to the build products foreach (string TagName in FindTagNamesFromList(Parameters.Tag)) { FindOrAddTagSet(TagNameToFileSet, TagName).UnionWith(CookedFiles); } // Add them to the set of build products BuildProducts.UnionWith(CookedFiles); }
/// <summary> /// Execute the task. /// </summary> /// <param name="Job">Information about the current job</param> /// <param name="BuildProducts">Set of build products produced by this node.</param> /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param> /// <returns>True if the task succeeded</returns> public override bool Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet) { // Figure out the project that this target belongs to FileReference ProjectFile = null; if (Parameters.Project != null) { ProjectFile = new FileReference(Parameters.Project); if (!ProjectFile.Exists()) { CommandUtils.LogError("Missing project file - {0}", ProjectFile.FullName); return(false); } } // Execute the cooker using (TelemetryStopwatch CookStopwatch = new TelemetryStopwatch("Cook.{0}.{1}", (ProjectFile == null)? "UE4" : ProjectFile.GetFileNameWithoutExtension(), Parameters.Platform)) { string[] Maps = (Parameters.Maps == null)? null : Parameters.Maps.Split(new char[] { '+' }); CommandUtils.CookCommandlet(ProjectFile, "UE4Editor-Cmd.exe", Maps, null, null, null, Parameters.Platform, (Parameters.Versioned? "" : "-Unversioned ") + Parameters.Arguments); } // Find all the cooked files DirectoryReference CookedDirectory = DirectoryReference.Combine(ProjectFile.Directory, "Saved", "Cooked", Parameters.Platform); if (!CookedDirectory.Exists()) { CommandUtils.LogError("Cook output directory not found ({0})", CookedDirectory.FullName); return(false); } List <FileReference> CookedFiles = CookedDirectory.EnumerateFileReferences("*", System.IO.SearchOption.AllDirectories).ToList(); if (CookedFiles.Count == 0) { CommandUtils.LogError("Cooking did not produce any files in {0}", CookedDirectory.FullName); return(false); } // Apply the optional tag to the build products if (!String.IsNullOrEmpty(Parameters.Tag)) { FindOrAddTagSet(TagNameToFileSet, Parameters.Tag).UnionWith(CookedFiles); } // Add them to the set of build products BuildProducts.UnionWith(CookedFiles); return(true); }