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 395 forks source link

How to generate code for specific files #1322

Closed manhtran-itr closed 1 year ago

manhtran-itr commented 1 year ago

I want to generate only new files created, don't want to re-generate the whole project files because it takes too long for generate and face the risks to modify them.

kevmoo commented 1 year ago

If build is used correctly, incremental builds will be FAST and you won't risk modifying any other files.

manhtran-itr commented 1 year ago

@kevmoo if there is any way to specify only one file to generate codes? I would like to build only new files, it will save time.

kevmoo commented 1 year ago

This is not specific to this package.

maybe look at https://github.com/dart-lang/build/blob/master/build_config/README.md ?

manhtran-itr commented 1 year ago

@kevmoo Thanks for your response!. I found a way to generate a specific file by adding generate_for into build.yaml file but I always get the error Found 460 declared outputs which already exist on disk. This is likely because the.dart_tool/buildfolder was deleted, or you are submitting generated files to your source repository. [SEVERE] Conflicting outputs were detected and the build is unable to prompt for permission to remove them. These outputs must be removed manually or the build can be run with--delete-conflicting-outputs.

Because of the error, I must add the option '--delete-conflicting-outputs' it deletes all my files generated before I don't expect that. I want to generate a specific file and ignore all the previous files generated.

kevmoo commented 1 year ago

@manhtran-itr – please start a discussion on the build repo. This is not related to this package.