Skip to content

Commit 4922da0

Browse files
authored
Add module name (#22686)
1 parent ef6f7eb commit 4922da0

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tools/BreakingChanges/GetUpcomingBreakingChange.ps1

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# ```powershell
1717
# dotnet msbuild build.proj /t:build /p:configuration=Debug
1818
# Import-Module ./tools/BreakingChanges/GetUpcomingBreakingChange.ps1
19-
# Export-AllBreakingChangeMessageUnderArtifacts -ArtifactsPath .\artifacts\Debug\ -MarkdownPath UpcommingBreakingChange.md
19+
# Export-AllBreakingChangeMessageUnderArtifacts -ArtifactsPath ./artifacts/Debug/ -MarkdownPath ./documentation/breaking-changes/upcoming-breaking-changes.md
2020
# ```
2121

2222
$AllParameterSetsName = "AllParameterSets"
@@ -69,6 +69,10 @@ Function Get-AttributeSpecificMessage
6969
{
7070
[CmdletBinding()]
7171
Param (
72+
[Parameter()]
73+
[string]
74+
$ModuleName,
75+
7276
[Parameter()]
7377
[System.Object]
7478
$attribute
@@ -89,7 +93,7 @@ Function Get-AttributeSpecificMessage
8993
{
9094
$Message = "- $Message"
9195
}
92-
$Message += "`n- This change is expected to take effect from version: $($attribute.DeprecateByVersion) and Az version: $($attribute.DeprecateByAzVersion)"
96+
$Message += "`n- This change is expected to take effect from $ModuleName version: $($attribute.DeprecateByVersion) and Az version: $($attribute.DeprecateByAzVersion)"
9397
Return $Message
9498
}
9599

@@ -98,6 +102,10 @@ Function Find-ParameterBreakingChange
98102
{
99103
[CmdletBinding()]
100104
Param (
105+
[Parameter()]
106+
[string]
107+
$ModuleName,
108+
101109
[Parameter()]
102110
[System.Management.Automation.ParameterMetadata]
103111
$ParameterInfo
@@ -107,7 +115,7 @@ Function Find-ParameterBreakingChange
107115
{
108116
If (Test-TypeIsGenericBreakingChangeWithVersionAttribute $attribute.TypeId)
109117
{
110-
Return Get-AttributeSpecIficMessage($attribute)
118+
Return Get-AttributeSpecIficMessage -ModuleName $ModuleName -attribute $attribute
111119
}
112120
}
113121

@@ -119,18 +127,23 @@ Function Find-CmdletBreakingChange
119127
{
120128
[CmdletBinding()]
121129
Param (
130+
[Parameter()]
131+
[string]
132+
$ModuleName,
133+
122134
[Parameter()]
123135
[System.Management.Automation.CommandInfo]
124136
$CmdletInfo
125137
)
126138
$Result = @{}
139+
Write-Debug "Find-CmdletBreakingChange: $ModuleName $($CmdletInfo.Name)"
127140
#Region get breaking change info of cmdlet
128141
$customAttributes = $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true)
129142
ForEach ($customAttribute In $customAttributes)
130143
{
131144
If (Test-TypeIsGenericBreakingChangeWithVersionAttribute $customAttribute.TypeId)
132145
{
133-
$tmp = Get-AttributeSpecIficMessage($customAttribute)
146+
$tmp = Get-AttributeSpecIficMessage -ModuleName $ModuleName -attribute $customAttribute
134147
If (-not $Result.ContainsKey($AllParameterSetsName))
135148
{
136149
$Null = $Result.Add($AllParameterSetsName, @{
@@ -153,7 +166,8 @@ Function Find-CmdletBreakingChange
153166
$ParameterBreakingChanges = @{}
154167
ForEach ($ParameterInfo In $CmdletInfo.Parameters.values)
155168
{
156-
$ParameterBreakingChange = Find-ParameterBreakingChange($ParameterInfo)
169+
Write-Debug "Find-CmdletBreakingChange -> Find-ParameterBreakingChange $ModuleName $($ModuleName.GetType())"
170+
$ParameterBreakingChange = Find-ParameterBreakingChange -ModuleName $ModuleName -ParameterInfo $ParameterInfo
157171
If ($Null -ne $ParameterBreakingChange)
158172
{
159173
$Null = $ParameterBreakingChanges.Add($ParameterInfo.Name, $ParameterBreakingChange)
@@ -210,7 +224,7 @@ Function Get-BreakingChangeInfoOfModule
210224
$ModuleInfo = Get-Module $ModuleName
211225
ForEach ($cmdletInfo In $ModuleInfo.ExportedCmdlets.Values)
212226
{
213-
$cmdletBreakingChangeInfo = Find-CmdletBreakingChange($cmdletInfo)
227+
$cmdletBreakingChangeInfo = Find-CmdletBreakingChange -ModuleName $ModuleName -CmdletInfo $cmdletInfo
214228
If ($cmdletBreakingChangeInfo.Count -ne 0)
215229
{
216230
$BreakingChangeMessages.Add($cmdletInfo.Name, $cmdletBreakingChangeInfo)

0 commit comments

Comments
 (0)