Skip to content

Commit

Permalink
Remove workspace and resolution from pubspec.yaml before resolv…
Browse files Browse the repository at this point in the history
…ing (#1394)
  • Loading branch information
sigurdm authored Aug 8, 2024
1 parent 3314a87 commit d391ead
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.22.10

- Remove `workspace` and `resolution` properties from pubspec before analyzing.

## 0.22.9

- Updated suggestion for packages depending on SDK `_macros`.
Expand Down
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
2 changes: 1 addition & 1 deletion lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pana
description: PAckage aNAlyzer - produce a report summarizing the health and quality of a Dart package.
version: 0.22.9
version: 0.22.10
repository: https://github.com/dart-lang/pana
topics:
- tool
Expand Down

0 comments on commit d391ead

Please sign in to comment.