Package Properties processing updates (#6477)
Co-authored-by: James Suplizio <jasupliz@microsoft.com>
This commit is contained in:
parent
bebf2310f8
commit
a4c8ade158
@ -26,8 +26,8 @@ class PackageProps {
|
||||
$this.Initialize($name, $version, $directoryPath, $serviceDirectory)
|
||||
}
|
||||
|
||||
PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory, [string]$group = "") {
|
||||
$this.Initialize($name, $version, $directoryPath, $serviceDirectory, $group)
|
||||
PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory, [string]$group = "", [string]$artifactName = "") {
|
||||
$this.Initialize($name, $version, $directoryPath, $serviceDirectory, $group, $artifactName)
|
||||
}
|
||||
|
||||
hidden [void]Initialize(
|
||||
@ -70,20 +70,32 @@ class PackageProps {
|
||||
[string]$version,
|
||||
[string]$directoryPath,
|
||||
[string]$serviceDirectory,
|
||||
[string]$group
|
||||
[string]$group,
|
||||
[string]$artifactName
|
||||
) {
|
||||
$this.Initialize($name, $version, $directoryPath, $serviceDirectory)
|
||||
$this.Group = $group
|
||||
$this.ArtifactName = $artifactName
|
||||
$this.Initialize($name, $version, $directoryPath, $serviceDirectory)
|
||||
}
|
||||
|
||||
hidden [PSCustomObject]ParseYmlForArtifact([string]$ymlPath) {
|
||||
$content = LoadFrom-Yaml $ymlPath
|
||||
if ($content) {
|
||||
$artifacts = GetValueSafelyFrom-Yaml $content @("extends", "parameters", "Artifacts")
|
||||
$artifactForCurrentPackage = $null
|
||||
|
||||
if ($artifacts) {
|
||||
$artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.ArtifactName -or $_["name"] -eq $this.Name }
|
||||
# If there's an artifactName match that to the name field from the yml
|
||||
if ($this.ArtifactName) {
|
||||
# Additionally, if there's a group, then the group and artifactName need to match the groupId and name in the yml
|
||||
if ($this.Group) {
|
||||
$artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.ArtifactName -and $_["groupId"] -eq $this.Group}
|
||||
} else {
|
||||
# just matching the artifactName
|
||||
$artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.ArtifactName }
|
||||
}
|
||||
} else {
|
||||
# This is the default, match the Name to the name field from the yml
|
||||
$artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.Name }
|
||||
}
|
||||
}
|
||||
|
||||
# if we found an artifact for the current package, we should count this ci file as the source of the matrix for this package
|
||||
|
||||
@ -141,12 +141,17 @@ foreach ($pkg in $allPackageProperties)
|
||||
Write-Host "Package Version: $($pkg.Version)"
|
||||
Write-Host "Package SDK Type: $($pkg.SdkType)"
|
||||
Write-Host "Artifact Name: $($pkg.ArtifactName)"
|
||||
if (-not [System.String]::IsNullOrEmpty($pkg.Group)) {
|
||||
Write-Host "GroupId: $($pkg.Group)"
|
||||
}
|
||||
Write-Host "Release date: $($pkg.ReleaseStatus)"
|
||||
$configFilePrefix = $pkg.Name
|
||||
|
||||
if ($pkg.ArtifactName)
|
||||
{
|
||||
$configFilePrefix = $pkg.ArtifactName
|
||||
# Any languages (like JS) which need to override the the packageInfo file name to be something
|
||||
# other than the name just need to declare this function in their Language-Settings.ps1 return
|
||||
# the desired string from there.
|
||||
if (Test-Path "Function:Get-PackageInfoNameOverride") {
|
||||
$configFilePrefix = Get-PackageInfoNameOverride $pkg
|
||||
}
|
||||
|
||||
$outputPath = Join-Path -Path $outDirectory "$configFilePrefix.json"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user