private void GenerateSNDBSIncludeRewriteRules()
        {
            if (!Directory.Exists(IncludeRewriteRulesFile.Directory.FullName))
            {
                Directory.CreateDirectory(IncludeRewriteRulesFile.Directory.FullName);
            }

            List <string> IncludeRewriteRulesText = new List <string>();

            IncludeRewriteRulesText.Add("[computed-include-rules]");
            IncludeRewriteRulesText.Add(@"pattern1=^COMPILED_PLATFORM_HEADER\(\s*([^ ,]+)\)");

            // Get all registered platforms. Most will just use the name as is, but some may have an override so
            // add all distinct entries to the list.
            IEnumerable <UnrealTargetPlatform> Platforms = UEBuildPlatform.GetRegisteredPlatforms();
            List <string> PlatformNames = new List <string>();

            foreach (UnrealTargetPlatform Platform in Platforms)
            {
                UEBuildPlatform PlatformData = UEBuildPlatform.GetBuildPlatform(Platform);
                if (!PlatformNames.Contains(PlatformData.GetPlatformName()))
                {
                    PlatformNames.Add(PlatformData.GetPlatformName());
                }
            }

            IEnumerable <string> PlatformExpansions = PlatformNames.Select(p => String.Format("{0}/{0}$1", p));

            IncludeRewriteRulesText.Add(String.Format("expansions1={0}", String.Join("|", PlatformExpansions)));
            File.WriteAllText(IncludeRewriteRulesFile.FullName, String.Join(Environment.NewLine, IncludeRewriteRulesText));
        }
Beispiel #2
0
        private bool GenerateSNDBSIncludeRewriteRules()
        {
            // Get all registered, distinct platform names.
            var Platforms = UEBuildPlatform.GetRegisteredPlatforms()
                            .Select(Platform => UEBuildPlatform.GetBuildPlatform(Platform).GetPlatformName())
                            .Distinct()
                            .ToList();

            if (Platforms.Count > 0)
            {
                // language=regex
                var Lines = new[]
                {
                    @"pattern1=^COMPILED_PLATFORM_HEADER\(\s*([^ ,]+)\s*\)",
                    $"expansions1={string.Join("|", Platforms.Select(Name => $"{Name}/{Name}$1|{Name}$1"))}",

                    @"pattern2=^COMPILED_PLATFORM_HEADER_WITH_PREFIX\(\s*([^ ,]+)\s*,\s*([^ ,]+)\s*\)",
                    $"expansions2={string.Join("|", Platforms.Select(Name => $"$1/{Name}/{Name}$2|$1/{Name}$2"))}",

                    @"pattern3=^[A-Z]{5}_PLATFORM_HEADER_NAME\(\s*([^ ,]+)\s*\)",
                    $"expansions3={string.Join("|", Platforms.Select(Name => $"{Name}/{Name}$1|{Name}$1"))}",

                    @"pattern4=^[A-Z]{5}_PLATFORM_HEADER_NAME_WITH_PREFIX\(\s*([^ ,]+)\s*,\s*([^ ,]+)\s*\)",
                    $"expansions4={string.Join("|", Platforms.Select(Name => $"$1/{Name}/{Name}$2|$1/{Name}$2"))}"
                };

                File.WriteAllText(IncludeRewriteRulesFile.FullName, string.Join(Environment.NewLine, new[] { "[computed-include-rules]" }.Concat(Lines)));
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Gets a list of the registered platforms
 /// </summary>
 /// <returns>List of platforms</returns>
 public static IEnumerable <UnrealTargetPlatform> GetRegisteredPlatforms()
 {
     return(UEBuildPlatform.GetRegisteredPlatforms());
 }