Skip to content

Commit 12c76b9

Browse files
authored
Chenlei fix the issue of StackEdge (Azure#12069)
Co-authored-by: wyunchi-ms <[email protected]>
1 parent 6d9947a commit 12c76b9

File tree

6 files changed

+53
-6
lines changed

6 files changed

+53
-6
lines changed

tools/VersionController/Models/VersionBumper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Reflection;
77
using System.Text.RegularExpressions;
88
using Tools.Common.Models;
9+
using VersionController.Utilities;
910

1011
namespace VersionController.Models
1112
{
@@ -296,7 +297,7 @@ private void UpdateDependentModules()
296297
.Where(f => !f.Contains("Netcore") &&
297298
!f.Contains("bin") &&
298299
!f.Contains("dll-Help") &&
299-
!f.Contains("Stack"))
300+
!ModuleFilter.IsAzureStackModule(f))
300301
.ToList();
301302
foreach (var moduleManifestPath in moduleManifestPaths)
302303
{

tools/VersionController/Models/VersionFileHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using System.IO;
33
using System.Linq;
4+
using VersionController.Utilities;
45

56
namespace VersionController.Models
67
{
@@ -65,11 +66,11 @@ public VersionFileHelper(string rootDirectory, string outputModuleManifestPath,
6566
public string ChangeLogPath => Directory.GetFiles(ProjectDirectory, "ChangeLog.md").FirstOrDefault();
6667

6768
public List<string> AssemblyInfoPaths => Directory.GetFiles(SrcDirectory, "AssemblyInfo.cs", SearchOption.AllDirectories)
68-
.Where(f => !f.Contains("Stack") && !f.Contains(".Test"))
69+
.Where(f => !ModuleFilter.IsAzureStackModule(f) && !f.Contains(".Test"))
6970
.ToList();
7071

71-
public string GalleryModuleDirectory => Path.Combine(OutputModuleDirectory, ModuleName);
72+
public string GalleryModuleDirectory => OutputModuleDirectory;
7273

73-
public string GalleryModuleVersionDirectory => Directory.GetDirectories(GalleryModuleDirectory).FirstOrDefault();
74+
public string GalleryModuleVersionDirectory => GalleryModuleDirectory;
7475
}
7576
}

tools/VersionController/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Reflection;
88
using Tools.Common.Models;
99
using VersionController.Models;
10+
using VersionController.Utilities;
1011

1112
namespace VersionController
1213
{
@@ -105,7 +106,7 @@ private static void BumpVersions()
105106
foreach (var directory in _projectDirectories)
106107
{
107108
var changeLogs = Directory.GetFiles(directory, "ChangeLog.md", SearchOption.AllDirectories)
108-
.Where(f => (!f.Contains("Stack") || f.Contains("StackEdge")) && IsChangeLogUpdated(f))
109+
.Where(f => !ModuleFilter.IsAzureStackModule(f) && IsChangeLogUpdated(f))
109110
.Select(f => GetModuleManifestPath(Directory.GetParent(f).FullName))
110111
.Where(m => m.Contains(_moduleNameFilter))
111112
.ToList();
@@ -170,7 +171,7 @@ private static void ValidateVersionBump()
170171
foreach (var directory in _projectDirectories)
171172
{
172173
var changeLogs = Directory.GetFiles(directory, "ChangeLog.md", SearchOption.AllDirectories)
173-
.Where(f => !f.Contains("Stack"))
174+
.Where(f => !ModuleFilter.IsAzureStackModule(f))
174175
.Select(f => GetModuleManifestPath(Directory.GetParent(f).FullName))
175176
.Where(m => !string.IsNullOrEmpty(m) && m.Contains(_moduleNameFilter))
176177
.ToList();
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.IO;
3+
using System.Linq;
4+
using System.Reflection;
5+
6+
namespace VersionController.Utilities
7+
{
8+
class ModuleFilter
9+
{
10+
public static bool IsAzureStackModule(String fileName)
11+
{
12+
bool isAzureStackModule = false;
13+
if (fileName.Contains("Stack"))
14+
{
15+
isAzureStackModule = true;
16+
}
17+
var executingAssemblyPath = Assembly.GetExecutingAssembly().Location;
18+
var versionControllerDirectory = Directory.GetParent(executingAssemblyPath).FullName;
19+
var whiteListFile = Path.Combine(versionControllerDirectory, "WhiteList.csv");
20+
if (File.Exists(whiteListFile))
21+
{
22+
var lines = File.ReadAllLines(whiteListFile).Skip(1).Where(c => !string.IsNullOrEmpty(c));
23+
foreach (var line in lines)
24+
{
25+
var cols = line.Split(",").Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
26+
.Select(c => c.EndsWith("\"") ? c.Substring(0, c.Length - 1) : c)
27+
.Select(c => c.Trim()).ToArray();
28+
if (cols.Length >= 1)
29+
{
30+
if (fileName.Contains(cols[0]))
31+
{
32+
isAzureStackModule = false;
33+
break;
34+
}
35+
}
36+
}
37+
}
38+
return isAzureStackModule;
39+
}
40+
}
41+
}

tools/VersionController/VersionController.Netcore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
<ItemGroup>
5050
<Content Include="MinimalVersion.csv" CopyToOutputDirectory="PreserveNewest" />
51+
<Content Include="WhiteList.csv" CopyToOutputDirectory="PreserveNewest" />
5152
</ItemGroup>
5253

5354
</Project>

tools/VersionController/WhiteList.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Module
2+
StackEdge

0 commit comments

Comments
 (0)