-
-
Notifications
You must be signed in to change notification settings - Fork 172
Description
If a package has a build.yaml for other builders and keeps FlutterGen configuration in pubspec.yaml (as documented), running build_runner prints:
[SEVERE] FlutterGen:
Specified build.yaml as input but the file does not contain valid options, ignoring...
The build then proceeds and succeeds. The message is misleading: nothing is wrong with FlutterGen’s configuration, and build.yaml intentionally does not contain FlutterGen options.
Expected behavior
-
If FlutterGen configuration is in
pubspec.yaml, and there is abuild.yamlthat does not contain FlutterGen options, FlutterGen should:- either not read
build.yamlat all, or - log at INFO/DEBUG (not SEVERE) that it found no FlutterGen options and is using
pubspec.yaml.
- either not read
-
A SEVERE log should be reserved for an actual configuration error (e.g., invalid keys or values in the file that FlutterGen is supposed to read).
Actual behavior
- FlutterGen emits a SEVERE log line whenever
build.yamlis present but doesn’t contain FlutterGen options, even though configuration is valid inpubspec.yaml. - This is noisy in CI and can be mistaken for a real error.
Steps to reproduce
-
Create a Flutter package/app.
-
Put FlutterGen configuration in
pubspec.yaml(example below). -
Add a
build.yamlat the package root for unrelated builders (e.g.,graphql_codegen,go_router_builder), without any FlutterGen section. -
Run:
dart run build_runner build --delete-conflicting-outputs
-
Observe the SEVERE message from FlutterGen, even though the build succeeds.
pubspec.yaml (relevant part):
flutter_gen:
output: lib/gen/
line_length: 80
integrations:
flutter_svg: truebuild.yaml (example for other builders only):
targets:
$default:
builders:
graphql_codegen:graphql_codegen:
options:
clients: [graphql]
global_options:
go_router_builder:go_router_builder:
runs_before:
- graphql_codegen:graphql_codegenLog excerpt:
[INFO] Generating build script completed, took 151ms
[INFO] Precompiling build script... completed, took 3.0s
[SEVERE] FlutterGen:
Specified build.yaml as input but the file does not contain valid options, ignoring...
[INFO] Building new asset graph completed, took 902ms
...
[INFO] Succeeded after 13.5s with 208 outputs (1246 actions)
Environment
flutter_gen_runner: 5.11.0flutter_gen_core: 5.11.0build_runner: 2.4.15- Dart SDK: 3.8.x
- Flutter: 3.32.x
- OS: macOS 15.6
Impact
- Causes false‑positive “errors” in local logs and CI.
- Can trigger CI failure if logs are parsed for error severity.
- Confuses users into chasing a non‑issue.
Workarounds (not ideal)
-
Add a minimal FlutterGen block to
build.yamljust to silence the message:targets: $default: builders: flutter_gen_runner: options: output: lib/gen/
This defeats the purpose of using
pubspec.yamlas the canonical place for FlutterGen config. -
Ignore the message (noisy in CI).
Suggested fix
-
Detection logic: Only attempt to parse
build.yamlfor FlutterGen when it contains known FlutterGen keys (e.g.,targets.$default.builders.flutter_gen_runnerorflutter_gensections). Otherwise skip quietly. -
Severity: If you still want to log, downgrade to INFO/DEBUG with wording like:
“FlutterGen: No FlutterGen options in build.yaml; using pubspec.yaml/defaults.”
-
Docs note: Clarify precedence and that having a
build.yamlfor other builders is supported and should not produce a severe error.
Additional context
I maintain a build.yaml for other tools (e.g., graphql_codegen, go_router_builder) and keep FlutterGen settings in pubspec.yaml. The configuration is valid, and the build succeeds; only the severity of the log line is problematic.