@@ -15,7 +15,7 @@ class PackageProps
1515 [boolean ]$IsNewSdk
1616 [string ]$ArtifactName
1717 [string ]$ReleaseStatus
18- [string []]$DependentPackages
18+ [string []]$CanaryPackages
1919
2020 PackageProps([string ]$name , [string ]$version , [string ]$directoryPath , [string ]$serviceDirectory )
2121 {
@@ -113,6 +113,11 @@ function Get-PrPkgProperties([string]$InputDiffJson) {
113113 $diff = Get-Content $InputDiffJson | ConvertFrom-Json
114114 $targetedFiles = $diff.ChangedFiles
115115
116+ $customDependentPackagesHandler = $false
117+ if ($DependentPackagesFromPackageSetFn -and (Test-Path " Function:$DependentPackagesFromPackageSetFn " )) {
118+ $customDependentPackagesHandler = $true
119+ }
120+
116121 $dependentPackagesForInclusion = @ ()
117122 $lookup = @ {}
118123
@@ -129,16 +134,25 @@ function Get-PrPkgProperties([string]$InputDiffJson) {
129134 if ($shouldInclude ) {
130135 $packagesWithChanges += $pkg
131136
132- if ($pkg.DependentPackages ) {
133- $dependentPackagesForInclusion += $pkg.DependentPackages
137+ if ($customDependentPackagesHandler -and $ pkg.CanaryPackages ) {
138+ $dependentPackagesForInclusion += $pkg.CanaryPackages
134139 }
135140 }
136141 }
137142 }
138143
139- foreach ($addition in $dependentPackagesForInclusion ) {
140- if ($lookup [$addition ]) {
141- $packagesWithChanges += $lookup [$addition ]
144+ # there is a custom function to get dependent packages from a changed package set and diff
145+ if ($customDependentPackagesHandler )
146+ {
147+ $packagesWithChanges += & $DependentPackagesFromPackageSetFn $packagesWithChanges $diff
148+ }
149+ else {
150+ foreach ($addition in $dependentPackagesForInclusion ) {
151+ $key = $addition.Replace ($RepoRoot , " " ).SubString(1 )
152+
153+ if ($lookup [$key ]) {
154+ $packagesWithChanges += $lookup [$key ]
155+ }
142156 }
143157 }
144158
0 commit comments