1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
private static List<PakFileRules> GetPakFileRules(ProjectParams Params, DeploymentContext SC) { bool bWarnedAboutMultipleTargets = false; bool bFoundConfig = false;
List<ConfigFile> ConfigFiles = new List<ConfigFile>(); FileReference BaseConfigFileReference = FileReference.Combine(SC.EngineRoot, "Config", "BasePakFileRules.ini"); if (FileReference.Exists(BaseConfigFileReference)) { ConfigFiles.Add(new ConfigFile(BaseConfigFileReference)); bFoundConfig = true; }
FileReference ProjectConfigFileReference = FileReference.Combine(SC.ProjectRoot, "Config", "DefaultPakFileRules.ini"); if (FileReference.Exists(ProjectConfigFileReference)) { ConfigFiles.Add(new ConfigFile(ProjectConfigFileReference)); bFoundConfig = true; }
if (!bFoundConfig) { return null; }
bool bChunkedBuild = SC.PlatformUsesChunkManifests && DoesChunkPakManifestExist(Params, SC);
ConfigHierarchy PakRulesConfig = new ConfigHierarchy(ConfigFiles);
List<PakFileRules> RulesList = new List<PakFileRules>(); foreach (string SectionName in PakRulesConfig.SectionNames) {
bool bOnlyChunkedBuilds = false; if (!PakRulesConfig.TryGetValue(SectionName, "bOnlyChunkedBuilds", out bOnlyChunkedBuilds)) { bOnlyChunkedBuilds = false; }
bool bOnlyNonChunkedBuilds = false; if (!PakRulesConfig.TryGetValue(SectionName, "bOnlyNonChunkedBuilds", out bOnlyNonChunkedBuilds)) { bOnlyNonChunkedBuilds = false; }
if (bChunkedBuild && bOnlyNonChunkedBuilds) { continue; }
if(!bChunkedBuild && bOnlyChunkedBuilds) { continue; }
string PlatformString; if (PakRulesConfig.TryGetValue(SectionName, "Platforms", out PlatformString)) { string[] PlatformStrings = PlatformString.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); bool bMatches = false;
foreach (string Platform in PlatformStrings) { if (SC.StageTargetPlatform.PlatformType.ToString().Equals(Platform, StringComparison.OrdinalIgnoreCase)) { bMatches = true; break; } else if (SC.StageTargetPlatform.IniPlatformType.ToString().Equals(Platform, StringComparison.OrdinalIgnoreCase)) { bMatches = true; break; } }
if (!bMatches) { continue; } }
string TargetString; if (PakRulesConfig.TryGetValue(SectionName, "Targets", out TargetString)) { string[] TargetStrings = TargetString.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); bool bMatches = false;
foreach (string Target in TargetStrings) { foreach (UnrealTargetConfiguration C in SC.StageTargetConfigurations) { if (C.ToString() == Target) { bMatches = true; break; } } }
if (!bMatches) { continue; } else if (SC.StageTargetConfigurations.Count > 0 && !bWarnedAboutMultipleTargets) { bWarnedAboutMultipleTargets = true; LogInformation("Staging with more than one target, PakFileRules may apply too many rules!"); } }
PakFileRules PakRules = new PakFileRules(); PakRules.Name = SectionName; PakRulesConfig.TryGetValue(SectionName, "bExcludeFromPaks", out PakRules.bExcludeFromPaks); PakRulesConfig.TryGetValue(SectionName, "bOverrideChunkManifest", out PakRules.bOverrideChunkManifest); PakRulesConfig.TryGetValue(SectionName, "bDisabled", out PakRules.bDisabled); string PakString; PakRulesConfig.TryGetValue(SectionName, "OverridePaks", out PakString);
if (PakString != null && PakString.Length > 0) { PakRules.OverridePaks = PakString.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); } else { PakRules.OverridePaks = null; }
if (PakRules.bExcludeFromPaks && PakRules.OverridePaks != null) { LogWarning("Error in PakFileRules {0}, set to exclude but also sets override!", PakRules.Name); continue; } else if (!PakRules.bExcludeFromPaks && PakRules.OverridePaks == null) { LogWarning("Error in PakFileRules {0}, set to include but did not specify paks!", PakRules.Name); continue; }
IReadOnlyList<string> FilesEnumberable; if (PakRulesConfig.TryGetValues(SectionName, "Files", out FilesEnumberable)) { PakRules.Filter = new FileFilter(); foreach (string FileFilter in FilesEnumberable) { PakRules.Filter.AddRule(FileFilter); }
RulesList.Add(PakRules); } }
return RulesList; }
|