Skip to content
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] Separate out json_syntax_generator into separate package #2101

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

dcharkes
Copy link
Collaborator

@dcharkes dcharkes commented Mar 17, 2025

Bug: #1826

This refactors package:hooks tool/generate_syntax.dart.

  • Moved into its own package package:json_syntax_generator.
  • Documented the feature set: optional/required fields, subclassing, tagged unions, and enums.
  • Refactored from a single-pass code generator, to a two step pipeline. (1) analyze the JSON schema and extra into a data structure, (2) generate code from the data structure.
  • Sprinkled comments about the "why" on the most important classes and fields.

This PR is intended to be a NOP w.r.t. the syntax that's generated. (Some whitespace and toString changes.)

Having this as a separate package will enable us to reuse it for the syntax in different places. For now, we're not intending to publish it, instead we can use it as a git dependency in the dev dependencies (or we publish it unlisted). @mosuem Please let me know if it is possible for you to generate the syntax for the FontAssets.

Open issue:

  • The generated code requires a utils/json.dart. We should make the generated code be standalone. I'll do that in a follow up PR.

@github-actions github-actions bot added type-infra A repository infrastructure change or enhancement package:native_assets_cli labels Mar 17, 2025
@dcharkes dcharkes changed the base branch from main to subschemas March 17, 2025 11:25
Copy link

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 March 17, 2025 11:35
Base automatically changed from subschemas to main March 17, 2025 18:56
@dcharkes dcharkes force-pushed the refactor-generator branch from 69fc94b to 4694895 Compare March 17, 2025 18:58
@github-actions github-actions bot removed the type-infra A repository infrastructure change or enhancement label Mar 17, 2025
@dcharkes dcharkes added type-infra A repository infrastructure change or enhancement autosubmit labels Mar 17, 2025
@auto-submit auto-submit bot merged commit a3aad77 into main Mar 17, 2025
54 checks passed
@auto-submit auto-submit bot deleted the refactor-generator branch March 17, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit package:native_assets_cli type-infra A repository infrastructure change or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants