Skip to content

Commit 31bea4e

Browse files
authored
Merge pull request #2291 from microsoftgraph/po/ResolveCmdletName
Resolve duplicate command names in `Users.Functions`
2 parents 41a1af7 + 35eda6c commit 31bea4e

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

.azure-pipelines/generation-templates/workload-modules.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ steps:
3232
script: |
3333
. $(System.DefaultWorkingDirectory)/tools/GenerateModules.ps1 -SkipGeneration -Test
3434
35+
- task: PowerShell@2
36+
displayName: Find Duplicate Commands
37+
inputs:
38+
targetType: inline
39+
pwsh: true
40+
script: |
41+
. $(System.DefaultWorkingDirectory)/tools/PostGeneration/FindDuplicateCommand.ps1 -SourcePath "$(System.DefaultWorkingDirectory)/src/"
42+
3543
- ${{ if eq(parameters.Sign, true) }}:
3644
- template: ../common-templates/esrp/strongname.yml
3745
parameters:

src/Users.Functions/Users.Functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ directive:
3232
subject: $1AllowedCalendarSharingRoles
3333
- where:
3434
verb: Get
35-
subject: ^(UserChatMessage)$
35+
subject: ^(User)(ChatMessage|OnlineMeetingTranscript|OnlineMeetingRecording)$
3636
set:
37-
subject: All$1
37+
subject: All$1$2
3838
```

tools/PostGeneration/FindDuplicateCommand.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ if (!(Test-Path $SourcePath)) {
1515
Write-Error "SourcePath is not valid or does not exist. Please ensure that $SourcePath exists then try again."
1616
}
1717

18-
$psd1s = Get-ChildItem -Path $SourcePath -Filter "Microsoft.Graph.*.psd1" -Recurse | where { $_.BaseName -ne "Microsoft.Graph.Authentication" }
19-
$allModules = (Invoke-Expression (($psd1s.FullName | ForEach-Object{ Get-Content $_}) | Out-String ))
18+
$psd1s = Get-ChildItem -Path $SourcePath -Filter "Microsoft.Graph.*.psd1" -Recurse | Where-Object { $_.BaseName -ne "Microsoft.Graph.Authentication" }
19+
$allModules = Import-PowerShellDataFile $psd1s.FullName
2020
$unique = $allModules.FunctionsToExport | Select-Object -unique
2121
$duplicates = Compare-object -ReferenceObject $unique -DifferenceObject $allModules.FunctionsToExport
2222

2323
if ($duplicates.Count -gt 0) {
2424
Write-Host "The following functions are duplicated in the psd1 files:"
25-
$duplicates.InputObject | %{
25+
$duplicates.InputObject | ForEach-Object {
2626
$duplicateCommand = $_
2727
Write-Host "$duplicateCommand is duplicated in:"
28-
Write-Host ($allModules | where { $_.FunctionsToExport -contains $duplicateCommand }).RootModule
28+
Write-Host ($allModules | Where-Object { $_.FunctionsToExport -contains $duplicateCommand }).RootModule
2929
Write-Host "********************************"
3030
}
3131
Write-Error "Please ensure that the functions are unique and try again."

0 commit comments

Comments
 (0)