-
Notifications
You must be signed in to change notification settings - Fork 239
Closed
Labels
type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Environment
- Dart version (run
dart --version): Dart SDK version: 2.19.0-323.0.dev (dev) (Thu Oct 20 06:08:46 2022 -0700) on "macos_arm64" - OS kind and version (e.g. "Windows 10, version 1809" or "macOS 12.4"): macOS 12.6
- Are you using the Chinese community mirror or a corporate firewall? No
Problem
The new analysis added in #3568 runs recursively over the whole package, but the get that runs before it doesn't, which can lead to false errors.
Example steps:
git clone https://github.com/flutter/plugins(If you already have one, either make new one, orgit clean -xfdthecameraplugin.)cd plugins/packages/camera/cameragit checkout 09a4a096d1a55f8cb4378e192202ffc5092ee618- Update the version in
pubspec.yamlto something that hasn't been published, so thatpublish --dry-runactually does something. dart pub publish --dry-runflutter pub getdart pub publish --dry-run
Expected behavior
No errors at step 5 or 7.
Actual behavior
Step 5 gives:
Package validation found the following potential issue:
* `dart analyze` found the following issue(s):
Analyzing camera...
error - example/integration_test/camera_test.dart:12:8 - Target of URI doesn't exist: 'package:integration_test/integration_test.dart'. Try creating the file referenced by the URI, or try using a URI for a file that does exist. - uri_does_not_exist
error - example/integration_test/camera_test.dart:13:8 - Target of URI doesn't exist: 'package:path_provider/path_provider.dart'. Try creating the file referenced by the URI, or try using a URI for a file that does exist. - [...]ges
info - example/integration_test/camera_test.dart:13:8 - The imported package 'path_provider' isn't a dependency of the importing package. Try adding a dependency for 'path_provider' in the 'pubspec.yaml' file. - depend_on_referenced_packages
info - example/test/main_test.dart:5:8 - The imported package 'camera_example' isn't a dependency of the importing package. Try adding a dependency for 'camera_example' in the 'pubspec.yaml' file. - depend_on_referenced_packages
9 issues found.
Package has 1 warning.
Step 7 works as expected:
Package has 0 warnings.
Note that all of the errors are coming from example. It appears that the pre-analysis resolution uses dart pub get logic, which only does the top-level package, but then it tries to analyze everything recursively. flutter pub get runs get for the example, fixing the issue.
This may seem contrived since it only happens if the tree is clean, but that's the common case in CI. This broke flutter/plugins.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)