@@ -5,7 +5,7 @@ $TSP_LOCATION_FILE = "tsp-location.yaml"
5
5
. (Join-Path $PSScriptRoot " .." " .." " common" " scripts" " Helpers" PSModule- Helpers.ps1)
6
6
7
7
# mgmt: swagger directory name to sdk directory name map
8
- $packageNameHash = [ordered ]@ {" vmware" = " avs" ;
8
+ $packageNameHash = [ordered ]@ {" vmware" = " avs" ;
9
9
" azure-kusto" = " kusto" ;
10
10
" cosmos-db" = " cosmosdb" ;
11
11
" msi" = " managedserviceidentity" ;
@@ -55,7 +55,7 @@ function Get-SwaggerInfo()
55
55
create or update the autorest config file for sdk (autorest.md)
56
56
57
57
. DESCRIPTION
58
- 1. update input-file or require block according to the input parameter. If readme parameter is provided, autorest.md will
58
+ 1. update input-file or require block according to the input parameter. If readme parameter is provided, autorest.md will
59
59
contain only require block, if input-file parameter is provided, autorest.md will contain only require block.
60
60
2. merge the autorestConfig to the autorest.md
61
61
@@ -111,9 +111,9 @@ function CreateOrUpdateAutorestConfigFile() {
111
111
112
112
$inputRegex = " (?:(?:input-file|require)\s*:\s*\r?\n(?:\s*-\s+.*\r?\n)+|(?:input-file|require):\s+.*)"
113
113
$fileContent = $fileContent -replace $inputRegex , $configline
114
- $fileContent | Set-Content $autorestFilePath
114
+ $fileContent | Set-Content $autorestFilePath
115
115
}
116
-
116
+
117
117
# update autorest.md with configuration
118
118
if ( $autorestConfigYaml ) {
119
119
Write-Host " Update autorest.md with configuration."
@@ -153,7 +153,7 @@ function CreateOrUpdateAutorestConfigFile() {
153
153
Throw " autorest.md does not exist, and no autorest configuration to create one."
154
154
}
155
155
}
156
- }
156
+ }
157
157
158
158
function Update-CIYmlFile () {
159
159
param (
@@ -349,7 +349,7 @@ function New-MgmtPackageFolder() {
349
349
[string ]$AUTOREST_CONFIG_FILE = " autorest.md" ,
350
350
[string ]$outputJsonFile = " newPacakgeOutput.json"
351
351
)
352
-
352
+
353
353
if ($packageName -eq " " ) {
354
354
$packageName = $service
355
355
}
@@ -375,8 +375,9 @@ function New-MgmtPackageFolder() {
375
375
Pop-Location
376
376
377
377
RegisterMgmtSDKToMgmtCoreClient - sdkRepoRootPath $sdkPath
378
+ git diff $sdkPath / sdk/ resourcemanager/ ci.mgmt.yml
378
379
}
379
-
380
+
380
381
# update the readme path.
381
382
if ($readme ) {
382
383
Write-Host " Updating autorest.md file."
@@ -385,19 +386,19 @@ function New-MgmtPackageFolder() {
385
386
$file = " $projectFolder /src/$AUTOREST_CONFIG_FILE "
386
387
(Get-Content $file ) -replace $rquirefileRex , " $requirefile " | Set-Content $file
387
388
}
388
-
389
+
389
390
Push-Location $sdkPath
390
391
$relativeFolderPath = Resolve-Path $projectFolder - Relative
391
392
Pop-Location
392
-
393
+
393
394
$outputJson = [PSCustomObject ]@ {
394
395
service = $service
395
396
packageName = $mgmtPackageName
396
397
projectFolder = $projectFolder
397
398
path = @ ($relativeFolderPath )
398
399
}
399
400
$outputJson | ConvertTo-Json - depth 100 | Out-File $outputJsonFile
400
-
401
+
401
402
return $projectFolder
402
403
}
403
404
@@ -409,7 +410,7 @@ function CreateOrUpdateTypeSpecConfigFile() {
409
410
[string ]$repo = " " ,
410
411
[string ]$specRoot = " " ,
411
412
[string ]$additionalSubDirectories = " " # additional directories needed, separated by semicolon if more than one
412
-
413
+
413
414
)
414
415
if (! (Test-Path - Path $typespecConfigurationFile )) {
415
416
New-Item - Path $typespecConfigurationFile
@@ -474,15 +475,15 @@ function New-TypeSpecPackageFolder() {
474
475
if (Test-Path - Path $projectFolder / src/ autorest.md) {
475
476
Remove-Item - Path $projectFolder / src/ autorest.md
476
477
}
477
-
478
+
478
479
CreateOrUpdateTypeSpecConfigFile `
479
480
- typespecConfigurationFile $projectFolder / $TSP_LOCATION_FILE `
480
481
- directory $relatedTypeSpecProjectFolder `
481
482
- commit $commit `
482
483
- repo $repo `
483
484
- specRoot $specRoot `
484
485
- additionalSubDirectories $additionalSubDirectories
485
-
486
+
486
487
Update-CIYmlFile - ciFilePath $ciymlFilePath - artifact $namespace
487
488
} else {
488
489
Write-Host " Path doesn't exist. create template."
@@ -502,7 +503,7 @@ function New-TypeSpecPackageFolder() {
502
503
$clientName = $namespaceArray [-1 ]
503
504
$groupName = $namespaceArray [1 .. $endIndex ] -join " ."
504
505
$dotnetNewCmd = " dotnet new azsdkdpg --name $namespace --clientName $clientName --groupName $groupName --serviceDirectory $service --force"
505
-
506
+
506
507
if (Test-Path - Path $ciymlFilePath ) {
507
508
Write-Host " ci.yml already exists. update it to include the new serviceDirectory."
508
509
Update-CIYmlFile - ciFilePath $ciymlFilePath - artifact $namespace
@@ -617,12 +618,12 @@ function Invoke-GenerateAndBuildSDK () {
617
618
Write-Host " readmeFile:$readmeFile "
618
619
$service , $serviceType = Get-ResourceProviderFromReadme $readmeFile
619
620
Write-Host " service:$service , serviceType:$serviceType "
620
-
621
+
621
622
if (! $readmeFile.StartsWith (" http" ) -And ! (Test-Path - Path $readmeFile )) {
622
623
Write-Error " readme file '$readmeFile ' does not exist."
623
624
exit 1
624
625
}
625
-
626
+
626
627
$packagesToGen = @ ()
627
628
$newPackageOutput = " newPackageOutput.json"
628
629
if ( $serviceType -eq " resource-manager" ) {
@@ -788,7 +789,7 @@ function GeneratePackage()
788
789
Remove-Item $logFilePath
789
790
}
790
791
}
791
-
792
+
792
793
$changelog = [PSCustomObject ]@ {
793
794
content = $content
794
795
hasBreakingChange = $hasBreakingChange
@@ -819,7 +820,7 @@ function GeneratePackage()
819
820
if ( $serviceType -eq " resource-manager" ) {
820
821
$ciFilePath = " sdk/$service /ci.mgmt.yml"
821
822
}
822
- $generatedSDKPackages.Add (@ {packageName = " $packageName " ;
823
+ $generatedSDKPackages.Add (@ {packageName = " $packageName " ;
823
824
result = $result ;
824
825
path = @ (" $path " , " $ciFilePath " );
825
826
packageFolder = " $projectFolder " ;
@@ -842,7 +843,7 @@ function UpdateExistingSDKByInputFiles()
842
843
843
844
$autorestFilesPath = Get-ChildItem - Path " $sdkRootPath /sdk" - Filter autorest.md - Recurse | Resolve-Path - Relative
844
845
Write-Host " Updating autorest.md files for all the changed swaggers."
845
-
846
+
846
847
$sdksInfo = @ {}
847
848
$regexToFindSha = " https:\/\/[^`" ]*[\/][0-9a-f]{4,40}[\/]"
848
849
foreach ($path in $autorestFilesPath ) {
@@ -875,5 +876,5 @@ function UpdateExistingSDKByInputFiles()
875
876
$projectFolder = Resolve-Path - Path $projectFolder
876
877
GeneratePackage - projectFolder $projectFolder - sdkRootPath $sdkRootPath - path $path - downloadUrlPrefix " $downloadUrlPrefix " - serviceType $serviceType - generatedSDKPackages $generatedSDKPackages
877
878
}
878
-
879
+
879
880
}
0 commit comments