diff --git a/packages/melos/lib/src/package.dart b/packages/melos/lib/src/package.dart index 4f4a4b12..cab09679 100644 --- a/packages/melos/lib/src/package.dart +++ b/packages/melos/lib/src/package.dart @@ -531,15 +531,14 @@ class PackageMap { final packageMap = {}; - await Future.wait( - pubspecFiles.map((pubspecFile) async { - final pubspecDirPath = pubspecFile.parent.path; - final pubspec = Pubspec.parse(pubspecFile.readAsStringSync()); - final name = pubspec.name; - - if (packageMap.containsKey(name)) { - throw MelosConfigException( - ''' + await Stream.fromIterable(pubspecFiles).parallel((pubspecFile) async { + final pubspecDirPath = pubspecFile.parent.path; + final pubspec = Pubspec.parse(pubspecFile.readAsStringSync()); + final name = pubspec.name; + + if (packageMap.containsKey(name)) { + throw MelosConfigException( + ''' Multiple packages with the name `$name` found in the workspace, which is unsupported. To fix this problem, consider renaming your packages to have a unique name. @@ -547,38 +546,37 @@ The packages that caused the problem are: - $name at ${printablePath(relativePath(pubspecDirPath, workspacePath))} - $name at ${printablePath(relativePath(packageMap[name]!.path, workspacePath))} ''', - ); - } + ); + } - final filteredCategories = []; - - categories.forEach((key, value) { - final isCategoryMatching = value.any( - (category) => category.matches( - relativePath(pubspecDirPath, workspacePath), - ), - ); - - if (isCategoryMatching) { - filteredCategories.add(key); - } - }); - - packageMap[name] = Package( - name: name, - path: pubspecDirPath, - pathRelativeToWorkspace: relativePath(pubspecDirPath, workspacePath), - version: pubspec.version ?? Version.none, - publishTo: pubspec.publishTo.let(Uri.parse), - packageMap: packageMap, - dependencies: pubspec.dependencies.keys.toList(), - devDependencies: pubspec.devDependencies.keys.toList(), - dependencyOverrides: pubspec.dependencyOverrides.keys.toList(), - pubspec: pubspec, - categories: filteredCategories, + final filteredCategories = []; + + categories.forEach((key, value) { + final isCategoryMatching = value.any( + (category) => category.matches( + relativePath(pubspecDirPath, workspacePath), + ), ); - }), - ); + + if (isCategoryMatching) { + filteredCategories.add(key); + } + }); + + packageMap[name] = Package( + name: name, + path: pubspecDirPath, + pathRelativeToWorkspace: relativePath(pubspecDirPath, workspacePath), + version: pubspec.version ?? Version.none, + publishTo: pubspec.publishTo.let(Uri.parse), + packageMap: packageMap, + dependencies: pubspec.dependencies.keys.toList(), + devDependencies: pubspec.devDependencies.keys.toList(), + dependencyOverrides: pubspec.dependencyOverrides.keys.toList(), + pubspec: pubspec, + categories: filteredCategories, + ); + }).drain(); return PackageMap(packageMap, logger); } diff --git a/packages/melos/test/matchers.dart b/packages/melos/test/matchers.dart index 3f82ad09..195102c0 100644 --- a/packages/melos/test/matchers.dart +++ b/packages/melos/test/matchers.dart @@ -24,6 +24,8 @@ Matcher ignoringDependencyMessages(String expected) { !line.startsWith('Got dependencies!') && // Removes lines like " pub_updater 0.4.0 (0.5.0 available)" !(line.startsWith(' ') && line.contains(' available)')) && + !line.startsWith('No dependencies would change in') && + !line.startsWith('Would change') && !line.contains( 'newer versions incompatible with dependency constraints', ) &&