-
Notifications
You must be signed in to change notification settings - Fork 90
Build hook spec #955
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
Build hook spec #955
Changes from 1 commit
43950e2
d75f6ab
13e9ed6
6f59908
4bc8cbd
5e01f81
f745db4
be58730
e1e8754
7fb1fce
ac5a7da
746a74d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,33 +6,34 @@ Version 1: As of 2024-01-24 implemented behind `--enable-experiment=native-asset | |
| ### Concepts | ||
|
|
||
| #### Asset | ||
| A reference to a file that is identified by an `assetId`. There may be multiple files with the | ||
| same `assetId` with different characteristics such as `target` or `link_mode`. | ||
|
|
||
| Note that in v1 there are _only_ native code assets, no data assets. | ||
| Native code assets are dynamic libraries. | ||
| Native data assets will be blobs of data accessible as a byte list in Dart. | ||
| An asset is a file together with metadata that tells the Dart and Flutter SDK how to bundle such asset in an application bundle. | ||
|
|
||
| #### AssetId | ||
| An asset must have an `assetId`. Dart code that uses an asset, references the | ||
| asset using the `assetId`. | ||
| Currently, all such assets are dynamic libraries. | ||
|
|
||
| A package MUST prefix all assetIds it defines with: `package:<package>/`, this | ||
| ensures assets don't conflict between packages. | ||
| An asset must have an `assetId`. Dart code that uses an asset, references the asset using the `assetId`. | ||
|
|
||
| Conventionally, an asset referenced from `lib/src/foo.dart` in `package:foo` | ||
| has `assetId = 'package:foo/src/foo.dart'`. | ||
| An asset must have a target os and target architecture. When accessing the asset at runtime, the asset for the current os and architecture is accessed. | ||
|
||
|
|
||
| #### Target | ||
| An asset must have a link mode. Currently, the only supported link mode is dynamic. (Static linking of native code will be added later.) | ||
|
|
||
| A target specifies the operating system and architecture of the targeted platform. | ||
| An asset must specify a path type for dynamic linking. | ||
|
|
||
| List of `platform` and `architecture` tuples supported by the | ||
| Dart and Flutter SDKs to be specified below: | ||
| * `linux_x64` | ||
| * TODO: enumerate full list of supported platform/architecture tuples. | ||
| * `absolute` paths are absolute paths in the output dir (see below). | ||
dcharkes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * `system` paths are expected to resolve on the target machine PATH. In this case the asset is not a file but only metadata. | ||
|
||
| * `process` "paths" have no path, symbols are resolved in the current process. In this case the asset is not a file but only metadata. | ||
|
||
| * `executable` "paths" have no path, symbols are resolved in the current executable. In this case the asset is not a file but only metadata. | ||
|
|
||
| #### AssetId | ||
| An asset must have an `assetId`. Dart code that uses an asset, references the asset using the `assetId`. | ||
|
|
||
| A package must prefix all assetIds it defines with: `package:<package>/`, this ensures assets don't conflict between packages. | ||
|
||
|
|
||
| Conventionally, an asset referenced from `lib/src/foo.dart` in `package:foo` has `assetId = 'package:foo/src/foo.dart'`. | ||
|
||
|
|
||
| #### Target os and architecture | ||
|
|
||
| A target specifies the operating system and architecture of the targeted platform. | ||
|
|
||
| ### `build.dart` | ||
| To bundle native assets with a package, that package must define a `build.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.
Here and in the other items: You probably mean
the metadata must contain? Also, what doesusingmean? I assume just referencing, as an asset is 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.
Right, we have conflated the
Assetclass that is metadata, and the file. This probs requires a full rewrite.Since we also have a "metadata" field in the build input and build output, we shoudl probably refrain from calling everything that is not the file metadata. Maybe we should call the file the "asset file".