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] Split up syntax generator #2106

Merged
merged 1 commit into from
Mar 19, 2025
Merged

Conversation

dcharkes
Copy link
Collaborator

Bug: #1826

More refactorings to package:json_syntax_generator.

  • Split up generator in multiple files.
  • Move more logic to the helper functions.
    • setOrRemove to remove branching in setters for nullable values.
    • optionalListParsed to immediately parse list elements, to remove loops in getters.
  • Made all getters and setters use $dartType instead of spelling out types. This simplified generation of getters/setters for simplified types to a simple 10 lines. (Yay for a nice DartType abstraction!)
  • Removed the if (required) branching and instead made the relevant parts be variables.

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

@coveralls
Copy link

Coverage Status

coverage: 86.642% (+0.06%) from 86.587%
when pulling 90005a5 on refactor-generator-3
into 329b975 on main.

// BSD-style license that can be found in the LICENSE file.

/// Wraps the [input] in curly braces if it's not empty.
String wrapBracesIfNotEmpty(String input) => input.isEmpty ? input : '{$input}';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha nice! 😄

@dcharkes dcharkes merged commit 10a25e3 into main Mar 19, 2025
32 checks passed
@dcharkes dcharkes deleted the refactor-generator-3 branch March 19, 2025 14:07
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.

None yet

3 participants