Skip to content

Commit 4defd17

Browse files
authored
Add --includeLocalPackagesBuildConfig option to make.js + LocalPackages BuildConfig (#20463)
* Add --includeLocalPackagesBuildConfig option to make.js + LocalPackages BuildConfig * clean up task / config filtering * fix for --all-tasks when invalid tasks are specified in make-options under specific configs (e..g when a entry is renamed to skip it) * fix versions getting bumped unexpectedly * Avoid writing version mapping files w/only default version: Do not process tasks that don't have any non-default build configs Do not write version map files for tasks that only have defaultbuild and local packages * doc update
1 parent 8629d02 commit 4defd17

10 files changed

+821
-269
lines changed

Diff for: BuildConfigGen/EnsureUpdateModeVerifier.cs

+18-9
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,31 @@ public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)
7575

7676
public void CleanupTempFiles()
7777
{
78-
int count = 0;
79-
foreach (var f in RedirectedToTempl.Values)
78+
try
8079
{
81-
count++;
82-
if (!tempsToKeep.Contains(f))
80+
int count = 0;
81+
foreach (var f in RedirectedToTempl.Values)
8382
{
84-
if (File.Exists(f))
83+
count++;
84+
if (!tempsToKeep.Contains(f))
8585
{
86-
File.Delete(f);
86+
if (File.Exists(f))
87+
{
88+
File.Delete(f);
89+
}
8790
}
8891
}
89-
}
9092

91-
if (count > 0 && !verifyOnly)
93+
if (count > 0 && !verifyOnly)
94+
{
95+
throw new Exception("Expected RedirectedToTemp to be empty when !verifyOnly");
96+
}
97+
}
98+
finally
9299
{
93-
throw new Exception("Expected RedirectedToTemp to be empty when !verifyOnly");
100+
this.VerifyErrors.Clear();
101+
this.RedirectedToTempl.Clear();
102+
this.CopiedFilesToCheck.Clear();
94103
}
95104
}
96105

Diff for: BuildConfigGen/MakeOptionsReader.cs

+31-18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ internal static Dictionary<string, AgentTask> ReadMakeOptions(string gitRootPath
1616
var r = new Utf8JsonReader(File.ReadAllBytes(Path.Combine(gitRootPath, @"make-options.json")));
1717

1818
bool inConfig = false;
19+
bool underTasksNode = false;
1920
string configName = "";
2021

2122
while (r.Read())
@@ -32,44 +33,56 @@ internal static Dictionary<string, AgentTask> ReadMakeOptions(string gitRootPath
3233
{
3334
// skip
3435
inConfig = false;
36+
underTasksNode = false;
3537
}
3638
else if (text == "tasks")
3739
{
3840
inConfig = false;
41+
underTasksNode = true;
3942
}
4043
else
4144
{
42-
4345
inConfig = true;
4446
configName = text!;
47+
underTasksNode = false;
4548
}
4649

4750
break;
4851
}
4952
case JsonTokenType.String:
5053
{
51-
if (inConfig)
54+
if(underTasksNode && inConfig)
5255
{
53-
string? text = r.GetString();
54-
//Console.WriteLine(r.TokenType + " " + text);
55-
56-
AgentTask task;
57-
if (agentTasks.TryGetValue(text!, out task!))
58-
{
56+
throw new Exception("don't expect underTasksNode && inConfig");
57+
}
5958

60-
}
61-
else
59+
// only add tasks under task node! (if there is a task that only exists under a config, ignore it!)
60+
if (underTasksNode)
61+
{
62+
string? text = r.GetString();
63+
if(agentTasks.ContainsKey(text!))
6264
{
63-
task = new AgentTask(text!);
64-
agentTasks.Add(text!, task);
65+
throw new Exception($"duplicate task in make-options {text}");
6566
}
6667

67-
if (configName == "")
68+
AgentTask task = new AgentTask(text!);
69+
agentTasks.Add(text!, task);
70+
}
71+
72+
if (inConfig)
73+
{
74+
string? text = r.GetString();
75+
76+
AgentTask? task;
77+
if (agentTasks.TryGetValue(text!, out task))
6878
{
69-
throw new Exception("expected configName to have value");
70-
}
79+
if (configName == "")
80+
{
81+
throw new Exception("expected configName to have value");
82+
}
7183

72-
task.Configs.Add(configName);
84+
task.Configs.Add(configName);
85+
}
7386
}
7487

7588
break;
@@ -93,9 +106,9 @@ public AgentTask(string name)
93106
Name = name;
94107
}
95108

96-
public string Name;
109+
public readonly string Name;
97110

98-
public HashSet<string> Configs = new HashSet<string>();
111+
public readonly HashSet<string> Configs = new HashSet<string>();
99112

100113
}
101114
}

0 commit comments

Comments
 (0)