X Tutup
The Wayback Machine - https://web.archive.org/web/20220708184227/https://github.com/flutter/flutter/pull/106754
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

Add Windows to the platform_channels example #106754

Merged

Conversation

stuartmorgan
Copy link
Contributor

@stuartmorgan stuartmorgan commented Jun 28, 2022

Adds Windows support to the platform_channels example, implementing battery querying and charge state listening/reporting.

This is mostly flutter create boilerplate; see individual commits for actual changes.

Also fixes the license check script to check .cpp files, and fixes the new violations that found.

Part of #79204

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 Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • 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.

@flutter-dashboard flutter-dashboard bot added d: examples team labels Jun 28, 2022
@flutter-dashboard
Copy link

@flutter-dashboard flutter-dashboard bot commented Jun 28, 2022

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@stuartmorgan
Copy link
Contributor Author

@stuartmorgan stuartmorgan commented Jun 28, 2022

@cbracken @gspencergoog Do we not have any devicelab Windows tests? I noticed that hello_world still doesn't have a windows directory. I thought we had enabled one app at some point, but maybe I'm misremembering?

Ideally we'd be running the driver tests for all the examples on Windows, but I didn't see any place we already have that set up.

@loic-sharma
Copy link
Contributor

@loic-sharma loic-sharma commented Jun 28, 2022

Consider adding a note to the example's README about Windows support: https://github.com/flutter/flutter/tree/master/examples/platform_channel#example-of-calling-platform-services-from-flutter

@stuartmorgan stuartmorgan requested a review from keyonghan as a code owner Jun 29, 2022
@@ -3968,6 +3968,20 @@ targets:
- bin/**
- .ci.yaml

- name: Windows platform_channel_sample_test_windows
Copy link
Contributor Author

@stuartmorgan stuartmorgan Jun 29, 2022

Choose a reason for hiding this comment

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

@keyonghan Does this look right? As usual with .ci.yaml changes I don't do it often enough to remember how to manually test this in advance, and since it's bringup it won't be tested here.

Copy link
Contributor

@keyonghan keyonghan Jun 29, 2022

Choose a reason for hiding this comment

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

The ci config looks good to me.
You may want to add the test ownership entry in https://github.com/flutter/flutter/blob/master/TESTOWNERS#L218 by following:

# Windows platform_channel_sample_test_windows
<path-to-test> @<owner> @<team>

Copy link
Contributor Author

@stuartmorgan stuartmorgan Jun 29, 2022

Choose a reason for hiding this comment

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

Done. I gave it to @cbracken since desktop seemed like the best fit for it, but we could adjust it to me+plugins later if it turns out to be problematic.

Copy link
Member

@cbracken cbracken Jun 30, 2022

Choose a reason for hiding this comment

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

That sgtm.

@@ -44,10 +44,11 @@ TaskFunction createExternalUiIntegrationTest() {
);
}

TaskFunction createPlatformChannelSampleTest() {
TaskFunction createPlatformChannelSampleTest({String? deviceIdOverride}) {
Copy link
Contributor Author

@stuartmorgan stuartmorgan Jun 29, 2022

Choose a reason for hiding this comment

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

This and the change below follow the pattern from #45264

@stuartmorgan
Copy link
Contributor Author

@stuartmorgan stuartmorgan commented Jun 29, 2022

@cbracken @gspencergoog Do we not have any devicelab Windows tests? I noticed that hello_world still doesn't have a windows directory. I thought we had enabled one app at some point, but maybe I'm misremembering?

Ideally we'd be running the driver tests for all the examples on Windows, but I didn't see any place we already have that set up.

I think I figured out setting this up 🤞🏻. Added to the PR.

@stuartmorgan
Copy link
Contributor Author

@stuartmorgan stuartmorgan commented Jun 29, 2022

Consider adding a note to the example's README about Windows support: https://github.com/flutter/flutter/tree/master/examples/platform_channel#example-of-calling-platform-services-from-flutter

Done.

Copy link
Contributor

@keyonghan keyonghan left a comment

Configs LGTM.

Copy link
Member

@cbracken cbracken left a comment

lgtm

@stuartmorgan
Copy link
Contributor Author

@stuartmorgan stuartmorgan commented Jun 30, 2022

While fixing the missing licenses, I noticed that it was only flagging the .h files, not the .cpp files, so I fixed the script that checks this to check cpp files (we were only getting .h because it was configured for Obj-C already). And then fixed the missing licenses in other Windows examples.

@flutter-dashboard flutter-dashboard bot added the d: api docs label Jun 30, 2022
@stuartmorgan stuartmorgan added the autosubmit label Jun 30, 2022
stuartmorgan added a commit to flutter/website that referenced this issue Jun 30, 2022
This adds a Windows section to the existing iOS and Android section, following the same structure as those examples, and using the code from flutter/flutter#106754

Part of flutter/flutter#79204
@auto-submit auto-submit bot merged commit 6c6ae06 into flutter:master Jun 30, 2022
125 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this issue Jun 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this issue Jun 30, 2022
@stuartmorgan stuartmorgan deleted the platform-channel-example-windows branch Jun 30, 2022
sfshaza2 pushed a commit to flutter/website that referenced this issue Jun 30, 2022
This adds a Windows section to the existing iOS and Android section, following the same structure as those examples, and using the code from flutter/flutter#106754

Part of flutter/flutter#79204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit d: api docs d: examples documentation team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants
X Tutup