[native_assets_builder][native_assets_cli] Resources.json and caching #1178
Labels
P2
A bug or feature request we're likely to work on
package:native_assets_builder
package:native_assets_cli
Milestone
We'd like to only rerun link hooks when they need to be rerun, and
resources.json
* is an input to link hooks.We can explore a few different options.
resources.json
changes (as implied by Define theresources.json
format from@ResourceIdentifier
s and@pragma('dart2js:resource-identifier')
sdk#55494 (comment)). However, this would cause all link hooks to be rerun on any changes (minus source locations).dependencies
, which is a list of files and directories up front. As that would prevent relying on the native toolchain to provide such list of files/dirs.) But, it would theoretically enable filtering the resources.json to only contain what was requested. (However, with that kind of logic we should also give the build and link hooks aFileSystem
frompackage:file
that only shows the paths existing that were requested up front to be used.)@ResourceIdentifier
* and it subtypes have aSet<String> packageLinkHook
. And then filter the resources.json before invoking the link hook based on whether the annotation is destined for a package link hook. This approach is slightly less flexible than option 2 or 3 due to only the annotations being used. One cannot specify other types of dependencies. (And again it's slightly different from that we do give access to the full file system.) The last downside is that the author who owns the annotation class needs to know what linkers this annotation will be used in.*
To be renamed.For option 2. The question is what kind of dependencies for inside the resources.json should one be able to specify? And how does one specify dependencies that would be depended on if they existed. E.g. For file system dependencies we have directories, and we have considered adding globs (#1101). Can we have something similar for parts of a resources.json? Some candidates:
ResourceIdentifier
.The definition (name, parent, and library uri). This is not strictly needed, users can just depend on the annotation used to annotate the definition. That annotation might be too broad, and lead to too granular caching, but I believe that to be unlikely.Maybe filtering on annotation class and library uri is enough?
Thanks for bringing it up @mkustermann! And thanks for a useful discussion @HosseinYousefi @mosuem @liamappelbe @mkustermann! I've tried to write down the options in this issue. Did I miss anything from our discussion? Any other things that pop to mind?
The text was updated successfully, but these errors were encountered: