Skip to content

Commit c0e6ad3

Browse files
committed
Resolve conflicts
2 parents 7e66d05 + 4c75cb4 commit c0e6ad3

File tree

1,896 files changed

+138519
-100353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,896 files changed

+138519
-100353
lines changed

Diff for: BuildConfigGen/EnsureUpdateModeVerifier.cs

+43-11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ internal class EnsureUpdateModeVerifier
1414
private List<string> VerifyErrors = new List<string>();
1515
internal Dictionary<string, string> CopiedFilesToCheck = new Dictionary<string, string>();
1616
internal Dictionary<string, string> RedirectedToTempl = new Dictionary<string, string>();
17+
private HashSet<string> tempsToKeep = new HashSet<string>();
1718

1819
public EnsureUpdateModeVerifier(bool verifyOnly)
1920
{
@@ -35,22 +36,38 @@ public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)
3536
string? sourceFile;
3637
string procesed = "";
3738

39+
string? tempToKeep = null;
3840
if (RedirectedToTempl.TryGetValue(r.Key, out sourceFile))
3941
{
40-
procesed = "(processed) ";
42+
procesed = $"(processed temp={sourceFile}) ";
43+
tempToKeep = sourceFile;
4144
}
4245
else
4346
{
4447
sourceFile = r.Value;
4548
}
4649

47-
if (Helpers.FilesEqual(sourceFile, r.Key))
50+
FileInfo fi = new FileInfo(r.Key);
51+
52+
if (fi.Name.Equals("resources.resjson", StringComparison.OrdinalIgnoreCase))
4853
{
49-
// if overwrite and content match, everything is good! Verification passed.
54+
// resources.resjson is generated by make.js and does not need to be verified
55+
// it can differ between configs if configs have different inputs (causes verifier to fail);
5056
}
5157
else
5258
{
53-
yield return $"Content doesn't match {r.Value} {procesed}to {r.Key} (overwrite=true). Dest file doesn't match {procesed}source.";
59+
if (Helpers.FilesEqual(sourceFile, r.Key))
60+
{
61+
// if overwrite and content match, everything is good! Verification passed.
62+
}
63+
else
64+
{
65+
if (tempToKeep != null)
66+
{
67+
this.tempsToKeep.Add(tempToKeep!);
68+
}
69+
yield return $"Content doesn't match {r.Value} {procesed}to {r.Key} (overwrite=true). Dest file doesn't match source.";
70+
}
5471
}
5572
}
5673
}
@@ -62,9 +79,12 @@ public void CleanupTempFiles()
6279
foreach (var f in RedirectedToTempl.Values)
6380
{
6481
count++;
65-
if (File.Exists(f))
82+
if (!tempsToKeep.Contains(f))
6683
{
67-
File.Delete(f);
84+
if (File.Exists(f))
85+
{
86+
File.Delete(f);
87+
}
6888
}
6989
}
7090

@@ -137,10 +157,12 @@ internal void WriteAllText(string path, string contents, bool suppressValidation
137157
{
138158
string? tempFilePath;
139159

140-
if (!RedirectedToTempl.TryGetValue(path, out tempFilePath))
160+
string normalizedPath = NormalizeFile(path);
161+
162+
if (!RedirectedToTempl.TryGetValue(normalizedPath, out tempFilePath))
141163
{
142164
tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
143-
RedirectedToTempl.Add(path, tempFilePath);
165+
RedirectedToTempl.Add(normalizedPath, tempFilePath);
144166
}
145167

146168
//Console.WriteLine($"writing to tempFilePath={tempFilePath}");
@@ -240,11 +262,21 @@ private string ResolveFile(string filePath)
240262
filePath = NormalizeFile(filePath);
241263

242264
string? sourceFile = null, tempFile = null;
243-
if (CopiedFilesToCheck.TryGetValue(filePath, out sourceFile))
265+
266+
if (RedirectedToTempl.TryGetValue(filePath, out tempFile))
267+
{
268+
// We'll get here if we're reading a file that was written to in WriteAllText
269+
}
270+
else
244271
{
245-
if (RedirectedToTempl.TryGetValue(sourceFile, out tempFile))
272+
if (CopiedFilesToCheck.TryGetValue(filePath, out sourceFile))
246273
{
247-
// do nothing
274+
// We'll get here if we're reading a file that was copied
275+
276+
if (RedirectedToTempl.TryGetValue(sourceFile, out tempFile))
277+
{
278+
// We'll get here if we're reading a file that was copied and then written to in WriteAllText
279+
}
248280
}
249281
}
250282

Diff for: BuildConfigGen/Program.cs

+46-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public record ConfigRecord(string name, string constMappingKey, bool isDefault,
5151
public static readonly ConfigRecord Node20_229_13 = new ConfigRecord(name: nameof(Node20_229_13), constMappingKey: "Node20_229_13", isDefault: false, isNode: true, nodePackageVersion: "^20.11.0", isWif: false, nodeHandler: "Node20_1", preprocessorVariableName: "NODE20", enableBuildConfigOverrides: true, deprecated: false, shouldUpdateTypescript: true, overriddenDirectoryName: "Node20", writeNpmrc: true);
5252
public static readonly ConfigRecord Node20_229_14 = new ConfigRecord(name: nameof(Node20_229_14), constMappingKey: "Node20_229_14", isDefault: false, isNode: true, nodePackageVersion: "^20.3.1", isWif: false, nodeHandler: "Node20_1", preprocessorVariableName: "NODE20", enableBuildConfigOverrides: true, deprecated: false, shouldUpdateTypescript: true, overriddenDirectoryName: "Node20", writeNpmrc: true);
5353
public static readonly ConfigRecord WorkloadIdentityFederation = new ConfigRecord(name: nameof(WorkloadIdentityFederation), constMappingKey: "WorkloadIdentityFederation", isDefault: false, isNode: true, nodePackageVersion: "^16.11.39", isWif: true, nodeHandler: "Node16", preprocessorVariableName: "WORKLOADIDENTITYFEDERATION", enableBuildConfigOverrides: true, deprecated: false, shouldUpdateTypescript: false, writeNpmrc: false);
54-
public static ConfigRecord[] Configs = { Default, Node16, Node16_225, Node20, Node20_228, Node20_229_1, Node20_229_2, Node20_229_3, Node20_229_4, Node20_229_5, Node20_229_6, Node20_229_7, Node20_229_8, Node20_229_9, Node20_229_10, Node20_229_11, Node20_229_12, Node20_229_13, Node20_229_14, WorkloadIdentityFederation };
54+
public static readonly ConfigRecord wif_242 = new ConfigRecord(name: nameof(wif_242), constMappingKey: "wif_242", isDefault: false, isNode: true, nodePackageVersion: "^20.3.1", isWif: true, nodeHandler: "Node20_1", preprocessorVariableName: "WIF", enableBuildConfigOverrides: true, deprecated: false, shouldUpdateTypescript: true, overriddenDirectoryName: "Wif", writeNpmrc: true);
55+
public static ConfigRecord[] Configs = { Default, Node16, Node16_225, Node20, Node20_228, Node20_229_1, Node20_229_2, Node20_229_3, Node20_229_4, Node20_229_5, Node20_229_6, Node20_229_7, Node20_229_8, Node20_229_9, Node20_229_10, Node20_229_11, Node20_229_12, Node20_229_13, Node20_229_14, WorkloadIdentityFederation, wif_242 };
5556
}
5657

5758
static List<string> notSyncronizedDependencies = [];
@@ -98,7 +99,6 @@ private static void MainInner(string? task, string? configs, int? currentSprint,
9899
else
99100
{
100101
NotNullOrThrow(task, "Task is required");
101-
NotNullOrThrow(configs, "Configs is required");
102102
}
103103

104104
string currentDir = Environment.CurrentDirectory;
@@ -142,7 +142,30 @@ private static void MainInner(string? task, string? configs, int? currentSprint,
142142
// 3. Ideally default windows exception will occur and errors reported to WER/watson. I'm not sure this is happening, perhaps DragonFruit is handling the exception
143143
foreach (var t in task!.Split(',', '|'))
144144
{
145-
MainUpdateTask(t, configs!, writeUpdates, currentSprint, debugConfGen);
145+
// If config weren't passed, constract specific config for each task, otherwise we might have problems if first task has 2 configs, but the other 1,0 or diffrenet ones
146+
if (configs == null)
147+
{
148+
var tasks = MakeOptionsReader.ReadMakeOptions(gitRootPath);
149+
if (tasks.ContainsKey(t))
150+
{
151+
var taskMakeOptions = tasks[t];
152+
var taskConfigs = string.Join('|', taskMakeOptions.Configs);
153+
MainUpdateTask(t, taskConfigs!, writeUpdates, currentSprint, debugConfGen);
154+
}
155+
else
156+
{
157+
Console.WriteLine($"Config was not found for the task: {t}, skipping");
158+
}
159+
}
160+
else
161+
{
162+
// If configs was passed as arguments, just execute it
163+
MainUpdateTask(t, configs!, writeUpdates, currentSprint, debugConfGen);
164+
}
165+
166+
if (configs != null)
167+
{
168+
}
146169
}
147170
}
148171

@@ -421,10 +444,11 @@ private static void MainUpdateTaskInner(
421444

422445
HandlePreprocessingInTarget(taskOutput, config, validateAndWriteChanges: true, out _);
423446

447+
WriteWIFInputTaskJson(taskOutput, config, "task.json", isLoc: false);
448+
WriteWIFInputTaskJson(taskOutput, config, "task.loc.json", isLoc: true);
424449
WriteTaskJson(taskOutput, configTaskVersionMapping, config, "task.json");
425450
WriteTaskJson(taskOutput, configTaskVersionMapping, config, "task.loc.json");
426451
}
427-
428452
WriteInputTaskJson(taskTargetPath, configTaskVersionMapping, "task.json");
429453
WriteInputTaskJson(taskTargetPath, configTaskVersionMapping, "task.loc.json");
430454

@@ -654,6 +678,24 @@ private static void WriteTaskJson(string taskPath, Dictionary<Config.ConfigRecor
654678
ensureUpdateModeVerifier!.WriteAllText(outputTaskPath, outputTaskNode.ToJsonString(jso), suppressValidationErrorIfTargetPathDoesntExist: false);
655679
}
656680

681+
private static void WriteWIFInputTaskJson(string taskPath, Config.ConfigRecord config, string fileName, bool isLoc)
682+
{
683+
if (!config.isWif)
684+
{
685+
return;
686+
}
687+
688+
string taskJsonOverridePath = Path.Combine(taskPath, isLoc ? "taskJsonOverride.loc.json" : "taskJsonOverride.json");
689+
JsonNode inputTaskNode = JsonNode.Parse(ensureUpdateModeVerifier!.FileReadAllText(taskJsonOverridePath))!;
690+
var clonedArray = JsonNode.Parse(inputTaskNode["inputs"]!.ToJsonString())!.AsArray();
691+
692+
string outputTaskPath = Path.Combine(taskPath, fileName);
693+
JsonNode outputTaskNode = JsonNode.Parse(ensureUpdateModeVerifier!.FileReadAllText(outputTaskPath))!;
694+
outputTaskNode["inputs"] = clonedArray;
695+
696+
ensureUpdateModeVerifier!.WriteAllText(outputTaskPath, outputTaskNode.ToJsonString(jso), suppressValidationErrorIfTargetPathDoesntExist: false);
697+
}
698+
657699
private static void WriteNodePackageJson(string taskOutputNode, string nodeVersion, bool shouldUpdateTypescript)
658700
{
659701
string outputNodePackagePath = Path.Combine(taskOutputNode, "package.json");

Diff for: BuildConfigGen/Properties/launchSettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"BuildConfigGen": {
44
"commandName": "Project",
5-
"commandLineArgs": "--write-updates --configs \"Node20\" --task MavenV3"
5+
"commandLineArgs": " --task PipAuthenticateV1 "
66
}
77
}
88
}

Diff for: Tasks/AndroidSigningV2/_buildConfigs/Node20/Tests/package-lock.json

+25-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)