Skip to content

Commit 5cd7b80

Browse files
author
azurepowershell
committed
Sync tools folder from main branch to generation branch
1 parent 458d4b6 commit 5cd7b80

File tree

5 files changed

+62
-8
lines changed

5 files changed

+62
-8
lines changed

tools/CreateMappings_rules.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,5 +859,9 @@
859859
{
860860
"module": "NetworkAnalytics",
861861
"alias": "NetworkAnalytics"
862+
},
863+
{
864+
"module": "Fleet",
865+
"alias": "Fleet"
862866
}
863867
]

tools/RunVersionController.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ Param(
2121
[string]$GalleryName = "PSGallery",
2222

2323
[Parameter()]
24-
[string]$ArtifactsOutputPath = "$PSScriptRoot/../artifacts/Release/"
24+
[string]$ArtifactsOutputPath = "$PSScriptRoot/../artifacts/Release/",
25+
26+
[Parameter()]
27+
[switch]$GenerateSyntaxChangelog
2528
)
2629

2730
enum PSVersion
@@ -520,7 +523,9 @@ switch ($PSCmdlet.ParameterSetName)
520523
# Refresh AzPreview.psd1
521524
Update-AzPreview
522525
Update-AzPreviewChangelog
523-
Update-AzSyntaxChangelog
526+
if ($GenerateSyntaxChangelog){
527+
Update-AzSyntaxChangelog
528+
}
524529
# We need to generate the upcoming-breaking-changes.md after the process of bump version in minor release
525530
if ([PSVersion]::MINOR -Eq $versionBump)
526531
{
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"Module","Sdk","Severity","ProblemId","Description","Remediation"
2+
"Az.Compute","src/Compute/Compute.Management.Sdk","1","9080","Do not support updating SDK using autorest csharp v3.","Please update the Readme.md to generate code by autorest powershell v4."

tools/VersionController/Models/SyntaxChangelogGenerator.cs

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ public void Analyze(String rootDirectory)
4040
var moduleName = psd1FileName.Replace(".psd1", "");
4141
if (ModuleFilter.IsAzureStackModule(moduleName.Replace("Az.", ""))) continue;
4242
Console.WriteLine("Analyzing module: {0}", moduleName);
43-
var newModuleMetadata = MetadataLoader.GetModuleMetadata(moduleName);
4443
var executingPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).AbsolutePath);
44+
Directory.SetCurrentDirectory(executingPath);
45+
var newModuleMetadata = MetadataLoader.GetModuleMetadata(moduleName);
46+
Console.WriteLine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", ".."));
4547
var filePath = Path.Combine(executingPath, "SerializedCmdlets", $"{moduleName}.json");
4648
if (!File.Exists(filePath)) continue;
4749
var oldModuleMetadata = ModuleMetadata.DeserializeCmdlets(filePath);
@@ -277,9 +279,25 @@ join newParam in newParameterMetadatas on oldParam.Name equals newParam.Name
277279
{
278280
CompareChangedParameterAliases(moduleName, oldCmdletMetadata.Name, oldParameterMetadata, newParameterMetadata);
279281
CompareChangedParameterType(moduleName, oldCmdletMetadata, oldParameterMetadata, newParameterMetadata);
282+
CompareChangedParameterAttribute(moduleName, oldCmdletMetadata, oldParameterMetadata, newParameterMetadata);
283+
}
284+
}
285+
void CompareChangedParameterAttribute(string moduleName, CmdletMetadata oldCmdletMetadata, ParameterMetadata oldParameterMetadata,
286+
ParameterMetadata newParameterMetadata)
287+
{
288+
if (oldParameterMetadata.ValidateNotNullOrEmpty != newParameterMetadata.ValidateNotNullOrEmpty)
289+
{
290+
diffInfo.Add(new CmdletDiffInformation()
291+
{
292+
ModuleName = moduleName,
293+
CmdletName = oldCmdletMetadata.Name,
294+
Type = ChangeType.ParameterAttributeChange,
295+
ParameterName = newParameterMetadata.Name,
296+
Before = new List<string> { oldParameterMetadata.ValidateNotNullOrEmpty.ToString() },
297+
After = new List<string> { newParameterMetadata.ValidateNotNullOrEmpty.ToString() },
298+
});
280299
}
281300
}
282-
283301
private void CompareChangedParameterAliases(string moduleName, string cmdletName, ParameterMetadata oldParameterMetadata, ParameterMetadata newParameterMetadata)
284302
{
285303
if (!(oldParameterMetadata.AliasList.Count == newParameterMetadata.AliasList.Count
@@ -393,11 +411,25 @@ public void GenerateMarkdown(string filePath)
393411
{
394412
if (diffInfo[i].Type == ChangeType.CmdletAdd)
395413
{
396-
sb.AppendFormat("* Added cmdlet `{0}`\n", diffInfo[i].CmdletName);
414+
if (diffInfo[i].Type == diffInfo[i-1].Type) {
415+
sb.AppendFormat(", `{0}`",diffInfo[i].CmdletName);
416+
if (i + 1 == diffInfo.Count ||diffInfo[i].Type != diffInfo[i+1].Type) {
417+
sb.AppendFormat("\n");
418+
}
419+
} else {
420+
sb.AppendFormat("* Added cmdlet `{0}`", diffInfo[i].CmdletName);
421+
}
397422
}
398423
else if (diffInfo[i].Type == ChangeType.CmdletRemove)
399424
{
400-
sb.AppendFormat("* Removed cmdlet `{0}`\n", diffInfo[i].CmdletName);
425+
if (diffInfo[i].Type == diffInfo[i-1].Type) {
426+
sb.AppendFormat(", `{0}`",diffInfo[i].CmdletName);
427+
if (i + 1 == diffInfo.Count ||diffInfo[i].Type != diffInfo[i+1].Type) {
428+
sb.AppendFormat("\n");
429+
}
430+
} else {
431+
sb.AppendFormat("* Removed cmdlet `{0}`", diffInfo[i].CmdletName);
432+
}
401433
}
402434
else
403435
{
@@ -484,6 +516,10 @@ private string GetDescription_ParameterTypeChange(CmdletDiffInformation info)
484516
{
485517
return $"Changed the type of parameter `-{info.ParameterName}` from `{info.Before[0]}` to `{info.After[0]}`";
486518
}
519+
private string GetDescription_ParameterAttributeChange(CmdletDiffInformation info)
520+
{
521+
return $"Parameter `-{info.ParameterName}` ValidateNotNullOrEmpty changed from {info.Before[0]} to {info.After[0]}";
522+
}
487523

488524
private string GetDescription_OutputTypeChange(CmdletDiffInformation info)
489525
{

tools/VersionController/Program.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static void Main(string[] args)
5151
var executingAssemblyPath = Assembly.GetExecutingAssembly().Location;
5252
var versionControllerDirectory = Directory.GetParent(executingAssemblyPath).FullName;
5353
var artifactsDirectory = Directory.GetParent(versionControllerDirectory).FullName;
54-
54+
var syntaxChangelog = "false";
5555
_rootDirectory = Directory.GetParent(artifactsDirectory).FullName;
5656
_projectDirectories = new List<string>{ Path.Combine(_rootDirectory, @"src\") }.Where((d) => Directory.Exists(d)).ToList();
5757
_outputDirectories = new List<string>{ Path.Combine(_rootDirectory, @"artifacts\Release\") }.Where((d) => Directory.Exists(d)).ToList();
@@ -74,9 +74,16 @@ public static void Main(string[] args)
7474
_moduleNameFilter = args[1] + Psd1NameExtension;
7575
}
7676

77+
if (args != null && args.Length > 2)
78+
{
79+
syntaxChangelog = args[2];
80+
}
81+
7782
ConsolidateExceptionFiles(exceptionsDirectory);
7883
ValidateManifest();
79-
GenerateSyntaxChangelog(_rootDirectory);
84+
if (syntaxChangelog.Equals("true", System.StringComparison.OrdinalIgnoreCase)) {
85+
GenerateSyntaxChangelog(_rootDirectory);
86+
}
8087
BumpVersions();
8188
}
8289
private static void GenerateSyntaxChangelog(string _projectDirectories)

0 commit comments

Comments
 (0)