Skip to content

Commit

Permalink
Remove workspace and resolution from pubspec.yaml before resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm committed Aug 8, 2024
1 parent 3314a87 commit 2d45924
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/src/sdk_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,16 @@ class ToolEnvironment {
}
}

/// Removes the dev_dependencies from the pubspec.yaml
/// Adds lower-bound minimal SDK constraint - if missing.
/// Removes aspects of `pubspec.yaml` that are irrelevant when consuming the
/// package.
///
/// * Removes `dev_dependencies` and `dependency_overrides` These have no
/// effect on the consuming resolution.
/// * Removes `workspace` and `resolution` These have no effect on the
/// consuming resolution, and might prevent the package from resolving on
/// its own.
/// * Adds lower-bound minimal SDK constraint - if missing.
///
/// Returns the backup file with the original content.
Future<File> _stripAndAugmentPubspecYaml(String packageDir) async {
final now = DateTime.now();
Expand All @@ -505,6 +513,8 @@ class ToolEnvironment {
final parsed = yamlToJson(original) ?? <String, dynamic>{};
parsed.remove('dev_dependencies');
parsed.remove('dependency_overrides');
parsed.remove('workspace');
parsed.remove('resolution');

// `pub` client checks if pubspec.yaml has no lower-bound SDK constraint,
// and throws an exception if it is missing. While we no longer accept
Expand Down

0 comments on commit 2d45924

Please sign in to comment.