Search code examples
flutterdartgithub-actionscode-generation

dart tools error using build_runner on github actions


locally the command
flutter pub run build_runner build --delete-conflicting-outputs
works fine, but in github actions w/ melos throws

Unhandled exception:
Bad state: Unable to generate package graph, no `/home/runner/work/myapp/myapp/myapp/.dart_tool/flutter_gen/pubspec.yaml` found.
#0      _pubspecForPath (package:build_runner_core/src/package_graph/package_graph.dart:253:5)
#1      _parsePackageDependencies (package:build_runner_core/src/package_graph/package_graph.dart:227:21)
#2      PackageGraph.forPath (package:build_runner_core/src/package_graph/package_graph.dart:105:33)
<asynchronous suspension>
#3      main (file:///opt/hostedtoolcache/flutter/stable-3.10.6-x64/.pub-cache/hosted/pub.dev/build_runner-2.4.6/bin/build_runner.dart:27:30)
<asynchronous suspension>

(note that `.dart_tool' are in .gitignore,
so I guess they should be generate on "pub get")

this the relevant part of my "pubspec"


environment:
  sdk: ^3.0.0
  flutter: ^3.10.0

dependencies:

  ### SDK
  flutter:
    sdk: flutter
/// [...]
dev_dependencies:
  build_runner: ^2.4.6
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.2
  custom_lint: ^0.4.0
  stub: ^2.0.0
  flutter_launcher_icons: ^0.13.1

  # riverpod
  riverpod_generator: ^2.2.3
  riverpod_lint: ^1.3.2

flutter:
  generate: true
  uses-material-design: true
  assets:
    - assets/

any help would be appreciated


Solution

  • turns out the issue was caused by 'flutter_localizations'
    that lacked a l10n.yaml file.

    I'll open an issue on flutter repo since the error message is unclear

    Thank you @venir for pointing me in the right direction!