-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Add Designed for iPad attach destination for ARM macOS #84411
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
Conversation
| /// Set to show ARM macOS as an iOS device target. | ||
| static bool allowDiscovery = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't figure out a non-global way to set this (modeled on FlutterTesterDevices.showFlutterTesterDevice). I tried to make it a property on a context override on IOSWorkflow but I would have needed to set it the context override only for the attach command in:
flutter/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
Lines 232 to 235 in e7b7ebc
| await context.run<void>( | |
| overrides: contextOverrides.map<Type, Generator>((Type type, dynamic value) { | |
| return MapEntry<Type, Generator>(type, () => value); | |
| }), |
and
flutter/packages/flutter_tools/lib/src/commands/attach.dart
Lines 178 to 179 in 80668d2
| Future<void> validateCommand() async { | |
| await super.validateCommand(); |
and
flutter/packages/flutter_tools/lib/src/commands/attach.dart
Lines 210 to 213 in 80668d2
| Future<FlutterCommandResult> runCommand() async { | |
| await _validateArguments(); | |
| final Device device = await findTargetDevice(); |
Welcome suggestions to make this better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static is fine, please no more context overrides
| tearDown(() { | ||
| MacOSDesignedForIPadDevices.allowDiscovery = false; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See allowDiscovery global comment. It's similar to:
flutter/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart
Lines 43 to 46 in 6beafa7
| group('FlutterTesterDevices', () { | |
| tearDown(() { | |
| FlutterTesterDevices.showFlutterTesterDevice = false; | |
| }); |
|
Heads up that I won't have a chance to look at this today since I'm heading out early, but I will take a look first thing monday |
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@jmagman Just curious if attaching from vscode would work too? |
|
Managed to get it to work in vscode with the following config: // (launch.json)
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach: Design for iPad",
"request": "attach",
"type": "dart",
"program": "lib/main.dart",
"args": [
"--app-id",
"com.example"
],
"deviceId": "designed-for-ipad",
}
]
} |
Add a new

MacOSDesignedForIPadDevicedevice to target when running native ARM iOS apps on Apple Silicon macOS. I called this "Mac Designed for iPad" based on the Xcode target name, since there doesn't seem to be a pithy marketing name for this feature.It only supports
flutter attaching to iOS apps already launched from Xcode, per guidance from product leadership so as not to confuse the desktop macOS development story.The running apps are discovered via mDNS.

It's like a desktop device for log reading/port purposes. It's like an iOS device in that it's only supported for apps with an

iosproject directory. IfstartApp,buildApp, etc are ever implemented in a future PR, it will have to create the right structured bundle out of the iOS app.Also create
MacOSDesignedForIPadDevicesdevice discovery that will only return this new device type if on an ARM Mac, and iOS is supported (Xcode is installed, etc).flutter devicesdoes not show this device type:However when I
flutter attach:And it's actually attached:
https://user-images.githubusercontent.com/682784/121634738-f78b9a00-ca39-11eb-9a25-b53f16dd2cda.mov
Will try to figure out a way to integration test this once #79430 is done.
flutter attachpart of #66184