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

Can no longer build drift: Could not resolve annotation for [various] #2325

Closed
stx opened this issue Feb 23, 2023 · 2 comments
Closed

Can no longer build drift: Could not resolve annotation for [various] #2325

stx opened this issue Feb 23, 2023 · 2 comments

Comments

@stx
Copy link

stx commented Feb 23, 2023

We can no longer compile via build_runner on Flutter 3.7.3, drift 2.5.0 and drift_dev 2.5.2.

flutter cleans, dependency upgrades and various Flutter and dependency downgrades don't appear to have any effect.

We have no idea what the issue is or how to go about fixing it. Can you help?

build.yaml:

targets:
  $default:
    builders:
      drift_dev:
        options:
          mutable_classes: true

flutter pub run build_runner build:

line 1, column 7124 of package:app/ios/.symlinks/plugins/webview_flutter_wkwebview/pigeons/web_kit.dart: Could not resolve annotation for `abstract class WKWebsiteDataStoreHostApi`.
  ╷
1 │ @HostApi(dartHostTestHandler: 'TestWKWebsiteDataStoreHostApi')
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
[SEVERE] drift_dev on lib/ios/.symlinks/plugins/shared_preferences_foundation/pigeons/messages.dart (cached):

line 1, column 204 of package:app/ios/.symlinks/plugins/shared_preferences_foundation/pigeons/messages.dart: Could not resolve annotation for `abstract class UserDefaultsApi`.
  ╷
1 │ ┌ @ConfigurePigeon(PigeonOptions(
2 │ │   dartOut: 'lib/messages.g.dart',
3 │ │   dartTestOut: 'test/test_api.g.dart',
4 │ │   swiftOut: 'darwin/Classes/messages.g.swift',
5 │ │   copyrightHeader: 'pigeons/copyright_header.txt',
6 │ └ ))
  ╵
[SEVERE] drift_dev on lib/ios/.symlinks/plugins/video_player_avfoundation/pigeons/messages.dart (cached):

line 1, column 204 of package:app/ios/.symlinks/plugins/video_player_avfoundation/pigeons/messages.dart: Could not resolve annotation for `class TextureMessage`.
   ╷
1  │ ┌ @ConfigurePigeon(PigeonOptions(
2  │ │   dartOut: 'lib/src/messages.g.dart',
3  │ │   dartTestOut: 'test/test_api.dart',
4  │ │   objcHeaderOut: 'ios/Classes/messages.g.h',
5  │ │   objcSourceOut: 'ios/Classes/messages.g.m',
6  │ │   objcOptions: ObjcOptions(
7  │ │     prefix: 'FLT',
8  │ │   ),
9  │ │   copyrightHeader: 'pigeons/copyright.txt',
10 │ └ ))
   ╵
[SEVERE] drift_dev on lib/ios/.symlinks/plugins/path_provider_foundation/pigeons/messages.dart (cached):

line 1, column 542 of package:app/ios/.symlinks/plugins/path_provider_foundation/pigeons/messages.dart: Could not resolve annotation for `abstract class PathProviderApi`.
  ╷
1 │ @HostApi(dartHostTestHandler: 'TestPathProviderApi')
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
[SEVERE] Failed after 451ms
pub finished with exit code 1
@stx stx changed the title build_runner no longer works: Could not resolve annotation for [various] Can no longer build drift: Could not resolve annotation for [various] Feb 23, 2023
@simolus3
Copy link
Owner

Is there supposed to be a hidden ios/.symlink folder in lib/? Are you doing that to vendor other packages into your repository or is that something that Flutter does?

You could probably work around this issue by adding this to your build.yaml:

targets:
  $default:
    sources:
       exclude:
         - "lib/ios/.symlinks/**"
    builders:
      drift_dev:
        options:
          mutable_classes: true

This error probably comes from the fact that other packages are using annotations not in your local package graph used by build_runner because their sources were blindly copied into lib/. Still, it would be interesting to know where that comes from.

@stx
Copy link
Author

stx commented Feb 24, 2023

@simolus3 Interesting. It looks like this is a side effect of running certain Flutter commands while in the ios folder. Just deleting that folder just fixed it. Thanks a ton!

@stx stx closed this as completed Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants