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: 4 additions & 4 deletions .azure-pipelines/generate-beta-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ jobs:
displayName: 'Install AutoRest'
inputs:
command: 'custom'
customCommand: 'install -g @autorest/autorest@3.0.6114'
customCommand: 'install -g @autorest/autorest'

- task: PowerShell@2
displayName: 'Build Auth Modules'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/BuildModule.ps1'
arguments: '-Module "Authentication" -ModulePrefix $(MODULE_PREFIX) -ModuleVersion $(Module_Version) -EnableSigning -ReleaseNotes $(Release_Notes)'
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateAuthenticationModule.ps1'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory) -Build -EnableSigning'
pwsh: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
displayName: 'Generate and Build Graph Resource Modules'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateModules.ps1'
arguments: '-RepositoryName $(Repository_Name) -RepositoryApiKey $(Api_Key) -ModuleVersion $(Module_Version) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -BetaGraphVersion -Build -EnableSigning'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -BetaGraphVersion -Build -EnableSigning'
pwsh: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/generate-beta-rollup-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
displayName: 'Generate and Build Roll-Up Module'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateRollUpModule.ps1'
arguments: '-RepositoryName $(Repository_Name) -RepositoryApiKey $(Api_Key) -ModuleVersion $(Module_Version) -ArtifactsLocation $(Build.ArtifactStagingDirectory)/$(GRAPH_VERSION)/ -BetaGraphVersion'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory)/$(GRAPH_VERSION)/ -BetaGraphVersion'
pwsh: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Expand Down
8 changes: 4 additions & 4 deletions .azure-pipelines/generate-v1.0-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ jobs:
displayName: 'Install AutoRest'
inputs:
command: 'custom'
customCommand: 'install -g @autorest/autorest@3.0.6114'
customCommand: 'install -g @autorest/autorest'

- task: PowerShell@2
displayName: 'Build Auth Modules'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/BuildModule.ps1'
arguments: '-Module "Authentication" -ModulePrefix $(MODULE_PREFIX) -ModuleVersion $(Module_Version) -EnableSigning'
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateAuthenticationModule.ps1'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory) -Build -EnableSigning'
pwsh: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
displayName: 'Generate and Build Graph Resource Modules'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateModules.ps1'
arguments: '-RepositoryName $(Repository_Name) -RepositoryApiKey $(Api_Key) -ModuleVersion $(Module_Version) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -Build -EnableSigning'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -Build -EnableSigning'
pwsh: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/generate-v1.0-rollup-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
displayName: 'Generate and Build Roll-Up Module'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateRollUpModule.ps1'
arguments: '-RepositoryName $(Repository_Name) -RepositoryApiKey $(Api_Key) -ModuleVersion $(Module_Version) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\'
pwsh: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/validate-pr-beta-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ jobs:
displayName: 'Install AutoRest'
inputs:
command: 'custom'
customCommand: 'install -g @autorest/autorest@3.0.6114'
customCommand: 'install -g @autorest/autorest'

- task: PowerShell@2
displayName: 'Generate and Build Graph Resource Modules'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateModules.ps1'
arguments: '-RepositoryName $(Repository_Name) -RepositoryApiKey $(Api_Key) -ModuleVersion $(Module_Version) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -BetaGraphVersion -Build'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -BetaGraphVersion -Build'
pwsh: true

- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/validate-pr-v1.0-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ jobs:
displayName: 'Install AutoRest'
inputs:
command: 'custom'
customCommand: 'install -g @autorest/autorest@3.0.6114'
customCommand: 'install -g @autorest/autorest'

- task: PowerShell@2
displayName: 'Generate and Build Graph Resource Modules'
inputs:
filePath: '$(System.DefaultWorkingDirectory)/tools/GenerateModules.ps1'
arguments: '-RepositoryName $(Repository_Name) -RepositoryApiKey $(Api_Key) -ModuleVersion $(Module_Version) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -Build'
arguments: '-RepositoryApiKey $(Api_Key) -ArtifactsLocation $(Build.ArtifactStagingDirectory)\$(GRAPH_VERSION)\ -UseLocalDoc -Build'
pwsh: true

- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ DotNetFrameworkVersion = '4.7.2'
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = './Microsoft.Graph.Authentication.Format.ps1xml'
FormatsToProcess = './Microsoft.Graph.Authentication.format.ps1xml'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()
Expand Down
2 changes: 1 addition & 1 deletion tools/BuildModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Param(
[Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()][string] $ModuleVersion,
[Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()][string[]] $ReleaseNotes,
[int] $ModulePreviewNumber = -1,
[string[]] $RequiredModules,
[hashtable[]] $RequiredModules,
[switch] $EnableSigning
)
$ErrorActionPreference = "Stop"
Expand Down
12 changes: 6 additions & 6 deletions tools/GenerateModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ if ($BetaGraphVersion) {
}
$ModulePrefix = "Microsoft.Graph"
$ModulesOutputDir = Join-Path $PSScriptRoot "..\src\$GraphVersion\"
$AuthenticationModule = "Microsoft.Graph.Authentication"
$OpenApiDocOutput = Join-Path $OpenApiDocOutput $GraphVersion
$ArtifactsLocation = Join-Path $PSScriptRoot "..\artifacts\$GraphVersion"

$RequiredGraphModules = @()
# PS Scripts
$DownloadOpenApiDocPS1 = Join-Path $PSScriptRoot ".\DownloadOpenApiDoc.ps1" -Resolve
$ManageGeneratedModulePS1 = Join-Path $PSScriptRoot ".\ManageGeneratedModule.ps1" -Resolve
Expand All @@ -53,10 +52,11 @@ if (-not (Test-Path $ArtifactsLocation)) {
if (-not (Test-Path $ModuleMappingConfigPath)) {
Write-Error "Module mapping file not be found: $ModuleMappingConfigPath."
}

# Install module locally in order to specify it as a dependency for other modules down the generation pipeline.
# https://stackoverflow.com/questions/46216038/how-do-i-define-requiredmodules-in-a-powershell-module-manifest-psd1.
Install-Module $AuthenticationModule -Repository $RepositoryName -AllowPrerelease -Force
$ExistingAuthModule = Find-Module "Microsoft.Graph.Authentication"
Install-Module $ExistingAuthModule.Name -Repository $RepositoryName -AllowPrerelease -Force
$RequiredGraphModules += @{ ModuleName = $ExistingAuthModule.Name ; RequiredVersion = $ExistingAuthModule.Version }
if ($UpdateAutoRest) {
# Update AutoRest.
& AutoRest-beta --reset
Expand Down Expand Up @@ -123,10 +123,10 @@ $ModuleMapping.Keys | ForEach-Object {
# Build generated module.
if ($EnableSigning) {
# Sign generated module.
& $BuildModulePS1 -Module $ModuleName -ModulePrefix $ModulePrefix -GraphVersion $GraphVersion -ModuleVersion $ModuleVersion -ModulePreviewNumber $ModulePreviewNumber -RequiredModules $AuthenticationModule -ReleaseNotes $ModuleReleaseNotes -EnableSigning
& $BuildModulePS1 -Module $ModuleName -ModulePrefix $ModulePrefix -GraphVersion $GraphVersion -ModuleVersion $ModuleVersion -ModulePreviewNumber $ModulePreviewNumber -RequiredModules $RequiredGraphModules -ReleaseNotes $ModuleReleaseNotes -EnableSigning
}
else {
& $BuildModulePS1 -Module $ModuleName -ModulePrefix $ModulePrefix -GraphVersion $GraphVersion -ModuleVersion $ModuleVersion -ModulePreviewNumber $ModulePreviewNumber -RequiredModules $AuthenticationModule -ReleaseNotes $ModuleReleaseNotes
& $BuildModulePS1 -Module $ModuleName -ModulePrefix $ModulePrefix -GraphVersion $GraphVersion -ModuleVersion $ModuleVersion -ModulePreviewNumber $ModulePreviewNumber -RequiredModules $RequiredGraphModules -ReleaseNotes $ModuleReleaseNotes
}

if ($LASTEXITCODE) {
Expand Down
12 changes: 7 additions & 5 deletions tools/GenerateRollUpModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $ModuleMetadataJson = Join-Path $PSScriptRoot "..\config\ModuleMetadata.json" -R
$ArtifactsLocation = Join-Path $PSScriptRoot "..\artifacts\$GraphVersion\"
$GraphModuleLocation = Join-Path $PSScriptRoot "..\src\$GraphVersion\Graph\Graph"
$RollUpModuleNuspec = Join-Path $GraphModuleLocation ".\$ModulePrefix"
$RequiredGraphModules = New-Object collections.generic.list[string]
$RequiredGraphModules = @()
[HashTable] $ModuleMapping = Get-Content $ModuleMappingConfigPath | ConvertFrom-Json -AsHashTable
[HashTable] $NuspecMetadata = Get-Content $ModuleMetadataJson | ConvertFrom-Json -AsHashTable
$NuspecMetadata.Remove("assemblyOriginatorKeyFile")
Expand Down Expand Up @@ -76,14 +76,16 @@ elseif ($VersionState.Equals([VersionState]::Valid) -or $VersionState.Equals([Ve
}

# Add auth module as a dependency.
Install-Module "Microsoft.Graph.Authentication" -Repository $RepositoryName -AllowPrerelease -Force
$RequiredGraphModules.Add("Microsoft.Graph.Authentication")
$ExistingAuthModule = Find-Module "Microsoft.Graph.Authentication"
Install-Module $ExistingAuthModule.Name -Repository $RepositoryName -AllowPrerelease -Force
$RequiredGraphModules += @{ ModuleName = $ExistingAuthModule.Name ; ModuleVersion = $ExistingAuthModule.Version }

foreach ($RequiredModule in $ModuleMapping.Keys) {
# Install module locally in order to specify it as a dependency of the roll-up module down the generation pipeline.
# https://stackoverflow.com/questions/46216038/how-do-i-define-requiredmodules-in-a-powershell-module-manifest-psd1.
Install-Module "$ModulePrefix.$RequiredModule" -Repository $RepositoryName -AllowPrerelease -Force
$RequiredGraphModules.Add("$ModulePrefix.$RequiredModule")
$ExistingWorkloadModule = Find-Module "$ModulePrefix.$RequiredModule"
Install-Module $ExistingWorkloadModule.Name -Repository $RepositoryName -AllowPrerelease -Force
$RequiredGraphModules += @{ ModuleName = $ExistingWorkloadModule.Name ; RequiredVersion = $ExistingWorkloadModule.Version }
}

[HashTable]$ModuleManifestSettings = @{
Expand Down
7 changes: 4 additions & 3 deletions tools/NuspecHelper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Set-NuSpecValues(
[parameter(Position=1,Mandatory=$true)][ValidateScript({Test-Path $_ -PathType Leaf})][string] $NuSpecFilePath,
[parameter(Position=2,Mandatory=$true)][string] $VersionNumber,
[parameter(Position=3,Mandatory=$true)][string] $IconUrl,
[parameter(Position=4)][string[]] $Dependencies,
[parameter(Position=4)][hashtable[]] $Dependencies,
[parameter(Position=5)][string[]] $ReleaseNotes) {
$XmlDocument = New-Object System.Xml.XmlDocument
$XmlDocument.Load($NuSpecFilePath)
Expand Down Expand Up @@ -69,7 +69,7 @@ function Set-ElementValue(
function Set-Dependencies(
[System.Xml.XmlDocument] $XmlDocument,
[System.Xml.XmlElement] $MetadataElement,
[string[]] $Dependencies) {
[hashtable[]] $Dependencies) {
if(-not $MetadataElement["dependencies"]){
$NewDependenciesElement = $XmlDocument.CreateElement("dependencies", $XmlDocument.DocumentElement.NamespaceURI)
$MetadataElement.AppendChild($NewDependenciesElement)
Expand All @@ -79,7 +79,8 @@ function Set-Dependencies(

foreach($Dependency in $Dependencies){
$NewDependencyElement = $XmlDocument.CreateElement("dependency", $XmlDocument.DocumentElement.NamespaceURI)
$NewDependencyElement.SetAttribute("id", $Dependency)
$NewDependencyElement.SetAttribute("id", $Dependency.ModuleName)
$NewDependencyElement.SetAttribute("version", $Dependency.ModuleVersion ?? $Dependency.RequiredVersion)

$MetadataElement["dependencies"].AppendChild($NewDependencyElement)
}
Expand Down