Skip to content

generate-code command generates code with errors #8440

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

Closed
kenzieschmoll opened this issue Oct 15, 2024 · 2 comments · Fixed by #8464
Closed

generate-code command generates code with errors #8440

kenzieschmoll opened this issue Oct 15, 2024 · 2 comments · Fixed by #8464
Labels
P2 important to work on, but not at the top of the work list. tool Issues pertaining to `devtools/tool/` scripts and functionality

Comments

@kenzieschmoll
Copy link
Member

This doesn't appear to be happening on the CI, because tests pass there. But locally, I see these improperly generated mocks each time I run dt generate-code.

Screenshot 2024-10-15 at 2 08 22 PM

CC @DanTup because I think you've run into this before?
CC @srawlins in case you have any ideas about our generate mocks setup.

Repro steps:

  1. Run dt update-flutter-sdk --update-on-path to ensure that the tool/flutter-sdk directory and your local flutter sdk are on the flutter version that DevTools is pinned to use.
  2. Run dt generate-code to generate mocks. Optionally, you can also try dt generate-code --upgrade to upgrade pub dependencies before generating code. Both resulted in generated code with errors for me.
@kenzieschmoll kenzieschmoll added P2 important to work on, but not at the top of the work list. tool Issues pertaining to `devtools/tool/` scripts and functionality labels Oct 15, 2024
@DanTup
Copy link
Contributor

DanTup commented Oct 16, 2024

I've seen this a few times before and it's fairly sporadic. I thought it was just me so I didn't dig into it too much (honestly, I didn't know where to start debugging). Sometimes I just manually fix the file up (changing dynamic to the type it wants), but if it's not just me it would be nice to track down.

I just pulled latest (7a9b23f) and ran dt update-flutter-sdk then dt generate-code and did not have this issue. So I tried with --upgrade but it still didn't occur.

It's weird because when it happens, it's only for a couple of requests, and as far as I can tell the missing types (which have been replaced by dynamic) are all in the same library as other types that were included correctly!?

@kenzieschmoll
Copy link
Member Author

Applying this workaround fixes the issue.

dart-lang/mockito#612 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 important to work on, but not at the top of the work list. tool Issues pertaining to `devtools/tool/` scripts and functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants