Skip to content

Commit ceb5188

Browse files
committed
add test
1 parent 2b221c6 commit ceb5188

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

eng/scripts/automation/GenerateAndBuildLib.ps1

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $TSP_LOCATION_FILE = "tsp-location.yaml"
55
. (Join-Path $PSScriptRoot ".." ".." "common" "scripts" "Helpers" PSModule-Helpers.ps1)
66

77
#mgmt: swagger directory name to sdk directory name map
8-
$packageNameHash = [ordered]@{"vmware" = "avs";
8+
$packageNameHash = [ordered]@{"vmware" = "avs";
99
"azure-kusto" = "kusto";
1010
"cosmos-db" = "cosmosdb";
1111
"msi" = "managedserviceidentity";
@@ -55,7 +55,7 @@ function Get-SwaggerInfo()
5555
create or update the autorest config file for sdk (autorest.md)
5656
5757
.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
5959
contain only require block, if input-file parameter is provided, autorest.md will contain only require block.
6060
2. merge the autorestConfig to the autorest.md
6161
@@ -111,9 +111,9 @@ function CreateOrUpdateAutorestConfigFile() {
111111

112112
$inputRegex = "(?:(?:input-file|require)\s*:\s*\r?\n(?:\s*-\s+.*\r?\n)+|(?:input-file|require):\s+.*)"
113113
$fileContent = $fileContent -replace $inputRegex, $configline
114-
$fileContent | Set-Content $autorestFilePath
114+
$fileContent | Set-Content $autorestFilePath
115115
}
116-
116+
117117
# update autorest.md with configuration
118118
if ( $autorestConfigYaml) {
119119
Write-Host "Update autorest.md with configuration."
@@ -153,7 +153,7 @@ function CreateOrUpdateAutorestConfigFile() {
153153
Throw "autorest.md does not exist, and no autorest configuration to create one."
154154
}
155155
}
156-
}
156+
}
157157

158158
function Update-CIYmlFile() {
159159
param (
@@ -349,7 +349,7 @@ function New-MgmtPackageFolder() {
349349
[string]$AUTOREST_CONFIG_FILE = "autorest.md",
350350
[string]$outputJsonFile = "newPacakgeOutput.json"
351351
)
352-
352+
353353
if ($packageName -eq "") {
354354
$packageName = $service
355355
}
@@ -375,8 +375,9 @@ function New-MgmtPackageFolder() {
375375
Pop-Location
376376

377377
RegisterMgmtSDKToMgmtCoreClient -sdkRepoRootPath $sdkPath
378+
git diff $sdkPath/sdk/resourcemanager/ci.mgmt.yml
378379
}
379-
380+
380381
# update the readme path.
381382
if ($readme) {
382383
Write-Host "Updating autorest.md file."
@@ -385,19 +386,19 @@ function New-MgmtPackageFolder() {
385386
$file="$projectFolder/src/$AUTOREST_CONFIG_FILE"
386387
(Get-Content $file) -replace $rquirefileRex, "$requirefile" | Set-Content $file
387388
}
388-
389+
389390
Push-Location $sdkPath
390391
$relativeFolderPath = Resolve-Path $projectFolder -Relative
391392
Pop-Location
392-
393+
393394
$outputJson = [PSCustomObject]@{
394395
service = $service
395396
packageName = $mgmtPackageName
396397
projectFolder = $projectFolder
397398
path = @($relativeFolderPath)
398399
}
399400
$outputJson | ConvertTo-Json -depth 100 | Out-File $outputJsonFile
400-
401+
401402
return $projectFolder
402403
}
403404

@@ -409,7 +410,7 @@ function CreateOrUpdateTypeSpecConfigFile() {
409410
[string]$repo = "",
410411
[string]$specRoot = "",
411412
[string]$additionalSubDirectories="" #additional directories needed, separated by semicolon if more than one
412-
413+
413414
)
414415
if (!(Test-Path -Path $typespecConfigurationFile)) {
415416
New-Item -Path $typespecConfigurationFile
@@ -474,15 +475,15 @@ function New-TypeSpecPackageFolder() {
474475
if (Test-Path -Path $projectFolder/src/autorest.md) {
475476
Remove-Item -Path $projectFolder/src/autorest.md
476477
}
477-
478+
478479
CreateOrUpdateTypeSpecConfigFile `
479480
-typespecConfigurationFile $projectFolder/$TSP_LOCATION_FILE `
480481
-directory $relatedTypeSpecProjectFolder `
481482
-commit $commit `
482483
-repo $repo `
483484
-specRoot $specRoot `
484485
-additionalSubDirectories $additionalSubDirectories
485-
486+
486487
Update-CIYmlFile -ciFilePath $ciymlFilePath -artifact $namespace
487488
} else {
488489
Write-Host "Path doesn't exist. create template."
@@ -502,7 +503,7 @@ function New-TypeSpecPackageFolder() {
502503
$clientName = $namespaceArray[-1]
503504
$groupName = $namespaceArray[1..$endIndex] -join "."
504505
$dotnetNewCmd = "dotnet new azsdkdpg --name $namespace --clientName $clientName --groupName $groupName --serviceDirectory $service --force"
505-
506+
506507
if (Test-Path -Path $ciymlFilePath) {
507508
Write-Host "ci.yml already exists. update it to include the new serviceDirectory."
508509
Update-CIYmlFile -ciFilePath $ciymlFilePath -artifact $namespace
@@ -617,12 +618,12 @@ function Invoke-GenerateAndBuildSDK () {
617618
Write-Host "readmeFile:$readmeFile"
618619
$service, $serviceType = Get-ResourceProviderFromReadme $readmeFile
619620
Write-Host "service:$service, serviceType:$serviceType"
620-
621+
621622
if (!$readmeFile.StartsWith("http") -And !(Test-Path -Path $readmeFile)) {
622623
Write-Error "readme file '$readmeFile' does not exist."
623624
exit 1
624625
}
625-
626+
626627
$packagesToGen = @()
627628
$newPackageOutput = "newPackageOutput.json"
628629
if ( $serviceType -eq "resource-manager" ) {
@@ -788,7 +789,7 @@ function GeneratePackage()
788789
Remove-Item $logFilePath
789790
}
790791
}
791-
792+
792793
$changelog = [PSCustomObject]@{
793794
content = $content
794795
hasBreakingChange = $hasBreakingChange
@@ -819,7 +820,7 @@ function GeneratePackage()
819820
if ( $serviceType -eq "resource-manager" ) {
820821
$ciFilePath = "sdk/$service/ci.mgmt.yml"
821822
}
822-
$generatedSDKPackages.Add(@{packageName="$packageName";
823+
$generatedSDKPackages.Add(@{packageName="$packageName";
823824
result=$result;
824825
path=@("$path", "$ciFilePath");
825826
packageFolder="$projectFolder";
@@ -842,7 +843,7 @@ function UpdateExistingSDKByInputFiles()
842843

843844
$autorestFilesPath = Get-ChildItem -Path "$sdkRootPath/sdk" -Filter autorest.md -Recurse | Resolve-Path -Relative
844845
Write-Host "Updating autorest.md files for all the changed swaggers."
845-
846+
846847
$sdksInfo = @{}
847848
$regexToFindSha = "https:\/\/[^`"]*[\/][0-9a-f]{4,40}[\/]"
848849
foreach ($path in $autorestFilesPath) {
@@ -875,5 +876,5 @@ function UpdateExistingSDKByInputFiles()
875876
$projectFolder = Resolve-Path -Path $projectFolder
876877
GeneratePackage -projectFolder $projectFolder -sdkRootPath $sdkRootPath -path $path -downloadUrlPrefix "$downloadUrlPrefix" -serviceType $serviceType -generatedSDKPackages $generatedSDKPackages
877878
}
878-
879+
879880
}

0 commit comments

Comments
 (0)