-
Notifications
You must be signed in to change notification settings - Fork 78
[hooks] Run link hooks in order #2417
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
Conversation
PR Health
Breaking changes
|
Package | Change | Current Version | New Version | Needed Version | Looking good? |
---|---|---|---|---|---|
code_assets | Breaking | 0.19.4 | 0.19.4-wip | 0.20.0 Got "0.19.4-wip" expected >= "0.20.0" (breaking changes) |
|
data_assets | Breaking | 0.19.1 | 0.19.2-wip | 0.20.0 Got "0.19.2-wip" expected >= "0.20.0" (breaking changes) |
|
hooks | Breaking | 0.19.5 | 0.20.0-wip | 0.20.0 | ✔️ |
hooks_runner | Breaking | 0.21.0 | 0.22.0-wip | 0.22.0 | ✔️ |
native_toolchain_c | Breaking | 0.17.0 | 0.18.0-wip | 0.18.0 | ✔️ |
This check can be disabled by tagging the PR with skip-breaking-check
.
Changelog Entry ✔️
Package | Changed Files |
---|
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.
Package | Leaked API symbols |
---|
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files |
---|
no missing headers |
All source files should start with a license header.
Unrelated files missing license headers
Files |
---|
pkgs/jni/lib/src/third_party/generated_bindings.dart |
pkgs/native_doc_dartifier/lib/native_doc_dartifier.dart |
pkgs/native_doc_dartifier/lib/src/native_doc_dartifier_base.dart |
pkgs/objective_c/lib/src/ns_input_stream.dart |
89d0f4f
to
031f3ee
Compare
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
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.
General approach LGTM. I left a bunch of detailed comments.
2f596d8
to
fb5a45b
Compare
pkgs/data_assets/pubspec.yaml
Outdated
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.
Should there be new tests in this package to cover the new functionality?
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.
This should be covered by the added test at pkgs/hooks_runner/test/build_runner/link_test.dart
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.
We have coverage on the CI, but it doesn't collect coverage for the test
projects being run because those are separate dart process invocations. It might
be worth trying to see if we can get code coverage from those.
pkgs/hooks_runner/test_data/fun_with_flags/lib/src/fun_with_flags_base.dart
Outdated
Show resolved
Hide resolved
pkgs/hooks_runner/test_data/flag_enthusiast_2/lib/src/flag_enthusiast_2_base.dart
Outdated
Show resolved
Hide resolved
pkgs/hooks/lib/src/config.dart
Outdated
}) { | ||
_syntax.setup( | ||
assets: [ | ||
for (final asset in assets) AssetSyntax.fromJson(asset.toJson()), | ||
], | ||
assetsFromLinking: [ | ||
for (final asset in assetsFromLinking) | ||
AssetSyntax.fromJson(asset.toJson()), |
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.
I see that we are doing this above as well, but it seems strange that we are converting something to json only to decode it from json again...
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.
I would assume this is from the input/output json files.
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.
Don't assume, verify. (Git blame is your friend.)
As for the JSON ecoding
EncodedAsset
is an extension point, so theencoding
field is not decoded
bypackage:hooks
but bypackage:code_assets
for example.- Before [native_assets_cli] Cleanup JSON: old asset encoding #2220, the encoding could be in
two places, but not anymore. So this can be cleaned up.
[hooks] Cleanup encoded assets encoding #2454 - We still need to copy the map on
toJson
/fromJson
due toEncodedAsset
overriding hashCode and equals. ([native_assets_cli] PreventEncodedAsset
andMetadata
hashcode changing #2131)
088820a
to
ed6e124
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.
We need to cover the unhappy paths with tests as well.
- cyclic dependencies with link hooks (and only one build hook, so no cycles for the build hooks)
- outputting an asset for a link hook not directly in the dependencies, that should not be visible. (Actually we should probably make that an error, but it looks like
pkgs/hooks/lib/src/validation.dart
does not throw an error on that right now.)
pkgs/hooks/lib/src/config.dart
Outdated
}) { | ||
_syntax.setup( | ||
assets: [ | ||
for (final asset in assets) AssetSyntax.fromJson(asset.toJson()), | ||
], | ||
assetsFromLinking: [ | ||
for (final asset in assetsFromLinking) | ||
AssetSyntax.fromJson(asset.toJson()), |
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.
Don't assume, verify. (Git blame is your friend.)
As for the JSON ecoding
EncodedAsset
is an extension point, so theencoding
field is not decoded
bypackage:hooks
but bypackage:code_assets
for example.- Before [native_assets_cli] Cleanup JSON: old asset encoding #2220, the encoding could be in
two places, but not anymore. So this can be cleaned up.
[hooks] Cleanup encoded assets encoding #2454 - We still need to copy the map on
toJson
/fromJson
due toEncodedAsset
overriding hashCode and equals. ([native_assets_cli] PreventEncodedAsset
andMetadata
hashcode changing #2131)
dce41a1
to
15cf956
Compare
Changing |
Because it's user-facing in the hooks as well? Maybe skip it for now and keep the version |
Friendly ping @dcharkes or @goderbauer :) |
Friendly ping to address the previously unaddressed comment(s). Including the schema test. |
Is this not addressed? I did add the key to the test files. What else should be addressed? |
Already answered:
I've pushed a commit with what the test should do. Some already pass due to the test data you added 👍 , but not all. |
Done! |
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 from my side once the last small comments are addressed.
Thanks! 🙏
pkgs/data_assets/pubspec.yaml
Outdated
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.
We have coverage on the CI, but it doesn't collect coverage for the test
projects being run because those are separate dart process invocations. It might
be worth trying to see if we can get code coverage from those.
Fixes #2381
This brings an order in which the link hooks are run - reverse to the build hook run order. This starts at the application link hook, then it's dependencies, and so on.
This enables us to pass information from on link hook to another as
MetadataAsset
s - but also means that now link hooks must be invoked, regardless of whether assets are sent to the from a build hook.Seems to work: https://dart-review.googlesource.com/c/sdk/+/441201
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.