Open stefan-schweiger opened 1 year ago
I just tried it without output_file_name
and noticed I have the same issue there as well.
Hi,
currently, this library generates the dart file only if input changes. That's why your issue should be minor.
I will investigate if there is a way to force a rebuild.
Other libraries have a 1:1 relationship between source and output. build_runner
will notice right away when you delete one of the output files. slang
however, does not tell build_runner
what and where to build beforehand. That's why build_runner
only watches the i18n files and the config to determine if slang
should be run.
Actually, --delete-conflicting-outputs
may not be needed anymore. I added this option a time ago when it was kind of buggy.
My recommendation is:
Run flutter pub run slang
on your dev machine. This command is build.yaml
compatible.
On your CI (if you have one), you can run flutter pub run build_runner build
. If you start from a clean environment everytime (which should be the case in CI), then everything should be okay.
@Tienisto this behavior should be mentioned in the docs or in FAQ at least, because the newcomers might wonder why build_runner does not output anything or why build_runner fails to generate files
Describe the bug When I run
flutter pub run build_runner build --delete-conflicting-outputs
with the followingbuild.yaml
the first time it generates the correcttranslations.g.dart
file. But when I run the command a second time it generates nothing (if you delete the file you won't get a new one). If I change theoutput_file
to something else it works again for one time and breaks again afterwards.For the same reason
flutter pub run build_runner watch --delete-conflicting-outputs
also doesn't work for me.Expected behavior The file should be regenerated each time the command is run.
Additional context
Additional question Why is the
--delete-conflicting-outputs
needed in the first place? Libs likeauto_route
andjson_serializable
don't seem to need the flag to work.