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

Clear MinimalVersion.csv after bumping version #18657

Merged
merged 1 commit into from
Jun 23, 2022
Merged
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
9 changes: 8 additions & 1 deletion tools/VersionController/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,15 @@ private static void BumpVersions()
changedModules.AddRange(changeLogs);
}

// Read MinimalVersion.csv
var executingAssemblyPath = Assembly.GetExecutingAssembly().Location;
var versionControllerDirectory = Directory.GetParent(executingAssemblyPath).FullName;
var miniVersionFile = Path.Combine(versionControllerDirectory, "MinimalVersion.csv");
if (File.Exists(miniVersionFile))
{
var lines = File.ReadAllLines(miniVersionFile).Skip(1).Where(c => !string.IsNullOrEmpty(c));
var file = File.ReadAllLines(miniVersionFile);
var header = file.First();
var lines = file.Skip(1).Where(c => !string.IsNullOrEmpty(c));
foreach (var line in lines)
{
var cols = line.Split(",").Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
Expand All @@ -182,7 +185,11 @@ private static void BumpVersions()
_minimalVersion.Add(cols[0], new AzurePSVersion(cols[1]));
}
}

// Clean MinimalVersion.csv
File.WriteAllLines(Path.Combine(_rootDirectory, @"tools\VersionController", "MinimalVersion.csv"), new string[]{ header});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use miniVersionFile here?

Copy link
Contributor Author

@BethanyZhou BethanyZhou Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, miniVersionFile points to the MinimalVersion.csv in artifact folder, we need to modify the one in tools\VersionController folder

}

//Make Az.Accounts as the last module to calculate
changedModules = changedModules.OrderByDescending(c => c == "Az.Accounts" ? "" : c).ToList();
foreach (var projectModuleManifestPath in changedModules)
Expand Down