Skip to content

Commit ca73101

Browse files
implement Automation-Update-Metadata.ps1 for inner loop v1. (#53458)
* implement Automation-Update-Metadata.ps1 for inner loop. * address review comments. * address review comments. * address review comments. * Use Export-API script directly * Add SdkRepPath parameter as it is required for the cli when we enable cmdletbinding --------- Co-authored-by: Wes Haggard <[email protected]>
1 parent 349d2b0 commit ca73101

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

eng/scripts/Export-API.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
[CmdletBinding()]
22
param (
33
[Parameter(Position=0)]
4-
[ValidateNotNullOrEmpty()]
54
[string] $ServiceDirectory,
65
[string] $SDKType = "all",
7-
[switch] $SpellCheckPublicApiSurface
6+
[switch] $SpellCheckPublicApiSurface,
7+
[string] $PackagePath,
8+
[string] $SdkRepoPath
89
)
910

1011
if ($SpellCheckPublicApiSurface -and -not (Get-Command 'npx')) {
1112
Write-Error "Could not locate npx. Install NodeJS (includes npm and npx) https://nodejs.org/en/download/"
1213
exit 1
1314
}
1415

16+
$relativePackagePath = if ($PackagePath) {
17+
Resolve-Path -Relative -RelativeBasePath (Join-Path $SdkRepoPath "sdk") -Path $PackagePath
18+
} else {
19+
$ServiceDirectory
20+
}
21+
1522
$servicesProj = Resolve-Path "$PSScriptRoot/../service.proj"
1623

1724
$debugLogging = $env:SYSTEM_DEBUG -eq "true"
1825
$logsFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY
1926
$diagnosticArguments = ($debugLogging -and $logsFolder) ? "/binarylogger:$logsFolder/exportapi.binlog" : ""
2027

21-
dotnet build /t:ExportApi /p:RunApiCompat=false /p:InheritDocEnabled=false /p:GeneratePackageOnBuild=false /p:Configuration=Release /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:IncludeTests=false /p:Scope="$ServiceDirectory" /p:SDKType=$SDKType /restore $servicesProj $diagnosticArguments
28+
dotnet build /t:ExportApi /p:RunApiCompat=false /p:InheritDocEnabled=false /p:GeneratePackageOnBuild=false /p:Configuration=Release /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:IncludeTests=false /p:Scope="$relativePackagePath" /p:SDKType=$SDKType /restore $servicesProj $diagnosticArguments
2229

2330
# Normalize line endings to LF in generated API listing files
2431
Write-Host "Normalizing line endings in API listing files"
25-
$apiListingFiles = Get-ChildItem -Path "$PSScriptRoot/../../sdk/$ServiceDirectory/*/api/*.cs" -ErrorAction SilentlyContinue
32+
$apiListingFiles = Get-ChildItem -Path "$PSScriptRoot/../../sdk/$relativePackagePath/*/api/*.cs" -ErrorAction SilentlyContinue
2633
foreach ($file in $apiListingFiles) {
2734
$content = Get-Content -Path $file.FullName -Raw
2835
if ($content) {

eng/swagger_to_sdk_config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"packageFolderFromFileSearch": false,
2525
"buildScript": {
2626
"command": "dotnet build {packagePath}"
27+
},
28+
"updateMetadataScript": {
29+
"path": "./eng/scripts/Export-API.ps1"
2730
}
2831
}
2932
}

0 commit comments

Comments
 (0)