-
Notifications
You must be signed in to change notification settings - Fork 69
Initial version #3
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
f66db48
to
fe942d1
Compare
7f53aba
to
72e9e44
Compare
0cf4a6f
to
04e4812
Compare
Hey - you generally don't (almost never? never?) want to squash and force push to a PR (and esp. after a PR has any review comments). You lose all the metadata and history that github PR reviews use. This is still a draft, but you still generally want to avoid squashing commits. The workflow is generally to build up commits in the PR - from before the review(s) or in response to them - and then when ready to merge, merge into the default branch as a single (squashed) commit via 'squash and merge'. |
I prefer squashing locally for:
I prevent losing history locally by keeping some branches/tags. I wish GitHub would keep snapshots like Gerrit does...
To ensure the CI setup with all the deps works. Otherwise I'd just do this on a branch before making a PR. I'll try to avoid force pushing once reviews come in. Maybe there are some parts of my GitHub workflow that could be optimized. I'm open to suggestions. |
04e4812
to
d496843
Compare
Hey @liamappelbe PTAL at this PR in conjunction with https://dart-review.googlesource.com/c/sdk/+/267340. |
@HosseinYousefi FYI: The build for |
pkgs/c_compiler/test/cbuilder/testfiles/hello_world/src/hello_world.c
Outdated
Show resolved
Hide resolved
Thanks @HosseinYousefi @liamappelbe! I'm going to hit merge so that we have a hash on main to pull in to the Dart SDK. |
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.
Some comments while looking briefly over it.
_combineMaps(entry.value.map((e) => e.toDartConst()).toList()) | ||
}; | ||
|
||
Map<Object, Object> toNativeAssetsFileEncoding() => { |
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 use the native assets file format for dart build
/ flutter build
/ ... and the VM (all under our control). The CLI and package's build.dart
don't need to know about it.
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 was thinking that it could be conceivable that people end up compiling kernel themselves and want to provide a manually baked native_assets.yaml
similiar to how they can provide a manual package_config.json
.
We could move the implementation to pkg/native_assets_builder in https://dart-review.googlesource.com/c/sdk/+/267340 if we want it to be private.
potentialPackaging: [Packaging.dynamic], | ||
); | ||
static const static = PackagingPreference( | ||
'static', |
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.
The dart build
/ flutter build
can only tell it's preference. Why would we need for static
/ dynamic
here? The bundling tool can still emit an error if it tells prefer-static
but gets dynamic libraries.
Could this be a simple enum LinkingPreference { static, dynamic, any }
?
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.
That means we cannot eagerly fail on the build in the package itself returning an error and non-0 exit code.
Maybe that's okay, but it would lead to some wasted work if it's a longer build.
Renamed to LinkModePreference
(to keep consistent with LinkMode
) in #11.
_cc, | ||
_ld, | ||
_packaging, | ||
DeepCollectionEquality().hash(_dependencyMetadata), |
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.
Wouldn't a deterministic hashability of the Config
object be sufficient?
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'm not sure I get what you mean. Do you mean identity hashCode?
I want the hashCode to be consistent with equals (so not identity hashCode). And equality is needed for checking if anything changed between builds, and useful for tests.
final DateTime timestamp; | ||
final List<Asset> assets; | ||
final Dependencies dependencies; | ||
final Metadata metadata; |
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.
It seems that this BuildOutput
doesn't make a real API (such as output.addAsset(...)
) instead it exposes it's constituent fields. Some of those fields like assets
are mutable, others are not mutable.
It may be better to provide an API that one can use to add things to the output. The API can be hierarchical just like the config.
Thanks @mkustermann ! I'll address them in a follow up PR. edit: it looks like the comments I drafter earlier were never sent. |
Initial version of the Native Assets CLI and C compiler wrapper packages.
Package features
package:native_assets_cli
:package:c_compiler
:The minimal build script with these two packages is:
Coverage in this initial PR
Dart SDK CL pulling these changes in and exercising them https://dart-review.googlesource.com/c/sdk/+/267340.
We're not intending on publishing a v0.1.0 just yet. Landing this on the main branch enables us pulling it in via DEPS in the Dart SDK. (If we don't land it, we might risk a git hash that is garbage collected, breaking reproducibility of old Dart SDK builds.)
Because we're not yet publishing a version, we don't have to pin ourselves down on an API just yet.
Follow up work
a. The package itself and run tests on Dart bots
b. Add implementation to dartdev and run tests for it on the Dart bots.
I'd like to land this initial version as is, because it's already quite big.