Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/merlynop/consolidate3 test #20471

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions BuildConfigGen/EnsureUpdateModeVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,31 @@ public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)

public void CleanupTempFiles()
{
int count = 0;
foreach (var f in RedirectedToTempl.Values)
try
{
count++;
if (!tempsToKeep.Contains(f))
int count = 0;
foreach (var f in RedirectedToTempl.Values)
{
if (File.Exists(f))
count++;
if (!tempsToKeep.Contains(f))
{
File.Delete(f);
if (File.Exists(f))
{
File.Delete(f);
}
}
}
}

if (count > 0 && !verifyOnly)
if (count > 0 && !verifyOnly)
{
throw new Exception("Expected RedirectedToTemp to be empty when !verifyOnly");
}
}
finally
{
throw new Exception("Expected RedirectedToTemp to be empty when !verifyOnly");
this.VerifyErrors.Clear();
this.RedirectedToTempl.Clear();
this.CopiedFilesToCheck.Clear();
}
}

Expand Down
49 changes: 31 additions & 18 deletions BuildConfigGen/MakeOptionsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal static Dictionary<string, AgentTask> ReadMakeOptions(string gitRootPath
var r = new Utf8JsonReader(File.ReadAllBytes(Path.Combine(gitRootPath, @"make-options.json")));

bool inConfig = false;
bool underTasksNode = false;
string configName = "";

while (r.Read())
Expand All @@ -32,44 +33,56 @@ internal static Dictionary<string, AgentTask> ReadMakeOptions(string gitRootPath
{
// skip
inConfig = false;
underTasksNode = false;
}
else if (text == "tasks")
{
inConfig = false;
underTasksNode = true;
}
else
{

inConfig = true;
configName = text!;
underTasksNode = false;
}

break;
}
case JsonTokenType.String:
{
if (inConfig)
if(underTasksNode && inConfig)
{
string? text = r.GetString();
//Console.WriteLine(r.TokenType + " " + text);

AgentTask task;
if (agentTasks.TryGetValue(text!, out task!))
{
throw new Exception("don't expect underTasksNode && inConfig");
}

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

if (configName == "")
AgentTask task = new AgentTask(text!);
agentTasks.Add(text!, task);
}

if (inConfig)
{
string? text = r.GetString();

AgentTask? task;
if (agentTasks.TryGetValue(text!, out task))
{
throw new Exception("expected configName to have value");
}
if (configName == "")
{
throw new Exception("expected configName to have value");
}

task.Configs.Add(configName);
task.Configs.Add(configName);
}
}

break;
Expand All @@ -93,9 +106,9 @@ public AgentTask(string name)
Name = name;
}

public string Name;
public readonly string Name;

public HashSet<string> Configs = new HashSet<string>();
public readonly HashSet<string> Configs = new HashSet<string>();

}
}
Expand Down
Loading