azure-sdk-for-cpp/eng/scripts/Generate-APIReview-Token-Files.ps1
Albert Cheng 9f2b00be2b
[apiview] adding pr support (#5932)
* add detect api changes

* add detect api changes

* trigger test pipeline

* adding cpp.json ref

* yml syntax

* move partial script below artifact publish

* renaming + trimming down

* download parser

* download parser

* download parser

* fix parser download

* update to parser 2.0

* update to parser 2.1

* update parser version

* trigger pipeline

* trigger pipeline

* download ste7p testing

* download ste7p testing

* download ste7p testing

* download parser from blob

* download parser from blob

* download parser from blob

* download parser from blob

* cspell

* download parser from blob

* download parser from blob

* directory change for get artifacts

* directory change for get artifacts

* publish packageinfo artifact

* publish packageinfo artifact

* publish packageinfo artifact

* debug

* debug

* artifact name

* artifact name

* artifact name

* artifact name

* api file

* delete job

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* debug

* dupe package json

* dupe package json

* codefile

* codefile

* codefile

* codefile

* codefile

* test in staging

* cleanup

* use api parser 0.15.0

* ignore unfound package for apiview artifacts

* pr adjustments

* pr adjustments

* pr adjustments

* latest version update

* update latest parser version

* add api parser version

* Update sdk/template/azure-template/src/template_client.cpp

* add template testing for api changes

* add template testing for api changes

* out path change

* out path change

* delete parser path

* delete parser path

* move save package properties out of artifacts loop

* Update sdk/template/azure-template/src/template_client.cpp

* Update sdk/template/azure-template/src/private/package_version.hpp

* Update sdk/template/azure-template/inc/azure/template/template_client.hpp
2024-10-04 13:17:45 -07:00

39 lines
1.3 KiB
PowerShell

Param(
[Parameter(Mandatory=$True)]
[array] $ArtifactList,
[Parameter(Mandatory=$True)]
[string] $OutPath,
[Parameter(Mandatory=$True)]
[string] $ParserPath,
[Parameter(Mandatory=$True)]
[string] $ServicePath
)
Write-Host "$PSScriptRoot"
. (Join-Path $PSScriptRoot .. common scripts common.ps1)
foreach ($artifact in $ArtifactList)
{
$ArtifactName = $artifact.name
Write-Host "Generating artifact for $ArtifactName"
$SourcePath = Join-Path $ServicePath $ArtifactName "inc"
$apiviewSettings = Join-Path $SourcePath "ApiViewSettings.json"
if (!(Test-Path $apiviewSettings))
{
Write-Host "ApiViewSettings.json file is not found in $($SourcePath). APIView settings file is required to generate API review file."
exit 1
}
Write-Host "Creating API review artifact for $ArtifactName"
New-Item -ItemType Directory -Path "$OutPath/packages/$ArtifactName" -Force
$parentPath = Split-Path $ParserPath -Parent
Write-Host "Contents in ${parentPath}:"
Get-ChildItem -Path $parentPath -Recurse
& $ParserPath -o "$OutPath/packages/$ArtifactName/${ArtifactName}_cpp.json" $SourcePath
if ($LASTEXITCODE -ne 0)
{
Write-Host "Failed to generate API review file for $($ArtifactName)"
exit 1
}
}