google / json_serializable.dart

Generates utilities to aid in serializing to/from JSON.
https://pub.dev/packages/json_serializable
BSD 3-Clause "New" or "Revised" License
1.55k stars 397 forks source link

`build_runner` never finishes building #1285

Open HosseinYousefi opened 1 year ago

HosseinYousefi commented 1 year ago

flutter --version:

Flutter 3.8.0-10.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 1a0a03a41d (4 days ago) • 2023-02-16 22:03:58 -0600
Engine • revision 639e313f99
Tools • Dart 3.0.0 (build 3.0.0-218.1.beta) • DevTools 2.21.1

I'm trying to run dart run build_runner build in https://github.com/dart-lang/jnigen/tree/main/jnigen but it never ends.

❯ dart run build_runner build
Building package executable... (3.7s)
Built build_runner:build_runner.
[INFO] Generating build script completed, took 193ms
[WARNING] Invalidated precompiled build script due to missing asset graph.
[INFO] Precompiling build script... completed, took 3.2s
[INFO] Building new asset graph completed, took 2.8s
[INFO] Found 1 declared outputs which already exist on disk. This is likely because the`.dart_tool/build` folder was deleted, or you are submitting generated files to your source repository.
Delete these files?
1 - Delete
2 - Cancel build
3 - List conflicts
1
[INFO] Checking for unexpected pre-existing outputs. completed, took 3m 50s
[INFO] Generating SDK summary completed, took 2.7s
[INFO] 6m 41s elapsed, 12359/12360 actions completed.

More and more actions keep being added. There is only a single file with a handful of classes containing JsonSerializable annotations.

I also tried flutter clean and running flutter pub run build_runner build instead of dart run build_runner build with the same results.

Relevant dev dependencies:

build_runner: ^2.2.0
json_serializable: ^6.6.0

Relevant dependencies:

json_annotation: ^4.8.0
kevmoo commented 1 year ago

Try adding --verbose? Try deleting all of .dart_tool first?

HosseinYousefi commented 1 year ago

Try adding --verbose?

The problem was with symlinks in ephemeral/.plugin_symlinks. It went into an infinite loop for example/** since they had a dependency on the project itself.

I still think that this might be an issue. Not necessarily just for json_serializable.

kevmoo commented 1 year ago

I still think that this might be an issue. Not necessarily just for json_serializable.

Absolutely. CC @jakemac53