/// <summary> /// Fills a list with all the target names in this assembly /// </summary> /// <param name="TargetNames">List to receive the target names</param> /// <param name="bIncludeParentAssembly">Whether to include targets in the parent assembly</param> public void GetAllTargetNames(List <string> TargetNames, bool bIncludeParentAssembly) { if (Parent != null && bIncludeParentAssembly) { Parent.GetAllTargetNames(TargetNames, true); } TargetNames.AddRange(TargetNameToTargetFile.Keys); }
/// <summary> /// Writes information about the targets in an assembly to a file /// </summary> /// <param name="ProjectFile">The project file for the targets being built</param> /// <param name="Assembly">The rules assembly for this target</param> /// <param name="OutputFile">Output file to write to</param> /// <param name="Arguments"></param> public static void WriteTargetInfo(FileReference ProjectFile, RulesAssembly Assembly, FileReference OutputFile, CommandLineArguments Arguments) { // Construct all the targets in this assembly List <string> TargetNames = new List <string>(); Assembly.GetAllTargetNames(TargetNames, false); // Write the output file DirectoryReference.CreateDirectory(OutputFile.Directory); using (JsonWriter Writer = new JsonWriter(OutputFile)) { Writer.WriteObjectStart(); Writer.WriteArrayStart("Targets"); foreach (string TargetName in TargetNames) { // skip target rules that are platform extension or platform group specializations string[] TargetPathSplit = TargetName.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); if (TargetPathSplit.Length > 1 && (UnrealTargetPlatform.IsValidName(TargetPathSplit.Last()) || UnrealPlatformGroup.IsValidName(TargetPathSplit.Last()))) { continue; } // Construct the rules object TargetRules TargetRules; try { string Architecture = UEBuildPlatform.GetBuildPlatform(BuildHostPlatform.Current.Platform).GetDefaultArchitecture(ProjectFile); TargetRules = Assembly.CreateTargetRules(TargetName, BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, Architecture, ProjectFile, Arguments); } catch (Exception Ex) { Log.TraceWarning("Unable to construct target rules for {0}", TargetName); Log.TraceVerbose(ExceptionUtils.FormatException(Ex)); continue; } // Write the target info Writer.WriteObjectStart(); Writer.WriteValue("Name", TargetName); Writer.WriteValue("Path", Assembly.GetTargetFileName(TargetName).ToString()); Writer.WriteValue("Type", TargetRules.Type.ToString()); Writer.WriteObjectEnd(); } Writer.WriteArrayEnd(); Writer.WriteObjectEnd(); } }
/// <summary> /// Writes information about the targets in an assembly to a file /// </summary> /// <param name="ProjectFile">The project file for the targets being built</param> /// <param name="Assembly">The rules assembly for this target</param> /// <param name="OutputFile">Output file to write to</param> /// <param name="Arguments"></param> public static void WriteTargetInfo(FileReference ProjectFile, RulesAssembly Assembly, FileReference OutputFile, CommandLineArguments Arguments) { // Construct all the targets in this assembly List <string> TargetNames = new List <string>(); Assembly.GetAllTargetNames(TargetNames, false); // Write the output file DirectoryReference.CreateDirectory(OutputFile.Directory); using (JsonWriter Writer = new JsonWriter(OutputFile)) { Writer.WriteObjectStart(); Writer.WriteArrayStart("Targets"); foreach (string TargetName in TargetNames) { // Construct the rules object TargetRules TargetRules; try { string Architecture = UEBuildPlatform.GetBuildPlatform(BuildHostPlatform.Current.Platform).GetDefaultArchitecture(ProjectFile); TargetRules = Assembly.CreateTargetRules(TargetName, BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, Architecture, ProjectFile, Arguments); } catch (Exception Ex) { Log.TraceWarning("Unable to construct target rules for {0}", TargetName); Log.TraceVerbose(ExceptionUtils.FormatException(Ex)); continue; } // Write the target info Writer.WriteObjectStart(); Writer.WriteValue("Name", TargetName); Writer.WriteValue("Path", Assembly.GetTargetFileName(TargetName).ToString()); Writer.WriteValue("Type", TargetRules.Type.ToString()); Writer.WriteObjectEnd(); } Writer.WriteArrayEnd(); Writer.WriteObjectEnd(); } }