/// <summary> /// Retrieve the list of platforms in this group (if any) /// </summary> public static List <UnrealTargetPlatform> GetPlatformsInGroup(UnrealPlatformGroup InGroup) { List <UnrealTargetPlatform> PlatformList; PlatformGroupDictionary.TryGetValue(InGroup, out PlatformList); return(PlatformList); }
/// <summary> /// Checks if platform is part of a given platform group /// </summary> /// <param name="Platform">The platform to check</param> /// <param name="PlatformGroup">The platform group to check</param> /// <returns>True if platform is part of a platform group</returns> internal static bool IsPlatformInGroup(UnrealTargetPlatform Platform, UnrealPlatformGroup PlatformGroup) { List <UnrealTargetPlatform> Platforms = UEBuildPlatform.GetPlatformsInGroup(PlatformGroup); if (Platforms != null) { return(Platforms.Contains(Platform)); } else { return(false); } }
/// <summary> /// Gets an array of all platform folder names /// </summary> /// <returns>Array of platform folders</returns> public static string[] GetPlatformFolderNames() { if (CachedPlatformFolderNames == null) { List <string> PlatformFolderNames = new List <string>(); // Find all the platform folders to exclude from the list of precompiled modules PlatformFolderNames.AddRange(UnrealTargetPlatform.GetValidPlatformNames()); // Also exclude all the platform groups that this platform is not a part of PlatformFolderNames.AddRange(UnrealPlatformGroup.GetValidGroupNames()); // Save off the list as an array CachedPlatformFolderNames = PlatformFolderNames.ToArray(); } return(CachedPlatformFolderNames); }
/// <summary> /// Determines whether the given suffix is valid for a child plugin /// </summary> /// <param name="Suffix"></param> /// <returns>Whether the suffix is appopriate</returns> private static bool IsValidChildPluginSuffix(string Suffix) { foreach (UnrealPlatformGroup Group in UnrealPlatformGroup.GetValidGroups()) { if (Group.ToString().Equals(Suffix, StringComparison.InvariantCultureIgnoreCase)) { return(true); } } foreach (UnrealTargetPlatform Platform in UnrealTargetPlatform.GetValidPlatforms()) { if (Platform.ToString().Equals(Suffix, StringComparison.InvariantCultureIgnoreCase)) { return(true); } } return(false); }
/// <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> /// Assign a platform as a member of the given group /// </summary> public static void RegisterPlatformWithGroup(UnrealTargetPlatform InPlatform, UnrealPlatformGroup InGroup) { // find or add the list of groups for this platform List <UnrealTargetPlatform> Platforms; if (!PlatformGroupDictionary.TryGetValue(InGroup, out Platforms)) { Platforms = new List <UnrealTargetPlatform>(); PlatformGroupDictionary.Add(InGroup, Platforms); } Platforms.Add(InPlatform); }
/// <summary> /// Given a list of supported platforms, returns a list of names of platforms that should not be supported /// </summary> /// <param name="SupportedPlatforms">List of supported platforms</param> /// <returns>List of unsupported platforms in string format</returns> public static List <string> MakeListOfUnsupportedPlatforms(List <UnrealTargetPlatform> SupportedPlatforms) { // Make a list of all platform name strings that we're *not* currently compiling, to speed // up file path comparisons later on List <string> OtherPlatformNameStrings = new List <string>(); { List <UnrealPlatformGroup> SupportedGroups = new List <UnrealPlatformGroup>(); // look at each group to see if any supported platforms are in it foreach (UnrealPlatformGroup Group in UnrealPlatformGroup.GetValidGroups()) { // get the list of platforms registered to this group, if any List <UnrealTargetPlatform> Platforms = UEBuildPlatform.GetPlatformsInGroup(Group); if (Platforms != null) { // loop over each one foreach (UnrealTargetPlatform Platform in Platforms) { // if it's a compiled platform, then add this group to be supported if (SupportedPlatforms.Contains(Platform)) { SupportedGroups.Add(Group); } } } } // loop over groups one more time, anything NOT in SupportedGroups is now unsupported, and should be added to the output list foreach (UnrealPlatformGroup Group in UnrealPlatformGroup.GetValidGroups()) { if (SupportedGroups.Contains(Group) == false) { OtherPlatformNameStrings.Add(Group.ToString()); } } foreach (UnrealTargetPlatform CurPlatform in UnrealTargetPlatform.GetValidPlatforms()) { bool ShouldConsider = true; // If we have a platform and a group with the same name, don't add the platform // to the other list if the same-named group is supported. This is a lot of // lines because we need to do the comparisons as strings. string CurPlatformString = CurPlatform.ToString(); foreach (UnrealPlatformGroup Group in UnrealPlatformGroup.GetValidGroups()) { if (Group.ToString().Equals(CurPlatformString)) { ShouldConsider = false; break; } } // Don't add our current platform to the list of platform sub-directory names that // we'll skip source files for if (ShouldConsider && !SupportedPlatforms.Contains(CurPlatform)) { OtherPlatformNameStrings.Add(CurPlatform.ToString()); } } return(OtherPlatformNameStrings); } }
/// <summary> /// /// </summary> /// <param name="Inner"></param> public ReadOnlyXXXTargetRules(XXXTargetRules Inner) { this.Inner = Inner; UnrealPlatformGroup Group = UnrealPlatformGroup.Android; }