-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[native_assets_builder] Report all dependencies (or none and mandate to always be invoked) #1770
Comments
That brings up another interesting topic: We report dependencies as => Then we have are in a very awkward spot: Even though dart builds use content-based hashing to determine whether rebuilding is needed, users of the dart build may use time stamps and therefore the system doesn't actually guarantee we re-run when content changes. If we wanted to have hashing-based caching consistently across the system then we would need to tell the bundling tool => Another aspect is that if bundling tool uses reported dependencies to avoid re-running the dart build, we will, if something changed, do the same dependency validation again in the |
/cc @dcharkes |
As another comment on this caching business: I have some worries that using content-based hashes for everything will make this system overall very slow - especially concerning in hot-reload/hot-restart developer flow where we should keep this in the <=100s ms (and we'll have to perform this did-anything-chance every single time on all the deps of all assets & hook sources) We could contemplate to seggregate this, e.g.:
Do we even have strong evidence that we need content-based file-change detection? This may be an aspect that can influence protocol as the hooks report dependencies (if we did do segregation that may be visible in the protocol). Then hooks that e.g. download files and set an old timestamp could explicitly opt into content-based hashing. (**) Very intentionally |
Right, Besides the Dart sources of the hooks, the Another thing that
This didn't use to be possible from a Flutter This is worth exploring.
Right, the best the bundling tool can do is (1) hash after the fact, and (2) check that none of the files were modified after the bundling tool started its build. Which is rather wasteful, as we already do this inside It would be more efficient to indeed report hashes as well. (And it means that changing the hashing algorithm is a change that needs a manual roll.)
Yes. It doesn't work properly on windows with timestamps. Especially with downloaded files that have timestamps in the past. That's why Flutter uses content hashes.
This is exactly why Flutter uses timestamps for hot reload and accepts it's not fully correct. And uses hashing for non-hot-reload.
@blaugold and I had the idea that we could
Some incremental build systems. For example make does, but ninja does not. See my investigation in: Reflecting on this, I think we have two options as you mentioned:
Side note on (d) @mosuem suggested instead of pre-defining the list of env vars we pass in, we could also have the hook output the env vars it used in it's |
Actually that issue says: "last-modified timestamp & last-build-started timestamp ...This is the strategy used by make and ninja"
Not sure if it's related. Asking a package for data assets only instead of data assets and code assets is one thing. How dependencies are handled is another thing. A bundling tool (such as flutter) could always be less precise (e.g. imagine we have Why do you see this as related to
If the hook itself changes (e.g. adding another data asset may require modifying it) we should re-run.
I would assume that the package config is already included because when compiling a hook to kernel the CFE will have to read the package config to resolve package imports. So I'd assume it already emits
Yes, we should detect if a
If we restrict the env variables (which I suggested we do) then we won't re-run the whole world if another env variable is set by the user. I'd say the importance of re-running (if the env vars we allow through change) would be more important for cold runs (i.e. new Maybe we can put the short cuts / handling of hot-reload into flutter tools entirely? |
Ah, it was Bazel. (Remind myself to actually check things instead of doing from memory...)
For the completely-nothing-changed scenario, it doesn't matter if we do file hashes inside However, if we want the hook-just-passes-through-data-assets-on-disk scenario and one of those files changed to be also blazing fast. Then it potentially matters that we do file-content-hashing inside
Apparently not 🙈 dart-lang/sdk#59637 |
The dart builder returns
BuildResult.dependencies
andLinkResult.dependencies
. Those dependencies are the ones reported by the hooks themselves - which are dependencies that should cause re-run of hooks if changed.Though it seems that the source files of the hooks isn't reported to the bundling tool at all today.
=> The purpose of the dependencies is to tell a bundling tool when it needs to re-run the build/link steps.
=> The bundling tool needs to know all dependencies, including hook sources, dart sdk version, ... - anything that if changed should re-trigger of hooks
Alternatively one could say bundling tools always have to re-run the dart build and it may detect it's a NOP quickly and return.
=> If we want that, its questionable whether we should report dependencies at all to the bundling tool.
=> Then a bundling tool probably wants to know an additional piece of information, namely whether calling the dart build resulted in a NOP build or it actually changed the assets.
The text was updated successfully, but these errors were encountered: