From d9181dd5f72a1a9e9b39d3f850e79865d0e8a704 Mon Sep 17 00:00:00 2001 From: Beisi Zhou Date: Wed, 22 Jun 2022 14:17:56 +0800 Subject: [PATCH] clear MinimalVersion.csv after bumping version --- tools/VersionController/Program.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/VersionController/Program.cs b/tools/VersionController/Program.cs index c44f76c9f58a..6e256a25493d 100644 --- a/tools/VersionController/Program.cs +++ b/tools/VersionController/Program.cs @@ -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) @@ -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}); } + //Make Az.Accounts as the last module to calculate changedModules = changedModules.OrderByDescending(c => c == "Az.Accounts" ? "" : c).ToList(); foreach (var projectModuleManifestPath in changedModules)