Skip to content

Conversation

@LouiseHsu
Copy link
Contributor

@LouiseHsu LouiseHsu commented Jan 17, 2024

Addresses #141290 by allow Mac Designed For IPad Devices to appear with 'flutter devices'.

Screenshot 2024-01-29 at 12 23 24 AM Screenshot 2024-01-29 at 12 26 01 AM

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.

@github-actions github-actions bot added tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop labels Jan 17, 2024
@LouiseHsu LouiseHsu changed the title show macdesignedforipad in devices Show Mac Designed For iPad in 'flutter devices' Jan 17, 2024
@LouiseHsu LouiseHsu marked this pull request as ready for review January 23, 2024 23:28
@LouiseHsu LouiseHsu requested a review from jmagman January 23, 2024 23:28
Co-authored-by: Jenn Magder <[email protected]>
throwToolExit(null);
}

if (devices!.any((Device device) => device is MacOSDesignedForIPadDevice)) {
Copy link
Member

@jmagman jmagman Jan 26, 2024

Choose a reason for hiding this comment

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

Okay I see now, I led you astray, this breaks the flutter run -d all target that runs on all eligible devices (-d all doesn't work for drive or attach):

$ flutter run -d all
Checking for wireless devices...
Mac Designed for iPad is currently not supported for flutter run -d.

and then it tool exits.
However with what you had before this commit, where it just checks if one is selected, it tries to launch and fails:

Launching lib/main.dart on Mac Designed for iPad in debug mode...
...
[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
Installing and launching...                                        22.9s

Oops; flutter has exited unexpectedly: "UnimplementedError: Building for "Mac Designed for iPad" is not supported.".
UnimplementedError: UnimplementedError: Building for "Mac Designed for iPad" is not supported.

#0      MacOSDesignedForIPadDevice.startApp (package:flutter_tools/src/macos/macos_ipad_device.dart:74:5)
#1      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:465:55)
<asynchronous suspension>
#2      HotRunner.run.<anonymous closure> (package:flutter_tools/src/run_hot.dart:440:14)
<asynchronous suspension>
#3      Future.wait.<anonymous closure> (dart:async/future.dart:518:21)
<asynchronous suspension>
#4      HotRunner.run (package:flutter_tools/src/run_hot.dart:471:34)
<asynchronous suspension>
#5      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:812:27)
<asynchronous suspension>
#6      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1398:27)
<asynchronous suspension>
#7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#9      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:355:9)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#11     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:295:5)
<asynchronous suspension>
#12     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:119:9)
<asynchronous suspension>

Instead, you could revert to the check you had before this commit where if there's only one selected and it's MacOSDesignedForIPadDevice then toolExit. And then after that check globals.deviceManager!.hasSpecifiedAllDevices and remove the MacOSDesignedForIPadDevice device from the devices property. Does that make sense?

Copy link
Member

@jmagman jmagman Jan 26, 2024

Choose a reason for hiding this comment

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

This still doesn't work, you need to first check -d mac-designed-for-ipad and fail with a reasonable error, so it doesn't just say "No supported devices found with name or id matching 'mac-designed-for-ipad'" or whatever it would say. So you should make this something like what you had before

Suggested change
if (devices!.any((Device device) => device is MacOSDesignedForIPadDevice)) {
if (devices!.length == 1 && devices!.first is! MacOSDesignedForIPadDevice) {

And then the hasSpecifiedAllDevices case you have below will filter out the all scenario.
To test this flutter create a new project then run flutter run -d all.

Copy link
Contributor Author

@LouiseHsu LouiseHsu Jan 29, 2024

Choose a reason for hiding this comment

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

Ah. For some reason it did not connect in my brain that run -d all should still run on all the other devices lol

throwToolExit('Mac Designed for iPad is currently not supported for flutter run -d.');
}

if (globals.deviceManager!.hasSpecifiedAllDevices) {
Copy link
Member

Choose a reason for hiding this comment

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

This could use a test.

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

LGTM with nit!

Comment on lines 292 to 293
expect(command.devices?.length, 1);
expect(command.devices?.first.id , 'fake_device');
Copy link
Member

Choose a reason for hiding this comment

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

single will throw if there's more than one in the iterable.

Suggested change
expect(command.devices?.length, 1);
expect(command.devices?.first.id , 'fake_device');
expect(command.devices?.single.id , 'fake_device');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh fun!! i had no idea that existed

@LouiseHsu LouiseHsu added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 31, 2024
@auto-submit auto-submit bot merged commit 4231780 into flutter:master Jan 31, 2024
@XilaiZhang XilaiZhang added the cp: beta cherry pick this pull request to beta release candidate branch label Jan 31, 2024
flutteractionsbot pushed a commit to flutteractionsbot/flutter that referenced this pull request Jan 31, 2024
@XilaiZhang XilaiZhang removed the cp: beta cherry pick this pull request to beta release candidate branch label Jan 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 1, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 1, 2024
Manual roll Flutter from c65ab4d to e02e207 (38 revisions)

Manual roll requested by [email protected]

flutter/flutter@c65ab4d...e02e207

2024-02-01 [email protected] Roll Flutter Engine from f4fbabf1eb9f to 68943afd62d1 (9 revisions) (flutter/flutter#142690)
2024-02-01 [email protected] Introduce tone-based surfaces and accent color add-ons - Part 1 (flutter/flutter#142654)
2024-02-01 [email protected] improve error message when `--base-href` argument does not start with `/` (flutter/flutter#142667)
2024-02-01 [email protected] Roll Flutter Engine from c4247c5e31ba to f4fbabf1eb9f (1 revision) (flutter/flutter#142675)
2024-02-01 [email protected] Roll Flutter Engine from c83617eee093 to c4247c5e31ba (3 revisions) (flutter/flutter#142662)
2024-02-01 [email protected] [Impeller] opt vulkan tests into GPU tracing. (flutter/flutter#142649)
2024-02-01 [email protected] Convert button `.icon` and `.tonalIcon` constructors to take nullable icons. (flutter/flutter#142644)
2024-02-01 [email protected] Fix token usages on Regular Chip and Action Chip (flutter/flutter#141701)
2024-02-01 [email protected] Added ButtonStyle.foregroundBuilder and ButtonStyle.backgroundBuilder (flutter/flutter#141818)
2024-01-31 [email protected] Roll Flutter Engine from 5b89189b8b5f to c83617eee093 (2 revisions) (flutter/flutter#142656)
2024-01-31 [email protected] [flutter_tools] add debugging to ios/core_devices.dart (flutter/flutter#142187)
2024-01-31 [email protected] Fix showDialog docs (flutter/flutter#142458)
2024-01-31 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 5.0.2 to 6.0.0 (flutter/flutter#142650)
2024-01-31 [email protected] Roll Flutter Engine from 20e53614c16c to 5b89189b8b5f (2 revisions) (flutter/flutter#142640)
2024-01-31 [email protected] Refactor ShaderTarget to not explicitly mention impeller or Skia (flutter/flutter#141460)
2024-01-31 [email protected] Roll Flutter Engine from 9ccd81d7595b to 20e53614c16c (3 revisions) (flutter/flutter#142628)
2024-01-31 [email protected] Show Mac Designed For iPad in 'flutter devices' (flutter/flutter#141718)
2024-01-31 [email protected] Marks Mac_arm64_ios basic_material_app_ios__compile to be unflaky (flutter/flutter#142594)
2024-01-31 [email protected] Fix ParentDataWidget crash for  multi view scenarios (flutter/flutter#142486)
2024-01-31 [email protected] Roll Flutter Engine from e0d8f472a1b6 to 9ccd81d7595b (1 revision) (flutter/flutter#142625)
2024-01-31 [email protected] Marks Mac_arm64 tool_tests_commands to be unflaky (flutter/flutter#142593)
2024-01-31 [email protected] "System back gesture" explanation (flutter/flutter#142254)
2024-01-31 [email protected] Marks Mac_x64 tool_tests_commands to be unflaky (flutter/flutter#142592)
2024-01-31 [email protected] Marks Mac_x64_ios integration_test_test_ios to be unflaky (flutter/flutter#142595)
2024-01-31 [email protected] Marks Mac_x64 native_ui_tests_macos to be unflaky (flutter/flutter#142598)
2024-01-31 [email protected] Marks Mac_x64_ios hot_mode_dev_cycle_ios__benchmark to be unflaky (flutter/flutter#142597)
2024-01-31 [email protected] Marks Mac_arm64 native_ui_tests_macos to be unflaky (flutter/flutter#142599)
2024-01-31 [email protected] Marks Windows_android hot_mode_dev_cycle_win__benchmark to be flaky (flutter/flutter#142609)
2024-01-31 [email protected] Marks Mac_arm64_ios integration_test_test_ios to be unflaky (flutter/flutter#142596)
2024-01-31 [email protected] Mark test that leaks image. (flutter/flutter#142539)
2024-01-31 [email protected] Roll Flutter Engine from b9bc256156b8 to e0d8f472a1b6 (1 revision) (flutter/flutter#142623)
2024-01-31 [email protected] Fix unresponsive mouse tooltip (flutter/flutter#142282)
2024-01-31 [email protected] Marks Linux_android_emu android_defines_test to be unflaky (flutter/flutter#142591)
2024-01-31 [email protected] Roll Flutter Engine from 447dd212447e to b9bc256156b8 (6 revisions) (flutter/flutter#142617)
2024-01-31 [email protected] Roll Packages from 25abb5d to 5b48c44 (4 revisions) (flutter/flutter#142616)
2024-01-31 [email protected] Fix null operator error when tapping on 'MenuItemButton' (flutter/flutter#142230)
2024-01-31 [email protected] Roll Flutter Engine from 8e7df85f7d11 to 447dd212447e (2 revisions) (flutter/flutter#142587)
2024-01-31 [email protected] Split out AppBar/SliverAppBar material tests (flutter/flutter#142560)

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
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants