Skip to content

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

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
tarrinneal:pigeon-channel-name-suffix
Apr 3, 2024
Merged

[pigeon] Allow multi instance support with message channel name suffix#6224
auto-submit[bot] merged 2 commits into
flutter:mainfrom
tarrinneal:pigeon-channel-name-suffix

Conversation

@tarrinneal

@tarrinnealtarrinneal commented Feb 29, 2024

Copy link
Copy Markdown
Contributor

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
tarrinnealforce-pushed the pigeon-channel-name-suffix branch 3 times, most recently from 84d3c99 to debb5e5CompareMarch 1, 2024 00:56
@tarrinneal
tarrinnealforce-pushed the pigeon-channel-name-suffix branch from f2e8aba to 8705947CompareMarch 7, 2024 23:30
@tarrinnealtarrinneal changed the title [pigeon] channel name suffix[pigeon] Allow multi instance support with message channel name suffixMar 7, 2024
@tarrinneal
tarrinnealforce-pushed the pigeon-channel-name-suffix branch from 8705947 to 90a1269CompareMarch 7, 2024 23:59
@tarrinneal
tarrinneal marked this pull request as ready for review March 7, 2024 23:59
@tarrinneal
tarrinnealforce-pushed the pigeon-channel-name-suffix branch 2 times, most recently from 93e299d to 65d0acfCompareMarch 12, 2024 04:11

@stuartmorgan-gstuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment threadpackages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp Outdated
Comment threadpackages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp Outdated
Comment threadpackages/pigeon/lib/cpp_generator.dart Outdated
Comment threadpackages/pigeon/lib/cpp_generator.dart Outdated
Comment threadpackages/pigeon/example/app/macos/Runner/messages.g.m Outdated
Comment threadpackages/pigeon/example/app/macos/Runner/messages.g.h Outdated
Comment threadpackages/pigeon/lib/dart_generator.dart Outdated
@tarrinneal

Copy link
Copy Markdown
ContributorAuthor

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

@hellohuanlinhellohuanlin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reviewed the ios part

Comment threadpackages/pigeon/example/app/ios/Runner/Messages.g.swift Outdated
Comment threadpackages/pigeon/example/app/ios/Runner/Messages.g.swift Outdated
Comment threadpackages/pigeon/example/app/macos/Runner/messages.g.h Outdated
Comment threadpackages/pigeon/example/app/macos/Runner/messages.g.m Outdated
Comment threadpackages/pigeon/example/app/macos/Runner/messages.g.m Outdated
Comment threadpackages/pigeon/lib/dart_generator.dart Outdated
Comment threadpackages/pigeon/lib/dart_generator.dart Outdated
Comment threadpackages/pigeon/lib/dart_generator.dart Outdated
@unknown-undefined

unknown-undefined commented Mar 27, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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).

@bparrishMinesbparrishMines left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tarrinneal
tarrinnealforce-pushed the pigeon-channel-name-suffix branch from 1573ada to d72368fCompareApril 2, 2024 17:11
@tarrinneal

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Collaborator

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 :)

@stuartmorgan-gstuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@tarrinnealtarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 3, 2024
@auto-submit
auto-submitBot merged commit 0f14d4f into flutter:mainApr 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2024
auto-submitBot 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 tarrinneal@gmail.com [pigeon] Allow multi instance support with message channel name suffix (flutter/packages#6224)
2024-04-03 reidbaker@google.com [Tool] Add ability to check dependencies independently of dev-dependencies, exclude integration_test from dependencies (flutter/packages#6446)
2024-04-03 engine-flutter-autoroll@skia.org 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 flutter-ecosystem@google.com,rmistry@google.com 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 tarrinneal@gmail.com [pigeon] Allow multi instance support with message channel name suffix (flutter/packages#6224)
2024-04-03 reidbaker@google.com [Tool] Add ability to check dependencies independently of dev-dependencies, exclude integration_test from dependencies (flutter/packages#6446)
2024-04-03 engine-flutter-autoroll@skia.org 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 flutter-ecosystem@google.com,rmistry@google.com 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
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
flutter#6224)
Adds the ability to instantiate any api using a suffix string to allow for unique instances. partial flutter/flutter#66710
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit Appp: pigeonplatform-androidplatform-iosplatform-macosplatform-windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@tarrinneal@unknown-undefined@stuartmorgan-g@bparrishMines@hellohuanlin