Skip to content

[native_assets_cli] Provide guidance on name spacing extensions #2132

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

Closed
dcharkes opened this issue Mar 25, 2025 · 1 comment
Closed

[native_assets_cli] Provide guidance on name spacing extensions #2132

dcharkes opened this issue Mar 25, 2025 · 1 comment
Assignees

Comments

@dcharkes
Copy link
Collaborator

dcharkes commented Mar 25, 2025

We should provide guidance on name-spacing the extensions to the base protocol so that we don't end up with name clashes.

This is for:

  1. type in EncodedAsset, and
  2. the key Config.

I believe the most natural way to name-space them is by using package names.

For the type in encoded assets and build_asset_types:

  • code_assets/code_asset
    • or code_assets/code
    • or code_asset in package:code_asset
  • code_assets/multi_architecture
  • data_assets/data
    • or data_asset in package:data_asset
  • flutter/font
    • or flutter_assets/font
  • unity/shader
  • ...

And in the config extensions simply always the package name.

This should prevent any name clashes between extensions and between extensions.

Together with #2091, this should prevent name clashes between the base protocol and extensions.

Thanks for the suggestion @mkustermann 🙏

@dcharkes dcharkes added this to the Native Assets v1.0 milestone Mar 25, 2025
@dcharkes dcharkes self-assigned this Mar 26, 2025
@dcharkes dcharkes moved this to In Progress in Native Assets Mar 26, 2025
auto-submit bot pushed a commit that referenced this issue Mar 28, 2025
Bug: #2132

Take the `Asset.type`s from the syntax.

(This will prevent any misspellings when using `EncodedAsset.type` as a String in `native_assets_cli`.)
auto-submit bot pushed a commit that referenced this issue Mar 28, 2025
Bug: #2132

This PR starts recognizing `code_assets/code` and `data_assets/data` as asset types besides `native_code` and `data`.

The `config.build_asset_types` now contains `["code_assets/code", "native_code"]` for code assets and `["data_assets/data", "data"]` for data assets.

The asset `type`s are still written as the old `"data"` and `"native_code"` to prevent breaking combinations with older hooks and SDKs.

### PR changes

* `pkgs/hooks`, `pkgs/code_assets`, and `pkgs/data_assets`
  * Add new syntax nodes for the new asset types.
    * These new nodes don't inline all the encoding in the object itself, encoding is only in `encoding`.
  * Adds test data with the new asset keys.
  * Added JSON schema tests that exercise the new asset keys.

* `package:native_assets_cli`
  * Recognize code and data assets with both the old a new asset keys.
  * Emit both old and new asset type in `config.build_asset_types`.
  * Emit the old asset type in assets for now.
@dcharkes
Copy link
Collaborator Author

With #2189, the asset-types are written as namespaced as well.

The asset-types and config keys are still read as the old ones s well, we can clean this up later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

1 participant