@@ -177,6 +177,45 @@ function Update-CIYmlFile() {
177
177
}
178
178
}
179
179
180
+ function RegisterMgmtSDKToMgmtCoreClient () {
181
+ param (
182
+ [string ]$sdkRepoRootPath
183
+ )
184
+ $packagesPath = Join-Path $sdkRepoRootPath " sdk"
185
+ $track2MgmtDirs = Get-ChildItem - Path " $packagesPath " - Directory - Recurse - Depth 1 | Where-Object { $_.Name -match " (Azure.ResourceManager.)" -and $ (Test-Path (" $ ( $_.FullName ) /src" )) }
186
+ Write-Host " Updating mgmt core client ci.mgmt.yml"
187
+ # add path for each mgmt library into Azure.ResourceManager
188
+ $armCiFile = " $sdkRepoRootPath /sdk/resourcemanager/ci.mgmt.yml"
189
+ $armLines = Get-Content $armCiFile
190
+ $newLines = [System.Collections.ArrayList ]::new()
191
+ $startIndex = $track2MgmtDirs [0 ].FullName.IndexOf((" \sdk\" )) + 1
192
+ $shouldRemove = $false
193
+ foreach ($line in $armLines ) {
194
+ if ($line.StartsWith (" paths:" )) {
195
+ $newLines.Add ($line ) | Out-Null
196
+ $newLines.Add (" include:" ) | Out-Null
197
+ $newLines.Add (" - sdk/resourcemanager" ) | Out-Null
198
+ $newLines.Add (" - common/ManagementTestShared" ) | Out-Null
199
+ $newLines.Add (" - common/ManagementCoreShared" ) | Out-Null
200
+ foreach ($dir in $track2MgmtDirs ) {
201
+ $newLine = " - $ ( $dir.FullName.Substring ($startIndex , $dir.FullName.Length - $startIndex ).Replace(' \' , ' /' )) "
202
+ $newLines.Add ($newLine ) | Out-Null
203
+ }
204
+ $shouldRemove = $true
205
+ Continue
206
+ }
207
+
208
+ if ($shouldRemove ) {
209
+ if ($line.StartsWith (" " )) {
210
+ Continue
211
+ }
212
+ $shouldRemove = $false
213
+ }
214
+
215
+ $newLines.Add ($line ) | Out-Null
216
+ }
217
+ Set-Content - Path $armCiFile $newLines
218
+ }
180
219
<#
181
220
. SYNOPSIS
182
221
Prepare the SDK pacakge for data-plane.
@@ -334,6 +373,8 @@ function New-MgmtPackageFolder() {
334
373
Push-Location $projectFolder
335
374
dotnet new azuremgmt -- provider $packageName -- includeCI true -- force
336
375
Pop-Location
376
+
377
+ RegisterMgmtSDKToMgmtCoreClient - sdkRepoRootPath $sdkPath
337
378
}
338
379
339
380
# update the readme path.
0 commit comments