Skip to content

Commit

Permalink
Fixup _generateTemporaryProjects
Browse files Browse the repository at this point in the history
  • Loading branch information
blaugold committed Oct 29, 2022
1 parent bb2e6e4 commit 93ad616
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/melos/lib/src/commands/bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,18 @@ mixin _BootstrapMixin on _CleanMixin {
}

Future<void> _generateTemporaryProjects(MelosWorkspace workspace) async {
final workspaceDependencies =
workspace.allPackages + workspace.dependencyOverrides;

// Traversing all packages so that transitive dependencies for the bootstraped
// packages are setup properly.
for (final package in workspaceDependencies.values) {
for (final package in workspace.allPackages.values) {
final packageTemporaryPath =
join(workspace.melosToolPath, package.pathRelativeToWorkspace);
var pubspec = package.pubSpec;
final dependencyOverrides = {
for (final override in workspace.dependencyOverrides.values)
override.name:
PathReference(utils.relativePath(override.path, package.path)),
...pubspec.dependencyOverrides,
};

// Since the generated temporary package is located at a different path
// than the original package, this may break path dependencies that this
Expand Down Expand Up @@ -346,16 +349,15 @@ Future<void> _generateTemporaryProjects(MelosWorkspace workspace) async {

// Traversing all packages so that transitive dependencies for the
// bootstraped packages are setup properly.
for (final otherPackage in workspaceDependencies.values) {
for (final otherPackage in workspace.allPackages.values) {
final otherPackagePath = utils.relativePath(
join(workspace.melosToolPath, otherPackage.pathRelativeToWorkspace),
packageTemporaryPath,
);

if ((package.allTransitiveDependenciesInWorkspace
.containsKey(otherPackage.name) ||
workspace.dependencyOverrides.keys.contains(otherPackage.name)) &&
!package.dependencyOverrides.contains(otherPackage.name)) {
if (package.allTransitiveDependenciesInWorkspace
.containsKey(otherPackage.name) &&
!dependencyOverrides.containsKey(otherPackage.name)) {
pubspec = pubspec.copy(
dependencyOverrides: {
...pubspec.dependencyOverrides,
Expand Down

0 comments on commit 93ad616

Please sign in to comment.