Skip to content

Commit

Permalink
updating package properties with direct/indirect (if named differentl…
Browse files Browse the repository at this point in the history
…y) as well as pulling BuildDocs from ci.yml artifact list if it exists
  • Loading branch information
scbedd authored and azure-sdk committed Sep 13, 2024
1 parent f6fc2e6 commit e320abf
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class PackageProps
[boolean]$IsNewSdk
[string]$ArtifactName
[string]$ReleaseStatus
[boolean]$BuildDocs
# was this package purely included because other packages included it as an AdditionalValidationPackage?
[boolean]$IncludedForValidation
# does this package include other packages that we should trigger validation for?
[string[]]$AdditionalValidationPackages

PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory)
Expand All @@ -38,6 +42,7 @@ class PackageProps
$this.Version = $version
$this.DirectoryPath = $directoryPath
$this.ServiceDirectory = $serviceDirectory
$this.IncludedForValidation = $false

if (Test-Path (Join-Path $directoryPath "README.md"))
{
Expand All @@ -62,6 +67,8 @@ class PackageProps
{
$this.ChangeLogPath = $null
}

$this.InitializeBuildDocs($ServiceDirectory)
}

hidden [void]Initialize(
Expand All @@ -75,6 +82,41 @@ class PackageProps
$this.Initialize($name, $version, $directoryPath, $serviceDirectory)
$this.Group = $group
}

hidden [void]InitializeBuildDocs(
[string]$ServiceDirectory
)
{
# parse the relevant ci.yml file to determine if the package should build docs
$ciYmlPath = Join-Path $ServiceDirectory ".ci.yml"

if (Test-Path $ciYmlPath)
{
$ciYml = ConvertFrom-Yaml (Get-Content $ciYmlPath -Raw)

if ($ciYml.extends -and $ciYml.extends.parameters -and $ciYml.extends.parameters.Artifacts) {
$packagesBuildingDocs = $ciYml.extends.parameters.Artifacts `
| Where-Object {
if ($_.PSObject.Properties["skipPublishDocsMs"]) {
$false
}
else {
$true
}
} `
| Select-Object -ExpandProperty name

if ($packagesBuildingDocs -contains $this.Name)
{
$this.BuildDocs = $true
}
}
}
else
{
$this.BuildDocs = $false
}
}
}

# Takes package name and service Name
Expand Down Expand Up @@ -143,6 +185,7 @@ function Get-PrPkgProperties([string]$InputDiffJson) {
$key = $addition.Replace($RepoRoot, "").TrimStart('\/')

if ($lookup[$key]) {
$lookup[$key].IncludedForValidation = $true
$packagesWithChanges += $lookup[$key]
}
}
Expand Down

0 comments on commit e320abf

Please sign in to comment.