11[CmdletBinding ()]
22param (
3- [Parameter (Position = 0 )]
3+ [Parameter (Position = 0 , Mandatory = $true , ParameterSetName = ' ServiceDirectory ' )]
44 [string ] $ServiceDirectory ,
5+
56 [string ] $SDKType = " all" ,
67 [switch ] $SpellCheckPublicApiSurface ,
8+
9+ [Parameter (Mandatory = $true , ParameterSetName = ' PackagePath' )]
710 [string ] $PackagePath ,
11+ [Parameter (Mandatory = $true , ParameterSetName = ' PackagePath' )]
812 [string ] $SdkRepoPath
913)
1014
@@ -13,10 +17,14 @@ if ($SpellCheckPublicApiSurface -and -not (Get-Command 'npx')) {
1317 exit 1
1418}
1519
16- $relativePackagePath = if ($PackagePath ) {
17- Resolve-Path - Relative - RelativeBasePath (Join-Path $SdkRepoPath " sdk" ) - Path $PackagePath
18- } else {
19- $ServiceDirectory
20+ . $PSScriptRoot / ../ common/ scripts/ Helpers/ CommandInvocation- Helpers.ps1
21+
22+ $relativePackagePath = $ServiceDirectory
23+ $apiListingFilesFilter = " $PSScriptRoot /../../sdk/$ServiceDirectory /*/api/*.cs"
24+
25+ if ($PSCmdlet.ParameterSetName -eq ' PackagePath' ) {
26+ $relativePackagePath = Resolve-Path - Relative - RelativeBasePath (Join-Path $SdkRepoPath " sdk" ) - Path $PackagePath
27+ $apiListingFilesFilter = " $PSScriptRoot /../../sdk/$relativePackagePath /api/*.cs"
2028}
2129
2230$servicesProj = Resolve-Path " $PSScriptRoot /../service.proj"
@@ -25,11 +33,11 @@ $debugLogging = $env:SYSTEM_DEBUG -eq "true"
2533$logsFolder = $env: BUILD_ARTIFACTSTAGINGDIRECTORY
2634$diagnosticArguments = ($debugLogging -and $logsFolder ) ? " /binarylogger:$logsFolder /exportapi.binlog" : " "
2735
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
36+ Invoke-LoggedMsbuildCommand " 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 "
2937
3038# Normalize line endings to LF in generated API listing files
3139Write-Host " Normalizing line endings in API listing files"
32- $apiListingFiles = Get-ChildItem - Path " $PSScriptRoot /../../sdk/ $relativePackagePath /*/api/*.cs " - ErrorAction SilentlyContinue
40+ $apiListingFiles = Get-ChildItem - Path $apiListingFilesFilter - ErrorAction SilentlyContinue
3341foreach ($file in $apiListingFiles ) {
3442 $content = Get-Content - Path $file.FullName - Raw
3543 if ($content ) {
0 commit comments