11[CmdletBinding ()]
22param (
3- [Parameter (Position = 0 )]
4-
5- [Parameter (Mandatory = $true , ParameterSetName = ' ServiceDirectory' )]
3+ [Parameter (Position = 0 , Mandatory = $true , ParameterSetName = ' ServiceDirectory' )]
64 [string ] $ServiceDirectory ,
75
86 [string ] $SDKType = " all" ,
@@ -18,6 +16,9 @@ if ($SpellCheckPublicApiSurface -and -not (Get-Command 'npx')) {
1816 Write-Error " Could not locate npx. Install NodeJS (includes npm and npx) https://nodejs.org/en/download/"
1917 exit 1
2018}
19+
20+ . $PSScriptRoot / ../ common/ scripts/ Helpers/ CommandInvocation- Helpers.ps1
21+
2122$relativePackagePath = $ServiceDirectory
2223$apiListingFilesFilter = " $PSScriptRoot /../../sdk/$ServiceDirectory /*/api/*.cs"
2324
@@ -32,30 +33,11 @@ $debugLogging = $env:SYSTEM_DEBUG -eq "true"
3233$logsFolder = $env: BUILD_ARTIFACTSTAGINGDIRECTORY
3334$diagnosticArguments = ($debugLogging -and $logsFolder ) ? " /binarylogger:$logsFolder /exportapi.binlog" : " "
3435
35- dotnet build `
36- / t:ExportApi `
37- / p:RunApiCompat= false `
38- / p:InheritDocEnabled= false `
39- / p:GeneratePackageOnBuild= false `
40- / p:Configuration= Release `
41- / p:IncludeSamples= false `
42- / p:IncludePerf= false `
43- / p:IncludeStress= false `
44- / p:IncludeTests= false `
45- / p:Scope= " $relativePackagePath " `
46- / p:SDKType= $SDKType `
47- / restore `
48- $servicesProj `
49- $diagnosticArguments
50-
51- if ($LASTEXITCODE ) {
52- Write-Host " ##vso[task.LogIssue type=error;]API export failed. See the build logs for details."
53- exit $LASTEXITCODE
54- }
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 "
5537
5638# Normalize line endings to LF in generated API listing files
5739Write-Host " Normalizing line endings in API listing files"
58- $apiListingFiles = Get-ChildItem - Path $apiListingFilesFilter
40+ $apiListingFiles = Get-ChildItem - Path $apiListingFilesFilter - ErrorAction SilentlyContinue
5941foreach ($file in $apiListingFiles ) {
6042 $content = Get-Content - Path $file.FullName - Raw
6143 if ($content ) {
@@ -69,15 +51,9 @@ foreach ($file in $apiListingFiles) {
6951}
7052
7153if ($SpellCheckPublicApiSurface ) {
72- Write-Host " Spell check public API surface"
73-
74- if ($PSCmdlet.ParameterSetName -eq ' PackagePath' ) {
75- & " $PSScriptRoot /spell-check-public-api.ps1" `
76- - RelativePackagePath $relativePackagePath
77- } else {
78- & " $PSScriptRoot /spell-check-public-api.ps1" `
79- - ServiceDirectory $relativePackagePath
80- }
54+ Write-Host " Spell check public API surface (found $ ( $apiListingFiles.Count ) files)"
55+ & " $PSScriptRoot /../common/spelling/Invoke-Cspell.ps1" `
56+ - FileList $apiListingFiles.FullName
8157
8258 if ($LASTEXITCODE ) {
8359 Write-Host " ##vso[task.LogIssue type=error;]Spelling errors detected. To correct false positives or learn about spell checking see: https://aka.ms/azsdk/engsys/spellcheck"
0 commit comments