Skip to content

Commit 2faf4cd

Browse files
azure-sdkmaririosscbedd
authored
Sync eng/common directory with azure-sdk-tools for PR 9428 (Azure#38699)
* remove previous cadl scripts * get-additional validation packages within language-settings needs to handle empty changed file arrays --------- Co-authored-by: Mariana Rios Flores <[email protected]> Co-authored-by: Scott Beddall <[email protected]>
1 parent 2bebcff commit 2faf4cd

File tree

3 files changed

+31
-250
lines changed

3 files changed

+31
-250
lines changed

eng/common/scripts/Cadl-Project-Generate.ps1

Lines changed: 0 additions & 101 deletions
This file was deleted.

eng/common/scripts/Cadl-Project-Sync.ps1

Lines changed: 0 additions & 127 deletions
This file was deleted.

eng/scripts/Language-Settings.ps1

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,34 +40,43 @@ function Get-python-AdditionalValidationPackagesFromPackageSet {
4040
# packages WITHIN that service. This is because the service level file changes are likely to
4141
# have an impact on the packages within that service.
4242
$changedServices = @()
43-
foreach($file in $diffObj.ChangedFiles) {
44-
$pathComponents = $file -split "/"
45-
# handle changes only in sdk/<service>/<file>/<extension>
46-
if ($pathComponents.Length -eq 3 -and $pathComponents[0] -eq "sdk") {
47-
$changedServices += $pathComponents[1]
48-
}
43+
if ($diffObj.ChangedFiles) {
44+
foreach($file in $diffObj.ChangedFiles) {
45+
$pathComponents = $file -split "/"
46+
# handle changes only in sdk/<service>/<file>/<extension>
47+
if ($pathComponents.Length -eq 3 -and $pathComponents[0] -eq "sdk") {
48+
$changedServices += $pathComponents[1]
49+
}
4950

50-
# handle any changes under sdk/<file>.<extension>
51-
if ($pathComponents.Length -eq 2 -and $pathComponents[0] -eq "sdk") {
52-
$changedServices += "template"
51+
# handle any changes under sdk/<file>.<extension>
52+
if ($pathComponents.Length -eq 2 -and $pathComponents[0] -eq "sdk") {
53+
$changedServices += "template"
54+
}
5355
}
54-
}
55-
foreach ($changedService in $changedServices) {
56-
$additionalPackages = $AllPkgProps | Where-Object { $_.ServiceDirectory -eq $changedService }
57-
58-
foreach ($pkg in $additionalPackages) {
59-
if ($uniqueResultSet -notcontains $pkg -and $LocatedPackages -notcontains $pkg) {
60-
# notice the lack of setting IncludedForValidation to true. This is because these "changed services"
61-
# are specifically where a file within the service, but not an individual package within that service has changed.
62-
# we want this package to be fully validated
63-
$uniqueResultSet += $pkg
56+
foreach ($changedService in $changedServices) {
57+
$additionalPackages = $AllPkgProps | Where-Object { $_.ServiceDirectory -eq $changedService }
58+
59+
foreach ($pkg in $additionalPackages) {
60+
if ($uniqueResultSet -notcontains $pkg -and $LocatedPackages -notcontains $pkg) {
61+
# notice the lack of setting IncludedForValidation to true. This is because these "changed services"
62+
# are specifically where a file within the service, but not an individual package within that service has changed.
63+
# we want this package to be fully validated
64+
$uniqueResultSet += $pkg
65+
}
6466
}
6567
}
6668
}
6769

68-
$toolChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("tool")}
69-
$engChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("eng")}
70-
$othersChanged = $diffObj.ChangedFiles | Where-Object { isOther($_) }
70+
$toolChanged = @()
71+
$othersChanged = @()
72+
$engChanged = @()
73+
74+
if ($diffObj.ChangedFiles) {
75+
$toolChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("tool")}
76+
$engChanged = $diffObj.ChangedFiles | Where-Object { $_.StartsWith("eng")}
77+
$othersChanged = $diffObj.ChangedFiles | Where-Object { isOther($_) }
78+
}
79+
7180
$changedServices = $changedServices | Get-Unique
7281

7382
if ($toolChanged) {

0 commit comments

Comments
 (0)