Skip to content

[pigeon] Allow multi instance support with message channel name suffix #6224

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 2 commits into from
Apr 3, 2024

Conversation

tarrinneal
Copy link
Contributor

@tarrinneal tarrinneal commented Feb 29, 2024

Adds the ability to instantiate any api using a suffix string to allow for unique instances.

partial flutter/flutter#66710

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.

@tarrinneal tarrinneal force-pushed the pigeon-channel-name-suffix branch 3 times, most recently from 84d3c99 to debb5e5 Compare March 1, 2024 00:56
@tarrinneal tarrinneal force-pushed the pigeon-channel-name-suffix branch from f2e8aba to 8705947 Compare March 7, 2024 23:30
@tarrinneal tarrinneal changed the title [pigeon] channel name suffix [pigeon] Allow multi instance support with message channel name suffix Mar 7, 2024
@tarrinneal tarrinneal force-pushed the pigeon-channel-name-suffix branch from 8705947 to 90a1269 Compare March 7, 2024 23:59
@tarrinneal tarrinneal marked this pull request as ready for review March 7, 2024 23:59
@tarrinneal tarrinneal force-pushed the pigeon-channel-name-suffix branch 2 times, most recently from 93e299d to 65d0acf Compare March 12, 2024 04:11
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

With the changes below the tests run, but there's a bad allocation exception being thrown that I'm still looking into.

@tarrinneal
Copy link
Contributor Author

This is fully ready for review @stuartmorgan @hellohuanlin and @bparrishMines for anyone who wants to give it a look

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

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

reviewed the ios part

@unknown-undefined
Copy link
Contributor

unknown-undefined commented Mar 27, 2024

It appears there could be a bug within the Objective-C generator in c55a91673d7b. Specifically, the issue involves the messageChannelSuffix being repeatedly modified in the generated code. Initially, it's changed to .messageChannelSuffix, but with subsequent generations, an additional dot is prepended each time, leading to ..messageChannelSuffix, then ...messageChannelSuffix, and so on, eventually resulting in .......messageChannelSuffix.

  {
      messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @"";
    FlutterBasicMessageChannel *channel =
      [[FlutterBasicMessageChannel alloc]
        initWithName:[NSString stringWithFormat:@"%@%@", @"SDK.joinChannel", messageChannelSuffix]
        binaryMessenger:binaryMessenger
        codec:SDKGetCodec()];
   ...
  }
  {
      messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @"";
...

@tarrinneal
Copy link
Contributor Author

It appears there could be a bug within the Objective-C generator in c55a91673d7b. Specifically, the issue involves the messageChannelSuffix being repeatedly modified in the generated code. Initially, it's changed to .messageChannelSuffix, but with subsequent generations, an additional dot is prepended each time, leading to ..messageChannelSuffix, then ...messageChannelSuffix, and so on, eventually resulting in .......messageChannelSuffix.

  {
      messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @"";
    FlutterBasicMessageChannel *channel =
      [[FlutterBasicMessageChannel alloc]
        initWithName:[NSString stringWithFormat:@"%@%@", @"SDK.joinChannel", messageChannelSuffix]
        binaryMessenger:binaryMessenger
        codec:SDKGetCodec()];
   ...
  }
  {
      messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @"";
...

I don't think this was an issue, but I was already planning on changing it anyway (and have).

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM

@tarrinneal tarrinneal force-pushed the pigeon-channel-name-suffix branch from 1573ada to d72368f Compare April 2, 2024 17:11
@tarrinneal
Copy link
Contributor Author

Not entirely sure why the format tests are failing like this. The code is formatted correctly. If go back and update the code to the "asked for" style, the formatter reverts it. @stuartmorgan

@stuartmorgan-g
Copy link
Contributor

Could be a difference in local vs bot clang-format version. The real fix is to remove the stray semicolon from the ends of those two lines though, then it'll be both correct and consistent :)

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 3, 2024
@auto-submit auto-submit bot merged commit 0f14d4f into flutter:main Apr 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 4, 2024
flutter/packages@0e848fa...dce6f0c

2024-04-04 49699333+dependabot[bot]@users.noreply.github.com Bump lewagon/wait-on-check-action from 1.3.3 to 1.3.4 (flutter/packages#6459)
2024-04-03 [email protected] [pigeon] Allow multi instance support with message channel name suffix (flutter/packages#6224)
2024-04-03 [email protected] [Tool] Add ability to check dependencies independently of dev-dependencies, exclude integration_test from dependencies (flutter/packages#6446)
2024-04-03 [email protected] Roll Flutter from a418568 to e868e2b (34 revisions) (flutter/packages#6455)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
flutter/packages@0e848fa...dce6f0c

2024-04-04 49699333+dependabot[bot]@users.noreply.github.com Bump lewagon/wait-on-check-action from 1.3.3 to 1.3.4 (flutter/packages#6459)
2024-04-03 [email protected] [pigeon] Allow multi instance support with message channel name suffix (flutter/packages#6224)
2024-04-03 [email protected] [Tool] Add ability to check dependencies independently of dev-dependencies, exclude integration_test from dependencies (flutter/packages#6446)
2024-04-03 [email protected] Roll Flutter from a418568 to e868e2b (34 revisions) (flutter/packages#6455)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
flutter#6224)

Adds the ability to instantiate any api using a suffix string to allow for unique instances. 

partial flutter/flutter#66710
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
flutter#6224)

Adds the ability to instantiate any api using a suffix string to allow for unique instances. 

partial flutter/flutter#66710
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.

5 participants