Skip to content

[native_assets_cli] Syntax for assets_for_build and hooks/metadata #2163

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

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

dcharkes
Copy link
Collaborator

@dcharkes dcharkes commented Apr 3, 2025

Bug: #1251

This PR contains the JSON spec for:

For more details see that PR.

This PR adds the syntax for passing assets from build hooks to build hooks.

build output assets_for_build:

{
  "assets": [],
  "assets_for_build": [
    {
      "encoding": {
        "a_key": "some_value"
      },
      "some_key": "some_value",
      "type": "some_asset_type"
    }
  ],
  "assets_for_linking": {},
}

build input assets per package name:

{
  "assets": {
    "some_package": [
      {
        "some_key": "some_value",
        "type": "some_asset_type"
      }
    ]
  },
  "config": {},
}

Secondly, this PR adds a syntax for metadata assets (assets that cannot be bundled but just ferry information between different hooks).

      {
        "encoding": {
          "key": "foo",
          "value": "bar"
        },
        "type": "hooks/metadata"
      },

The schemas now check these.

And this is covered by tests.

Changes to the generated schemas:

  • Override the new build input asset and build output assets_for_build with the CodeAsset and DataAsset in the generated extension schemas.

Notable changes to the syntax generator:

  • Enable generating tagged enum classes if there are two fields (a tag, and some encoding) in the super class.
  • Support Object fields (used for MetadataAsset.value).

Copy link

github-actions bot commented Apr 3, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
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/objective_c/lib/src/ns_input_stream.dart

@dcharkes dcharkes marked this pull request as ready for review April 3, 2025 11:43
@dcharkes dcharkes force-pushed the syntax-refactor-overrides branch from c3bd161 to 6d18d6d Compare April 4, 2025 07:50
@dcharkes dcharkes force-pushed the metadata-refactor-syntax branch from 5f12140 to b5729b9 Compare April 4, 2025 07:51
Base automatically changed from syntax-refactor-overrides to main April 4, 2025 08:00
@dcharkes dcharkes force-pushed the metadata-refactor-syntax branch from b5729b9 to 3da9128 Compare April 4, 2025 08:04
@coveralls
Copy link

coveralls commented Apr 4, 2025

Coverage Status

coverage: 84.822% (-0.3%) from 85.171%
when pulling cf34082 on metadata-refactor-syntax
into 18e2518 on main.

@dcharkes dcharkes force-pushed the metadata-refactor-syntax branch from 3da9128 to 0e1f6e1 Compare April 4, 2025 08:35
@dcharkes dcharkes force-pushed the metadata-refactor-syntax branch from 0e1f6e1 to cf34082 Compare April 4, 2025 13:10
@auto-submit auto-submit bot merged commit 481af77 into main Apr 4, 2025
46 checks passed
@auto-submit auto-submit bot deleted the metadata-refactor-syntax branch April 4, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants