Avoid trying to do suggestions for workspaces (#4229)
diff --git a/lib/src/solver/solve_suggestions.dart b/lib/src/solver/solve_suggestions.dart
index 9b14f7a..c932383 100644
--- a/lib/src/solver/solve_suggestions.dart
+++ b/lib/src/solver/solve_suggestions.dart
@@ -32,6 +32,10 @@
Iterable<String> unlock,
SystemCache cache,
) async {
+ if (entrypoint.workspaceRoot.workspaceChildren.isNotEmpty) {
+ // TODO(https://github.com/dart-lang/pub/issues/4227): handle workspaces.
+ return null;
+ }
final resolutionContext = _ResolutionContext(
entrypoint: entrypoint,
type: type,
diff --git a/test/workspace_test.dart b/test/workspace_test.dart
index 62dae1f..e381fb5 100644
--- a/test/workspace_test.dart
+++ b/test/workspace_test.dart
@@ -1130,6 +1130,39 @@
),
);
});
+
+ // TODO(https://github.com/dart-lang/pub/issues/4227): we want to enable this at some point.
+ test('No suggestions for workspaces', () async {
+ final server = await servePackages();
+ server.serve('dev_dep', '1.0.0');
+ await dir(appPath, [
+ libPubspec(
+ 'myapp',
+ '1.2.3',
+ deps: {
+ 'a': '2.0.0',
+ }, // Would provoke a suggestion to update the constraint.
+ extras: {
+ 'workspace': ['pkgs/a'],
+ },
+ sdk: '^3.5.0',
+ ),
+ dir('pkgs', [
+ dir('a', [
+ libPubspec(
+ 'a',
+ '1.0.0',
+ resolutionWorkspace: true,
+ ),
+ ]),
+ ]),
+ ]).create();
+ await pubGet(
+ environment: {'_PUB_TEST_SDK_VERSION': '3.5.0'},
+ error:
+ 'Because myapp depends on both a 2.0.0 and a, version solving failed.',
+ );
+ });
}
final s = p.separator;