azure-sdk-for-cpp/eng/common/scripts/Save-Package-Properties.ps1
Azure SDK Bot 30938091ff
Sync eng/common directory with azure-sdk-tools for PR 1364 (#1586)
* Support sub directory for artifact location

* Fix as per review comment to avoid artifact sub path

* Package property file is not created for track1 and management pacakges.

* Fix property name case

* Fix as per review comments

* Fix as per review comments

* Use Config File param value as is

* Change to make path joineasily readable

Co-authored-by: praveenkuttappan <prmarott@microsoft.com>
2021-02-03 13:29:43 -08:00

35 lines
967 B
PowerShell

[CmdletBinding()]
Param (
[Parameter(Mandatory=$True)]
[string] $serviceDirectory,
[Parameter(Mandatory=$True)]
[string] $outDirectory
)
. (Join-Path $PSScriptRoot common.ps1)
$allPackageProperties = Get-AllPkgProperties $serviceDirectory
if ($allPackageProperties)
{
New-Item -ItemType Directory -Force -Path $outDirectory
foreach($pkg in $allPackageProperties)
{
if ($pkg.IsNewSdk)
{
Write-Host "Package Name: $($pkg.Name)"
Write-Host "Package Version: $($pkg.Version)"
Write-Host "Package SDK Type: $($pkg.SdkType)"
$outputPath = Join-Path -Path $outDirectory ($pkg.Name + ".json")
$outputObject = $pkg | ConvertTo-Json
Set-Content -Path $outputPath -Value $outputObject
}
}
Get-ChildItem -Path $outDirectory
}
else
{
Write-Error "Package properties are not available for service directory $($serviceDirectory)"
exit 1
}