build icon indicating copy to clipboard operation
build copied to clipboard

Emit a warning when a builder is not run due to defaultRootPackageSources

Open aran opened this issue 2 years ago • 2 comments

When developing a new Builder, if the chosen build_extensions fall outside of defaultRootPackageSources, the builder does not run. Even when stepping through the build process in the debugger, it is not easy to see why. In this situation, it would be helpful to the new Builder developer to emit some kind of warning so it is not a silent failure, perhaps in --verbose mode. Adding some discussion of defaultRootPackageSources to the documentation and examples would help as well.

  • dart --version Dart SDK version: 2.19.0-edge.a547cfc0969ea9baca14529670dd553ad810131c (be) (Mon Aug 15 16:13:46 2022 +0000) on "macos_x64"
  • build 2.3.0, build_runner 2.2.0
  • I encountered this while writing a simple builder that input a configuration file in the project root and emitted dart code for those configuration values into lib/

aran avatar Aug 16 '22 17:08 aran

Sorry for the extremely late reply here, this issue was missed at the time it was filed it seems.

I am not sure exactly what action to take beyond documentation here, we don't look at all at files outside the listed ones (these could be huge trees of hidden files etc, its just not worth doing).

I could see adding some documentation, do you have a suggestion for where or what that should look like?

jakemac53 avatar Sep 01 '23 17:09 jakemac53

I don't have a good enough understanding of the project goals and constraints to make great suggestions. But here are a few half-baked ideas:

  • track which sources result in outputs, and note (in --verbose?) which entries in sources do not result in outputs.
  • track which extensions in build_extensions do not result in builders being selected and warn.
  • for each builder that is available does not run, in --verbose output the combo of sources/build_extensions/anything else that were considered.
  • edit https://github.com/dart-lang/build/blob/master/build_config/README.md to document the default sources under the "sources" section, and in the build_extensions section, outline the algorithm for what is considered.
  • It's been a while, but I think my issue was something like making a stupid simple configuration with somethign like build_extensions: {".txt": [".txt.copy"]} and then putting a '.txt' file in the project root, and having nothing happen but also no errors.

aran avatar Sep 01 '23 21:09 aran