Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workspace and resolution from pubspec.yaml before resolving #1394

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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