-
Notifications
You must be signed in to change notification settings - Fork 55
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 dart sources as dependencies of hooks #1780
Conversation
51dd61c
to
fde2f0a
Compare
PR HealthBreaking changes ✔️
Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
|
fde2f0a
to
90eee5b
Compare
90eee5b
to
36da1b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with comments
@@ -437,12 +437,12 @@ class NativeAssetsBuildRunner { | |||
), | |||
); | |||
if (buildOutput == null) return null; | |||
hookResult = hookResult.copyAdd(buildOutput); | |||
hookResult = hookResult.copyAdd(buildOutput, [/*dry run is not cached*/]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you say dry run was finally purged from existence?
Why is this code still here?
pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart
Outdated
Show resolved
Hide resolved
@@ -538,7 +538,7 @@ ${e.message} | |||
[ | |||
...result.dependencies, | |||
// Also depend on the hook source code. | |||
hookHashesFile.uri, | |||
hookHashes.file.uri, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's assume we did one build. Now I modify hook/build.dart
by adding a few comments.
Next time we run a build, the system sees that hook sources changed and it will re-compile the hook, giving us a new dill file.
Now, since we only changed comments in the hook/build.dart
, we will get an identical .dill
file.
So the next step is running the hook. Though we can skip running the hook if none of the hook-reported deps changed and the hook.dill
didn't change (which it didn't)
=> In this scenario we could avoid running the hook.
Though this code looks like we're going to re-run the hook, because we add the hooks.d
file here (where hashes of sources changed, we we added some comments).
(One could argue this redundant run is ok because it's very uncommon, but from conceptual point we should only re-run things when needed)
pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart
Outdated
Show resolved
Hide resolved
pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart
Outdated
Show resolved
Hide resolved
pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart
Outdated
Show resolved
Hide resolved
pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart
Outdated
Show resolved
Hide resolved
pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart
Outdated
Show resolved
Hide resolved
Thanks @mkustermann! I'll address the two remaining comments in separate PRs. |
Closes: #1770
This PR adds the Dart sources to the dependencies in
HookResult
.It also fixes the dep-file parsing w.r.t. to escapes.
Implementation details
We're passing around
HookOutput
s which is the deserializedoutput.json
. We could add the Dart sources as dependencies to it after deserializing, but then the correspondence to the json is lost. So instead I've added an extra return value to the places where we passHookOutput
around.