diff --git a/packages/melos/lib/src/commands/bootstrap.dart b/packages/melos/lib/src/commands/bootstrap.dart index 5d966cff..19c4dd75 100644 --- a/packages/melos/lib/src/commands/bootstrap.dart +++ b/packages/melos/lib/src/commands/bootstrap.dart @@ -265,8 +265,8 @@ mixin _BootstrapMixin on _CleanMixin { return didUpdate; } - bool _areDependenciesEqual(DependencyReference? a, DependencyReference? b) { - if (a is GitReference && b is GitReference) { + bool _areDependenciesEqual(Dependency? a, Dependency? b) { + if (a is GitDependency && b is GitDependency) { return a == b && a.path == b.path; } else { return a == b; diff --git a/packages/melos/test/commands/bootstrap_test.dart b/packages/melos/test/commands/bootstrap_test.dart index b69284b8..5d32d12f 100644 --- a/packages/melos/test/commands/bootstrap_test.dart +++ b/packages/melos/test/commands/bootstrap_test.dart @@ -158,12 +158,12 @@ Generating IntelliJ IDE files... await createProject( io.Directory('${temporaryGitRepository.absolute.path}/dependency1'), - const PubSpec(name: 'dependency'), + Pubspec('dependency'), ); await createProject( io.Directory('${temporaryGitRepository.absolute.path}/dependency2'), - const PubSpec(name: 'dependency'), + Pubspec('dependency'), ); await io.Process.run( @@ -178,7 +178,12 @@ Generating IntelliJ IDE files... workingDirectory: temporaryGitRepository.absolute.path, ); - final workspaceDirectory = await createTemporaryWorkspace(); + final workspaceDirectory = await createTemporaryWorkspace( + workspacePackages: [ + 'dependency1', + 'dependency2', + ], + ); final initialReference = { 'git': { @@ -189,10 +194,13 @@ Generating IntelliJ IDE files... final package = await createProject( workspaceDirectory, - PubSpec( - name: 'git_references', + Pubspec( + 'git_references', dependencies: { - 'dependency': GitReference.fromJson(initialReference), + 'dependency': GitDependency( + Uri.parse(initialReference['git']!['url']!), + path: initialReference['git']!['path']!, + ), }, ), ); @@ -270,28 +278,32 @@ Generating IntelliJ IDE files... test( 'resolves workspace packages with path dependency', () async { - final workspaceDir = await createTemporaryWorkspace(); + final workspaceDir = await createTemporaryWorkspace( + workspacePackages: ['a', 'b', 'c', 'd'], + ); final aDir = await createProject( workspaceDir, - PubSpec( - name: 'a', - dependencies: {'b': HostedReference(VersionConstraint.any)}, + Pubspec( + 'a', + dependencies: { + 'b': HostedDependency(version: VersionConstraint.any), + }, ), ); await createProject( workspaceDir, - const PubSpec(name: 'b'), + Pubspec('b'), ); await createProject( workspaceDir, - pubSpecFromJsonFile(fileName: 'add_to_app_json.json'), + pubspecFromJsonFile(fileName: 'add_to_app_json.json'), ); await createProject( workspaceDir, - pubSpecFromJsonFile(fileName: 'plugin_json.json'), + pubspecFromJsonFile(fileName: 'plugin_json.json'), ); final logger = TestLogger(); @@ -354,27 +366,6 @@ Generating IntelliJ IDE files... io.Platform.isLinux ? const Timeout(Duration(seconds: 45)) : null, ); - test( - 'bootstrap transitive dependencies', - () async => dependencyResolutionTest( - { - 'a': [], - 'b': ['a'], - 'c': ['b'], - }, - ), - ); - - test( - 'bootstrap cyclic dependencies', - () async => dependencyResolutionTest( - { - 'a': ['b'], - 'b': ['a'], - }, - ), - ); - test('respects user dependency_overrides', () async { final workspaceDir = await createTemporaryWorkspace( workspacePackages: ['a'],