flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.19k stars 27.26k forks source link

Support `flutter run` and `flutter drive` for `Mac Designed for iPad` apps on arm64 Macs #141328

Open jmagman opened 8 months ago

jmagman commented 8 months ago

Once Mac Designed for iPad are discoverable https://github.com/flutter/flutter/issues/141290 implement flutter run and flutter drive on these devices.

We originally didn't allow flutter run to avoid confusion with macOS-proper development when that platform was not yet in stable (see comment in https://github.com/flutter/flutter/pull/84411). Now that macOS development has been in stable for awhile, and arm64 Macs are far more prevalent, let's enable this to make it easier for developers to debug their app in whatever way Apple supports.

Test as many as the run and drive flags as possible. If any of them don't make sense for Mac Designed for iPad throw a toolExit() in the respective validateCommand() methods so it just fails instead of doing some weird behavior. https://github.com/flutter/flutter/blob/d1f3ae73eb21187220a9498665352a63b9a547e7/packages/flutter_tools/lib/src/commands/run.dart#L583 https://github.com/flutter/flutter/blob/d1f3ae73eb21187220a9498665352a63b9a547e7/packages/flutter_tools/lib/src/commands/drive.dart#L220

Once implemented, validate it works from the IDE GUI.

Part of https://github.com/flutter/flutter/issues/125741

jmagman commented 8 months ago
  1. Support building the app: https://github.com/flutter/flutter/blob/eff2e7dbb180964f47606dd9b2b46c566de5c6c6/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart#L84-L91

This will probably look almost identical to building an iOS app and can share the same logic.

https://github.com/flutter/flutter/blob/eff2e7dbb180964f47606dd9b2b46c566de5c6c6/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart#L63-L75

I suspect we can use the DesktopDevice super class implementation of these just by telling flutter where the executable is since it will run like a desktop app: https://github.com/flutter/flutter/blob/eff2e7dbb180964f47606dd9b2b46c566de5c6c6/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart#L60 From Xcode it's building the into path/to/deriveddata/Build/Products/Debug-iphoneos/.XCInstall/Test Create.app

$ ll -R /Users/m/Library/Developer/Xcode/DerivedData/Runner-gnengnkipgqsumexkvwkdczgvrst/Build/Products/Debug-iphoneos/.XCInstall/Test\ Create.app
total 0
drwxr-xr-x@ 4 m  primarygroup  128 Jan  9 15:57 .
drwxr-xr-x  9 m  primarygroup  288 Jan 10 09:49 ..
lrw-r--r--  1 m  primarygroup   18 Jan  9 15:57 WrappedBundle -> Wrapper/Runner.app
drwxr-xr-x  4 m  primarygroup  128 Jan  9 15:57 Wrapper

/Users/m/Library/Developer/Xcode/DerivedData/Runner-gnengnkipgqsumexkvwkdczgvrst/Build/Products/Debug-iphoneos/.XCInstall/Test Create.app/Wrapper:
total 8
drwxr-xr-x   4 m  primarygroup  128 Jan  9 15:57 .
drwxr-xr-x@  4 m  primarygroup  128 Jan  9 15:57 ..
-rw-r--r--   1 m  primarygroup  618 Jan  9 15:57 BundleMetadata.plist
drwxr-xr-x  13 m  primarygroup  416 Jan  9 15:57 Runner.app

Where Runner.app looks a lot (identical to?) an iOS app. Hopefully there's some xcodebuild -destination we can use to have Xcode build that bundle for us.

flutter-triage-bot[bot] commented 8 months ago

This issue is missing a priority label. Please set a priority label when adding the triaged-ios label.

flutter-triage-bot[bot] commented 4 months ago

This issue is assigned to @LouiseHsu but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

TobiasHeidingsfeld commented 4 months ago

With Flutter 3.22 the devices shows up in VS Code but running it only gives Mac Designed for iPad is currently not supported for flutter run -d. any update on this?

flutter-triage-bot[bot] commented 2 months ago

This issue was assigned to @LouiseHsu but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.