dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
791 stars 211 forks source link

`build_runner` crashes when using pub workspaces feature #3726

Closed pattobrien closed 4 months ago

pattobrien commented 4 months ago

Reproducible repo here: https://github.com/pattobrien/build_runner_workspaces_bug

Tested with the latest build_runner version (see info below)

build_runner workspaces bug

steps to reproduce

  1. in directory /nested_a, run the following command:
dart run build_runner watch -d

build_runner crashes with the following output

Building package executable... 
Built build_runner:build_runner.
[INFO] Generating build script completed, took 482ms
[INFO] Precompiling build script... completed, took 3.8s
[INFO] Setting up file watchers completed, took 19ms
[INFO] Waiting for all file watchers to be ready completed, took 198ms

You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues

AssetNotFoundException: nested_a|.dart_tool/package_config.json
package:build_runner_core/src/asset/file_based.dart 135:18  _fileForOrThrow.<fn>
dart:async                                                  _CustomZone.runUnary
package:build_runner_core/src/asset/file_based.dart 35:13   FileBasedAssetReader.readAsBytes.<fn>
package:build_runner/src/generate/watch_impl.dart 336:11    WatchImpl._run.<fn>

additional info

jakemac53 commented 4 months ago

@pattobrien Are you for sure on the latest build_runner_core as well? You will need version 7.3.1

jakemac53 commented 4 months ago

Oh, it looks like another fix landed after that which hasn't yet been published, I can work on a release today

pattobrien commented 4 months ago

Oh, it looks like another fix landed after that which hasn't yet been published, I can work on a release today

Thanks so much @jakemac53 ! I can confirm the fix using the release branch.