diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index e3cea7d392..aa4fa27e9d 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -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) @@ -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")) { @@ -62,6 +67,8 @@ class PackageProps { $this.ChangeLogPath = $null } + + $this.InitializeBuildDocs($ServiceDirectory) } hidden [void]Initialize( @@ -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 @@ -143,6 +185,7 @@ function Get-PrPkgProperties([string]$InputDiffJson) { $key = $addition.Replace($RepoRoot, "").TrimStart('\/') if ($lookup[$key]) { + $lookup[$key].IncludedForValidation = $true $packagesWithChanges += $lookup[$key] } }