Skip to content

Commit

Permalink
Chenlei fix the issue of StackEdge (#12069)
Browse files Browse the repository at this point in the history
Co-authored-by: wyunchi-ms <[email protected]>
  • Loading branch information
wyunchi-ms and wyunchi-ms authored Jun 5, 2020
1 parent 6d9947a commit 12c76b9
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tools/VersionController/Models/VersionBumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Reflection;
using System.Text.RegularExpressions;
using Tools.Common.Models;
using VersionController.Utilities;

namespace VersionController.Models
{
Expand Down Expand Up @@ -296,7 +297,7 @@ private void UpdateDependentModules()
.Where(f => !f.Contains("Netcore") &&
!f.Contains("bin") &&
!f.Contains("dll-Help") &&
!f.Contains("Stack"))
!ModuleFilter.IsAzureStackModule(f))
.ToList();
foreach (var moduleManifestPath in moduleManifestPaths)
{
Expand Down
7 changes: 4 additions & 3 deletions tools/VersionController/Models/VersionFileHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using VersionController.Utilities;

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

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

public string GalleryModuleDirectory => Path.Combine(OutputModuleDirectory, ModuleName);
public string GalleryModuleDirectory => OutputModuleDirectory;

public string GalleryModuleVersionDirectory => Directory.GetDirectories(GalleryModuleDirectory).FirstOrDefault();
public string GalleryModuleVersionDirectory => GalleryModuleDirectory;
}
}
5 changes: 3 additions & 2 deletions tools/VersionController/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Reflection;
using Tools.Common.Models;
using VersionController.Models;
using VersionController.Utilities;

namespace VersionController
{
Expand Down Expand Up @@ -105,7 +106,7 @@ private static void BumpVersions()
foreach (var directory in _projectDirectories)
{
var changeLogs = Directory.GetFiles(directory, "ChangeLog.md", SearchOption.AllDirectories)
.Where(f => (!f.Contains("Stack") || f.Contains("StackEdge")) && IsChangeLogUpdated(f))
.Where(f => !ModuleFilter.IsAzureStackModule(f) && IsChangeLogUpdated(f))
.Select(f => GetModuleManifestPath(Directory.GetParent(f).FullName))
.Where(m => m.Contains(_moduleNameFilter))
.ToList();
Expand Down Expand Up @@ -170,7 +171,7 @@ private static void ValidateVersionBump()
foreach (var directory in _projectDirectories)
{
var changeLogs = Directory.GetFiles(directory, "ChangeLog.md", SearchOption.AllDirectories)
.Where(f => !f.Contains("Stack"))
.Where(f => !ModuleFilter.IsAzureStackModule(f))
.Select(f => GetModuleManifestPath(Directory.GetParent(f).FullName))
.Where(m => !string.IsNullOrEmpty(m) && m.Contains(_moduleNameFilter))
.ToList();
Expand Down
41 changes: 41 additions & 0 deletions tools/VersionController/Utilities/ModuleFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;

namespace VersionController.Utilities
{
class ModuleFilter
{
public static bool IsAzureStackModule(String fileName)
{
bool isAzureStackModule = false;
if (fileName.Contains("Stack"))
{
isAzureStackModule = true;
}
var executingAssemblyPath = Assembly.GetExecutingAssembly().Location;
var versionControllerDirectory = Directory.GetParent(executingAssemblyPath).FullName;
var whiteListFile = Path.Combine(versionControllerDirectory, "WhiteList.csv");
if (File.Exists(whiteListFile))
{
var lines = File.ReadAllLines(whiteListFile).Skip(1).Where(c => !string.IsNullOrEmpty(c));
foreach (var line in lines)
{
var cols = line.Split(",").Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
.Select(c => c.EndsWith("\"") ? c.Substring(0, c.Length - 1) : c)
.Select(c => c.Trim()).ToArray();
if (cols.Length >= 1)
{
if (fileName.Contains(cols[0]))
{
isAzureStackModule = false;
break;
}
}
}
}
return isAzureStackModule;
}
}
}
1 change: 1 addition & 0 deletions tools/VersionController/VersionController.Netcore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

<ItemGroup>
<Content Include="MinimalVersion.csv" CopyToOutputDirectory="PreserveNewest" />
<Content Include="WhiteList.csv" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions tools/VersionController/WhiteList.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Module
StackEdge

0 comments on commit 12c76b9

Please sign in to comment.