Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

smac89
Copy link

@smac89 smac89 commented Aug 25, 2020

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.

@TatsuUkraine
Copy link
Owner

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
Copy link
Owner

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

@smac89
Copy link
Author

smac89 commented Aug 26, 2020

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.

@TatsuUkraine
Copy link
Owner

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
Copy link
Owner

TatsuUkraine commented Aug 26, 2020

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

@smac89
Copy link
Author

smac89 commented Aug 26, 2020

@TatsuUkraine how is that?

@smac89 smac89 changed the title Use builders to run the generator instead of as a script. Use builders to run the generator instead of just as a script. Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants