-
Notifications
You must be signed in to change notification settings - Fork 53
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_cli] Add outputDirectoryShared
to config
#1557
Conversation
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
Package publish validation ✔️
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.
LGTM!
Offline discussion with @dcharkes - do not submit until new version has rolled into flutter. |
var cachedFiles = 0; | ||
|
||
await for (final sourceFile in dataDirectory.list()) { | ||
if (sourceFile is! File) { |
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.
nit: filter with whereType
instead
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.
Stream
doesn't have a whereType 😢
} | ||
|
||
final sourceName = | ||
sourceFile.uri.pathSegments.lastWhere((e) => e.isNotEmpty); |
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.
In the old uri vs. Strings discussion - package:path
has nice methods to get the basename
of a file
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.
vs package:file
😄
This PR adds an example of in-hook caching and sharing work across multiple hook invocations:
The prime example can be found in
pkgs/native_assets_builder/test_data/transformer/
.In order for the example to work correctly, a new
BuildConfig.outputDirectoryShared
is added and locking is used to ensure that the same hook invoked twice concurrently with a different parameter doesn't cause concurrent modifications. (This should not regress Flutter builds, because these run hooks for the various targets in sequence.)This CL does not yet address some other issues: