dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
153 stars 43 forks source link

[hooks] May need to add support for adding directory dependencies #1631

Open mkustermann opened 2 weeks ago

mkustermann commented 2 weeks ago

As some hooks may depend on the contents of a directory (e.g. add all fonts of a directory), we may need to add a concept of output.addDirectoryDependency({bool recursive}) to the dependency tracking system.

dcharkes commented 2 weeks ago

As some hooks may depend on the contents of a directory (e.g. add all fonts of a directory), we may need to add a concept of output.addDirectoryDependency({bool recursive}) to the dependency tracking system.

addDependency already enables specifying a directory. However, we do not have a recursive option. Do we need a recursive option or should we simply tell users to use package:glob to do so and provide only a shallow logic that closely mimics the JSON.

mkustermann commented 2 weeks ago

addDependency already enables specifying a directory. However, we do not have a recursive option. Do we need a recursive option or should we simply tell users to use package:glob to do so and provide only a shallow logic that closely mimics the JSON.

It has to be a feature of the build system, because adding a new file into the directory (or subdirectories) has to re-trigger an invocation of hook/build.dart.

Update: Ah, you mean that a user would recursively list all directories, add those as dependencies and then any new sub-dir/file would trigger a re-run. Yeah, that could work, but seems a little strange.