Skip to content

Commit

Permalink
[deps] add a dep on the new dart-lang/core monorepo
Browse files Browse the repository at this point in the history
Change-Id: I7af5f1d9239ca45fbb8dd562bb4dccceacac1a23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390581
Reviewed-by: Nate Bosch <[email protected]>
Commit-Queue: Devon Carew <[email protected]>
  • Loading branch information
devoncarew authored and Commit Queue committed Oct 16, 2024
1 parent 3546ba4 commit 7bee103
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
5 changes: 4 additions & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# Packages can be rolled to the latest version with `tools/manage_deps.dart`.
#
# For example
# For example:
#
# dart tools/manage_deps.dart bump third_party/pkg/dart_style

Expand Down Expand Up @@ -131,6 +131,7 @@ vars = {
"clock_rev": "7956d60042f4ea979c4554d43eeb57d087627869",
"collection_rev": "887b826b50f48d6a9cd2c0684aa353e8e3a0fad0",
"convert_rev": "d361833e117cb2438d2a2a6d0b0acb28ff0910fb",
"core_rev": "279afbcda95f4e0a39e44ab82f9c60eeb70d7514",
"crypto_rev": "3d26ef4cf22d4b218ba30e616544ad3cf52f64a1",
"csslib_rev": "a3700b05bbcc42782e8a7024790dbf019d89c249",
# Note: Updates to dart_style have to be coordinated with the infrastructure
Expand Down Expand Up @@ -406,6 +407,8 @@ deps = {
Var("dart_git") + "collection.git" + "@" + Var("collection_rev"),
Var("dart_root") + "/third_party/pkg/convert":
Var("dart_git") + "convert.git" + "@" + Var("convert_rev"),
Var("dart_root") + "/third_party/pkg/core":
Var("dart_git") + "core.git" + "@" + Var("core_rev"),
Var("dart_root") + "/third_party/pkg/crypto":
Var("dart_git") + "crypto.git" + "@" + Var("crypto_rev"),
Var("dart_root") + "/third_party/pkg/csslib":
Expand Down
43 changes: 25 additions & 18 deletions tools/generate_package_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,30 @@ void main(List<String> args) {
];
packages.sort((a, b) => a.name.compareTo(b.name));

// TODO(devoncarew): Temporarily ignore the second package:file and
// package:file_testing locations.
packages.removeWhere((p) {
final path = posix(p.rootUri);
return path == 'third_party/pkg/file/packages/file' ||
path == 'third_party/pkg/file/packages/file_testing';
});

// Remove any packages with identical names.
// Check for duplicate packages - the same package sourced from multiple
// repositories.
final uniqueNames = packages.map((p) => p.name).toSet();

var hasDuplicatePackages = false;

for (var name in uniqueNames) {
var matches = [
for (final p in packages)
if (p.name == name) p
];
var matches = packages.where((p) => p.name == name).toList();
if (matches.length > 1) {
print('Duplicates found for package:$name');
for (var package in matches) {
print(' ${package.rootUri}');
final inMonorepos = matches.where((p) => p.inMonorepo).toList();

if (inMonorepos.length == 1) {
// De-duplicating package 'name' - select just the monorepo version.
packages.removeWhere((p) {
return p.name == name && !p.inMonorepo;
});
} else {
print('Duplicates found for package:$name');
for (var package in matches) {
print(' ${package.rootUri}');
}

hasDuplicatePackages = true;
}

hasDuplicatePackages = true;
}
}

Expand Down Expand Up @@ -300,6 +299,14 @@ class Package {
this.languageVersion,
});

/// Whether this package lives in a monorepo.
bool get inMonorepo {
// By convention (and for our purposes), a monorepo package lives in a
// `pkgs` directory.
final paths = posix(rootUri).split('/');
return paths.length >= 2 && paths[paths.length - 2] == 'pkgs';
}

Map<String, Object?> toMap(String relativeTo) {
return {
'name': name,
Expand Down
2 changes: 0 additions & 2 deletions tools/package_deps/bin/package_deps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ class SdkDeps {
_findPackages(Directory('pkg'));
_findPackages(Directory(path.join('third_party', 'devtools')));
_findPackages(Directory(path.join('third_party', 'pkg')));
_findPackages(
Directory(path.join('third_party', 'pkg', 'file', 'packages')));

if (verbose) {
print('Package versions in the SDK:');
Expand Down

0 comments on commit 7bee103

Please sign in to comment.