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

[Pigeon] Condenses serialization formats #2745

Merged
merged 72 commits into from
Dec 18, 2022

Conversation

tarrinneal
Copy link
Contributor

@tarrinneal tarrinneal commented Oct 27, 2022

Condenses the serialization platform of generated api's by converting objects to lists

List which issues are fixed by this PR. You must list at least one issue.
fixes flutter/flutter#111503
fixes flutter/flutter#111722
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
tbc

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

I gave this a quick look and it's all in the right place. One thing to make sure is that there is an explicit defined order of the fields when they are written. Writing them in the order they show up in the pigeon file is good. I'd just make sure that's the case.

packages/pigeon/lib/dart_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/dart_generator.dart Outdated Show resolved Hide resolved
@flutter flutter deleted a comment from flutter-dashboard bot Nov 23, 2022
@tarrinneal tarrinneal marked this pull request as ready for review November 23, 2022 23:19
tarrinneal and others added 2 commits November 23, 2022 16:36
- Fix API call typo.
- Fix double nesting of arrays for class serialization.
- Replace incorrect emplace calls with push_back.
- Start to update unit tests.
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

C++ and Obj-C reviews done; again just small things. Swift and Kotlin tomorrow :)

packages/pigeon/lib/cpp_generator.dart Outdated Show resolved Hide resolved
@@ -588,7 +588,7 @@ const flutter::StandardMessageCodec& ${api.name}::GetCodec() {
indent.write('if ($encodableArgName.IsNull()) ');
indent.scoped('{', '}', () {
indent.writeln(
'wrapped.emplace(flutter::EncodableValue("${Keys.error}"), WrapError("$argName unexpectedly null."));');
'wrapped = WrapError("$argName unexpectedly null.");');
Copy link
Contributor

Choose a reason for hiding this comment

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

Note for future PR work: this is something we should remove, and replace with a debug-only assert, since per previous offline discussion we don't want non-debug runtime checks that the wire format is correct. Could you see if we have a bug about removing runtime type/nullability checks in our deserialization across any generators that have them, and file it if not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue filed, feel free to add more detail if you think my description is lacking. flutter/flutter#116972

packages/pigeon/lib/cpp_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/cpp_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/cpp_generator.dart Show resolved Hide resolved
packages/pigeon/lib/objc_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/objc_generator.dart Show resolved Hide resolved
packages/pigeon/lib/objc_generator.dart Show resolved Hide resolved
packages/pigeon/lib/objc_generator.dart Show resolved Hide resolved
packages/pigeon/lib/dart_generator.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

All languages complete! Other than the Kotlin wrapError thing it's all very minor.

I'm going to LGTM with these comments since I don't think anything here should need re-review, but if there's anything you change that you want me to look at let me know.

packages/pigeon/lib/cpp_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/dart_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/java_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/java_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/java_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/kotlin_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/kotlin_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/kotlin_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/swift_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/swift_generator.dart Show resolved Hide resolved
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

Wowee, there is a lot more to review now. 2 big things, the rest you can ignore:

  1. I think you have a bug in the c++ generator
  2. I think we should avoid building wrapped values by using .add methods, instead indexing exactly where the values should go.

packages/pigeon/lib/cpp_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/cpp_generator.dart Show resolved Hide resolved
packages/pigeon/lib/dart_generator.dart Show resolved Hide resolved
packages/pigeon/lib/generator_tools.dart Show resolved Hide resolved
packages/pigeon/lib/kotlin_generator.dart Outdated Show resolved Hide resolved
packages/pigeon/lib/java_generator.dart Outdated Show resolved Hide resolved
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for tackling this, a brave new world for pigeon.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 18, 2022
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 18, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Dec 18, 2022

auto label is removed for flutter/packages, pr: 2745, due to - The status or check suite ios-build_all_packages CHANNEL:master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 18, 2022
@auto-submit auto-submit bot merged commit 5662a7e into flutter:main Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: pigeon
Projects
None yet
3 participants