getsentry / sentry-mobile-release-health-app

Sentry Mobile App
Other
45 stars 5 forks source link

Code generation is broken: `Could not generate `toJson` code for `stats24h` because of type `Stat`.` #199

Closed bruno-garcia closed 3 years ago

bruno-garcia commented 3 years ago
➜  sentry-mobile git:(main) flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 373ms

[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 81ms

[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 433ms

[INFO] Running build...
[INFO] Running build completed, took 21ms

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 51ms

[SEVERE] json_serializable:json_serializable on lib/types/stats.dart (cached):

Could not generate `toJson` code for `stats24h` because of type `Stat`.
package:sentry_mobile/types/stats.dart:14:21
   ╷
14 │   final List<Stat>? stats24h;
   │                     ^^^^^^^^
   ╵
ueman commented 3 years ago

The generated files shouldn't be committed to the repository because they might become stale. Just like this issue shows. Instead they should be generated on CI on each run. Same thing for local builds. That behavior would have broken CI for this issue (and rightly so).

bruno-garcia commented 3 years ago

@ueman PR incoming? :P

ueman commented 3 years ago

@ueman PR incoming? :P

@denrase is not fully convinced yet: https://github.com/getsentry/sentry-mobile/pull/204#issuecomment-874093102

bruno-garcia commented 3 years ago

To be honest I thought the same as @denrase.

One alternative is to keep files there but in CI generate them and make sure they match. Break CI if they don't so someone has to intervene.

denrase commented 3 years ago

@bruno-garcia Decided to exclude the files after all. The command runs fast and we don't need to do anything special on CI. We can revert back if this turns out to be tedious.