Skip to content

Commit f863bc2

Browse files
committed
Apply a few changes to Get-PRPackageProperties to make it more customizable for our users.
Remove wonky gap + extra spacing that should pass the patch application process now that we've manually aligned common.ps1
1 parent 2afc9d4 commit f863bc2

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

eng/common/scripts/Package-Properties.ps1

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

eng/common/scripts/common.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ $GetEmitterAdditionalOptionsFn = "Get-${Language}-EmitterAdditionalOptions"
6262
$GetEmitterNameFn = "Get-${Language}-EmitterName"
6363
$GetDirectoriesForGenerationFn = "Get-${Language}-DirectoriesForGeneration"
6464
$UpdateGeneratedSdksFn = "Update-${Language}-GeneratedSdks"
65-
$IsApiviewStatusCheckRequiredFn = "Get-${Language}-ApiviewStatusCheckRequirement"
65+
$IsApiviewStatusCheckRequiredFn = "Get-${Language}-ApiviewStatusCheckRequirement"
66+
$DependentPackagesFromPackageSetFn = "Get-${Language}-DependentPackagesFromPackageSet"
6667

6768
# Expected to be set in eng/scripts/docs/Docs-Onboarding.ps1
6869
$SetDocsPackageOnboarding = "Set-${Language}-DocsPackageOnboarding"

0 commit comments

Comments
 (0)