Skip to content

Commit

Permalink
Add --includeLocalPackagesBuildConfig option to make.js + LocalPackag…
Browse files Browse the repository at this point in the history
…es 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
  • Loading branch information
merlynomsft authored Sep 26, 2024
1 parent 8629d02 commit 4defd17
Show file tree
Hide file tree
Showing 10 changed files with 821 additions and 269 deletions.
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

0 comments on commit 4defd17

Please sign in to comment.