@@ -54,8 +54,7 @@ if($ModulePreviewNumber -eq -1) {
54
54
# Install module locally in order to specify it as a dependency for other modules down the generation pipeline.
55
55
# https://stackoverflow.com/questions/46216038/how-do-i-define-requiredmodules-in-a-powershell-module-manifest-psd1.
56
56
$ExistingAuthModule = Find-Module " Microsoft.Graph.Authentication" - Repository $RepositoryName - AllowPrerelease:$AllowPreRelease
57
- Write-Warning " Auth Module: $ExistingAuthModule .Name"
58
- Write-Warning " Auth Module: $ExistingAuthModule .Version"
57
+ Write-Host - ForegroundColor Green " Auth Module: $ ( $ExistingAuthModule.Name ) , $ ( $ExistingAuthModule.Version ) "
59
58
if (! (Get-Module - Name $ExistingAuthModule.Name - ListAvailable)) {
60
59
Install-Module $ExistingAuthModule.Name - Repository $RepositoryName - Force - AllowClobber - AllowPrerelease:$AllowPreRelease
61
60
}
@@ -83,7 +82,8 @@ $ModuleMapping.Keys | ForEach-Object -ThrottleLimit $ModuleMapping.Keys.Count -P
83
82
}
84
83
85
84
$ModuleName = $_
86
- Write-Warning " Generating $ModuleName "
85
+ $FullyQualifiedModuleName = " $using :ModulePrefix .$ModuleName "
86
+ Write-Host - ForegroundColor Green " Generating '$FullyQualifiedModuleName ' module..."
87
87
$ModuleProjectDir = Join-Path $Using :ModulesOutputDir " $ModuleName \$ModuleName "
88
88
89
89
# Copy AutoRest readme.md config is none exists.
@@ -98,37 +98,36 @@ $ModuleMapping.Keys | ForEach-Object -ThrottleLimit $ModuleMapping.Keys.Count -P
98
98
$ModuleVersion = & $Using :ReadModuleReadMePS1 - ReadMePath $ModuleLevelReadMePath - FieldToRead " module-version"
99
99
if ($ModuleVersion -eq $null ) {
100
100
# Module version not set in readme.md.
101
- Write-Error " Version number is not set on $Using :ModulePrefix . $ModuleName module. Please set 'module-version' in $ModuleLevelReadMePath ."
101
+ Write-Error " Version number is not set on $FullyQualifiedModuleName module. Please set 'module-version' in $ModuleLevelReadMePath ."
102
102
}
103
103
104
104
# Validate module version with the one on PSGallery.
105
- [VersionState ] $VersionState = & $Using :ValidateUpdatedModuleVersionPS1 - ModuleName " $Using :ModulePrefix . $ModuleName " - NextVersion $ModuleVersion - PSRepository RepositoryName - ModulePreviewNumber $ModulePreviewNumber
105
+ [VersionState ] $VersionState = & $Using :ValidateUpdatedModuleVersionPS1 - ModuleName " $FullyQualifiedModuleName " - NextVersion $ModuleVersion - PSRepository RepositoryName - ModulePreviewNumber $ModulePreviewNumber
106
106
107
107
if ($VersionState.Equals ([VersionState ]::Invalid) -and ! $Using :SkipVersionCheck ) {
108
- Write-Warning " The specified version in $Using :ModulePrefix . $ModuleName module is either higher or lower than what's on $Using :RepositoryName . Update the 'module-version' in $ModuleLevelReadMePath "
108
+ Write-Warning " The specified version in $FullyQualifiedModuleName module is either higher or lower than what's on $Using :RepositoryName . Update the 'module-version' in $ModuleLevelReadMePath "
109
109
}
110
110
elseif ($VersionState.Equals ([VersionState ]::EqualToFeed) -and ! $SkipVersionCheck ) {
111
- Write-Warning " $Using :ModulePrefix . $ModuleName module skipped. Version has not changed and is equal to what's on $Using :RepositoryName ."
111
+ Write-Warning " $FullyQualifiedModuleName module skipped. Version has not changed and is equal to what's on $Using :RepositoryName ."
112
112
}
113
113
elseif ($VersionState.Equals ([VersionState ]::Valid) -or $VersionState.Equals ([VersionState ]::NotOnFeed) -or $Using :SkipVersionCheck ) {
114
114
# Read release notes from readme.
115
115
$ModuleReleaseNotes = & $Using :ReadModuleReadMePS1 - ReadMePath $ModuleLevelReadMePath - FieldToRead " release-notes"
116
116
if ($ModuleReleaseNotes -eq $null ) {
117
117
# Release notes not set in readme.md.
118
- Write-Error " Release notes not set on $Using :ModulePrefix . $ModuleName module. Please set 'release-notes' in $ModuleLevelReadMePath ."
118
+ Write-Error " Release notes not set on $FullyQualifiedModuleName module. Please set 'release-notes' in $ModuleLevelReadMePath ."
119
119
}
120
120
121
121
try {
122
122
# Generate PowerShell modules.
123
- Write-Host - ForegroundColor Green " Generating '$Using :ModulePrefix .$ModuleName ' module..."
124
123
& autorest -- module- version:$ModuleVersion -- service- name:$ModuleName $ModuleLevelReadMePath -- verbose
125
124
if ($LASTEXITCODE ) {
126
125
Write-Error " Failed to generate '$ModuleName ' module."
127
126
}
128
- Write-Host - ForegroundColor Green " AutoRest generated '$Using :ModulePrefix . $ModuleName ' successfully."
127
+ Write-Host - ForegroundColor Green " AutoRest generated '$FullyQualifiedModuleName ' successfully."
129
128
130
129
# Manage generated module.
131
- Write-Host - ForegroundColor Green " Managing '$Using :ModulePrefix . $ModuleName ' module..."
130
+ Write-Host - ForegroundColor Green " Managing '$FullyQualifiedModuleName ' module..."
132
131
& $Using :ManageGeneratedModulePS1 - Module $ModuleName - ModulePrefix $Using :ModulePrefix
133
132
134
133
if ($Using :Build ) {
@@ -146,12 +145,12 @@ $ModuleMapping.Keys | ForEach-Object -ThrottleLimit $ModuleMapping.Keys.Count -P
146
145
$Profiles = Get-ChildItem - Path $ModuleExportsPath - Directory | % { $_.Name }
147
146
148
147
# Update module manifest wiht profiles.
149
- $ModuleManifestPath = Join-Path $ModuleProjectDir " $Using :ModulePrefix . $ModuleName .psd1"
148
+ $ModuleManifestPath = Join-Path $ModuleProjectDir " $FullyQualifiedModuleName .psd1"
150
149
[HashTable ]$PrivateData = @ { Profiles = $Profiles }
151
150
Update-ModuleManifest - Path $ModuleManifestPath - PrivateData $PrivateData
152
151
153
152
# Update module psm1 with Graph session profile name.
154
- $ModulePsm1 = Join-Path $ModuleProjectDir " /$Using :ModulePrefix . $ModuleName .psm1"
153
+ $ModulePsm1 = Join-Path $ModuleProjectDir " /$FullyQualifiedModuleName .psm1"
155
154
(Get-Content - Path $ModulePsm1 ) | ForEach-Object {
156
155
if ($_ -match ' \$instance = \[Microsoft.Graph.PowerShell.Module\]::Instance' ) {
157
156
# Update main psm1 with Graph session profile name and module name.
@@ -161,13 +160,15 @@ $ModuleMapping.Keys | ForEach-Object -ThrottleLimit $ModuleMapping.Keys.Count -P
161
160
# Rename all Azure instances in psm1 to `Microsoft Graph`.
162
161
$updatedLine = $_ -replace ' Azure' , ' Microsoft Graph'
163
162
# Replace all 'instance.Name' declarations with fully qualified module name.
164
- $updatedLine = $updatedLine -replace ' \$\(\$instance.Name\)' , " $ModulePrefix .$ModuleName "
163
+ $updatedLine = $updatedLine -replace ' \$\(\$instance.Name\)' , " $FullyQualifiedModuleName "
164
+ # Replace Write-Information with Write-Debug
165
+ $updatedLine = $updatedLine -replace ' Write\-Information' , ' Write-Debug'
165
166
$updatedLine
166
167
}
167
168
} | Set-Content $ModulePsm1
168
169
169
170
# Address AutoREST bug where it looks for exports in the wrong directory.
170
- $InternalModulePsm1 = Join-Path $ModuleProjectDir " /internal/$Using :ModulePrefix . $ModuleName .internal.psm1"
171
+ $InternalModulePsm1 = Join-Path $ModuleProjectDir " /internal/$FullyQualifiedModuleName .internal.psm1"
171
172
(Get-Content - Path $InternalModulePsm1 ) | ForEach-Object {
172
173
$updatedLine = $_
173
174
# Address AutoREST bug where it looks for exports in the wrong directory.
0 commit comments