flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

[BUG] build.yaml configuration instead of pubspec.yaml

Open zs-dima opened this issue 3 years ago • 7 comments

build.yaml intended for generators configuration. So could be nice to use build.yaml configuration instead of pubspec.yaml configuration.

Bad

pubspec.yaml

⭕️ Good

build.yaml

zs-dima avatar Jul 19 '21 10:07 zs-dima

You can specify the yaml file via:

fluttergen -c path/to/your/yaml/flie.yaml

lcdsmao avatar Jul 19 '21 10:07 lcdsmao

@lcdsmao here build_runner documentation

Builders are configured with a build.yaml

https://pub.dev/packages/build_runner

zs-dima avatar Jul 19 '21 10:07 zs-dima

@zs-dima What's your use case here? Can you give some examples?

lcdsmao avatar Jul 19 '21 10:07 lcdsmao

@lcdsmao I mean default way to configure builders libraries.

Here your documentation:

Configuration file

[FlutterGen] generates dart files based on the key flutter and flutter_gen of pubspec.yaml.
Default configuration can be found here.

# pubspec.yaml
# ...

flutter_gen:

but it have to be:

Configuration file

[FlutterGen] generates dart files based on the key flutter_gen of build.yaml.
Default configuration can be found here.

# build.yaml
# ...
    builders:
# ...
      flutter_gen:
# ...

zs-dima avatar Jul 19 '21 10:07 zs-dima

@zs-dima What's your use case here? Can you give some examples?

I'm guessing to be able to aggregate all codegen builders in the same command via: flutter pub run build_runner watch --delete-conflicting-outputs rather than individually running flutter packages pub run build_runner build or fluttergen and other packages. Since in build.yaml you can specify the commands for each builder like:

targets:
  $default:
    builders:
      slang_build_runner:
        options:
      flutter_gen:
        options:
      etc....

noga-dev avatar Dec 14 '22 09:12 noga-dev

@zs-dima What's your use case here? Can you give some examples?

I'm guessing to be able to aggregate all codegen builders in the same command via: flutter pub run build_runner watch --delete-conflicting-outputs rather than individually running flutter packages pub run build_runner build or fluttergen and other packages. Since in build.yaml you can specify the commands for each builder like:

targets:
  $default:
    builders:
      slang_build_runner:
        options:
      flutter_gen:
        options:
      etc....

To move builders configurations out of the pubspec.yaml

zs-dima avatar Dec 14 '22 10:12 zs-dima

Any plans to support this setup approach?

mrverdant13 avatar Apr 11 '23 02:04 mrverdant13