dart_environment_config icon indicating copy to clipboard operation
dart_environment_config copied to clipboard

Use builders to run the generator instead of just as a script.

Open smac89 opened this issue 5 years ago • 6 comments

I have many builders that I often have to run to generate files for me. Usually all I have to do is run dart pub run build_runner build to generate the files, but then I have to go back and run dart pub run environment_config:generate for this one to work.

With this PR, all you need to do it configure your arguments in the build.yaml (see example/build.yaml) file, and when you run:

flutter pub run build_runner build

dart will run this generator along with other generators you defined in the build.yaml file.

smac89 avatar Aug 25 '20 21:08 smac89

Hello) thank you for this PR, overall I like this idea, but I'm not sure that it should work with build runner only. It may work for dev environment, but not for CI/CD

TatsuUkraine avatar Aug 26 '20 06:08 TatsuUkraine

So instead of forcing developer to use builder, I would keep original manual command run and add entry for buld_runner with some docs and examples, since build runner may not fit to some developers needs in some CI/CD tools

TatsuUkraine avatar Aug 26 '20 06:08 TatsuUkraine

Hello) thank you for this PR, overall I like this idea, but I'm not sure that it should work with build runner only. It may work for dev environment, but not for CI/CD

@TatsuUkraine

That's cool. To fix that is easy, we just need to once again extract the function and make it standalone, and then call it from the builder. I will update the PR ASAP.

smac89 avatar Aug 26 '20 09:08 smac89

I think it already was extracted. Probably best way will be keep original lib/generator.dart, and create a new dart file with configuration for the build runner

TatsuUkraine avatar Aug 26 '20 09:08 TatsuUkraine

In that way function from lib/generator.dart can be used and in manual runner from bin folder, and in build runner config entry

TatsuUkraine avatar Aug 26 '20 09:08 TatsuUkraine

@TatsuUkraine how is that?

smac89 avatar Aug 26 '20 17:08 smac89