Skip to content

Commit 54f1b06

Browse files
committed
register mgmt sdk to mgmt core client
1 parent cbeef9b commit 54f1b06

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

eng/scripts/automation/GenerateAndBuildLib.ps1

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,45 @@ function Update-CIYmlFile() {
177177
}
178178
}
179179

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+
}
180219
<#
181220
.SYNOPSIS
182221
Prepare the SDK pacakge for data-plane.
@@ -334,6 +373,8 @@ function New-MgmtPackageFolder() {
334373
Push-Location $projectFolder
335374
dotnet new azuremgmt --provider $packageName --includeCI true --force
336375
Pop-Location
376+
377+
RegisterMgmtSDKToMgmtCoreClient -sdkRepoRootPath $sdkPath
337378
}
338379

339380
# update the readme path.

0 commit comments

Comments
 (0)