Skip to content

Commit

Permalink
[eng] Remove changed modules from minimalVersion.csv only (Azure#25992)
Browse files Browse the repository at this point in the history
* Remove changed modules from minimalVersion.csv only

* Update tools/VersionController/Program.cs

---------

Co-authored-by: Jin Lei <54836179+msJinLei@users.noreply.github.com>
  • Loading branch information
BethanyZhou and msJinLei authored Sep 10, 2024
1 parent 3cba635 commit eb6d672
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/VersionController/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ private static void BumpVersions()
var executingAssemblyPath = Assembly.GetExecutingAssembly().Location;
var versionControllerDirectory = Directory.GetParent(executingAssemblyPath).FullName;
var miniVersionFile = Path.Combine(versionControllerDirectory, "MinimalVersion.csv");
var changedModuleNames = changedModules.Select(c => Path.GetFileName(c).Replace(".psd1", ""));
if (File.Exists(miniVersionFile))
{
var file = File.ReadAllLines(miniVersionFile);
var header = file.First();
var lines = file.Skip(1).Where(c => !string.IsNullOrEmpty(c));
var lines = file.Skip(1).Where(c => !string.IsNullOrWhiteSpace(c));

var bumpingModule = _moduleNameFilter.Replace(Psd1NameExtension, "");
List<string> _minimalVersionContent = new List<string>() { header };

foreach (var line in lines)
{
var cols = line.Split(",").Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
Expand All @@ -227,7 +227,8 @@ private static void BumpVersions()
_minimalVersion.Add(cols[0], new AzurePSVersion(cols[1]));

// Bump one module, only remove its minimal version from MinimalVersion.csv content
if (!string.IsNullOrEmpty(bumpingModule) && !cols[0].Equals(bumpingModule))
if (!string.IsNullOrEmpty(bumpingModule) && !cols[0].Equals(bumpingModule) ||
!changedModuleNames.Contains(cols[0]))
{
_minimalVersionContent.Add(line);
}
Expand Down

0 comments on commit eb6d672

Please sign in to comment.