Skip to content

Commit b9188c2

Browse files
athomasCommit Queue
authored andcommitted
[infra] Fix package_deps.dart to handle empty directories
Previously, this failed if git left an empty directory in the pkg/ directory. Change-Id: I05e25438aaa29e73c7c4e8e1a2d85dbc1c747fff Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401400 Auto-Submit: Alexander Thomas <[email protected]> Reviewed-by: Sigurd Meldgaard <[email protected]> Commit-Queue: Alexander Thomas <[email protected]>
1 parent e8dafed commit b9188c2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/package_deps/bin/package_deps.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ void main(List<String> arguments) {
3535
final packages = <Package>[];
3636
for (var entity in Directory('pkg').listSync()) {
3737
if (entity is Directory) {
38-
var package = Package(entity.path);
39-
if (package.hasPubspec) {
38+
if (_hasPubspec(entity)) {
39+
var package = Package(entity.path);
4040
packages.add(package);
4141
}
4242
}
@@ -82,6 +82,9 @@ void main(List<String> arguments) {
8282
}
8383
}
8484

85+
bool _hasPubspec(Directory dir) =>
86+
FileSystemEntity.isFileSync(path.join(dir.path, 'pubspec.yaml'));
87+
8588
class Package implements Comparable<Package> {
8689
final String dir;
8790
final _regularDependencies = <String>{};
@@ -138,9 +141,6 @@ class Package implements Comparable<Package> {
138141
@override
139142
String toString() => 'Package $dirName';
140143

141-
bool get hasPubspec =>
142-
FileSystemEntity.isFileSync(path.join(dir, 'pubspec.yaml'));
143-
144144
@override
145145
int compareTo(Package other) => dir.compareTo(other.dir);
146146

0 commit comments

Comments
 (0)