Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .azure-pipelines/generation-templates/workload-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ steps:
script: |
. $(System.DefaultWorkingDirectory)/tools/GenerateModules.ps1 -SkipGeneration -Test

- task: PowerShell@2
displayName: Find Duplicate Commands
inputs:
targetType: inline
pwsh: true
script: |
. $(System.DefaultWorkingDirectory)/tools/PostGeneration/FindDuplicateCommand.ps1 -SourcePath "$(System.DefaultWorkingDirectory)/src/"

- ${{ if eq(parameters.Sign, true) }}:
- template: ../common-templates/esrp/strongname.yml
parameters:
Expand Down
4 changes: 2 additions & 2 deletions src/Users.Functions/Users.Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ directive:
subject: $1AllowedCalendarSharingRoles
- where:
verb: Get
subject: ^(UserChatMessage)$
subject: ^(User)(ChatMessage|OnlineMeetingTranscript|OnlineMeetingRecording)$
set:
subject: All$1
subject: All$1$2
```
8 changes: 4 additions & 4 deletions tools/PostGeneration/FindDuplicateCommand.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ if (!(Test-Path $SourcePath)) {
Write-Error "SourcePath is not valid or does not exist. Please ensure that $SourcePath exists then try again."
}

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

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