[flutter_tools] Add support for custom devices#78113
[flutter_tools] Add support for custom devices#78113fluttergithubbot merged 23 commits intoflutter:masterfrom
Conversation
|
In hindsight, I think it may be better to just define a |
jonahwilliams
left a comment
There was a problem hiding this comment.
Just took a first pass - overall looks good. We might need to think a bit about stabilization too. Not sure what your thoughts are there
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
|
okay, should all be resolved now.
With stabilization, do you mean like API (or generally, interface) stability or making sure everything runs nice and stable? |
|
Sort of both. I think we can say initially that we can change this at any version to give time to shake things out, and in the meantime keep it enabled only for master/dev. Any concerns with that? |
packages/flutter_tools/lib/src/custom_devices/custom_devices_config.dart
Outdated
Show resolved
Hide resolved
Sure. Yeah it'd be nice to have release support too. Maybe when implementing that we'll have to make some other breaking changes. (Though it'd also require official engine binaries for linux ARMv7, so it may take some time till that can be implemented) I'm still probably going to create a fork and backport it to stable just so I can use it on stable myself |
|
It would help if we had a list of features that are incomplete, then maybe that could be the guidelines for a stable feature? |
Yep that's a good idea. So should we create a new GH project for that? Or a google doc? |
|
Either works for me, GH project might be a bit easier to manage though |
GH project sounds good to me. Can create some issues that you can add to the project (can't create the project myself of course). First one is here already.
Created an issue for this: #78644 (Seems like you've already seen it). Though this doesn't need to be implemented in this PR since it's not blocking anything and can be easily changed later |
|
This also resolves #78644 now |
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_devices_config.dart
Outdated
Show resolved
Hide resolved
jonahwilliams
left a comment
There was a problem hiding this comment.
Took another pass, this looks really good so far
|
My bad I didn't mean to approve yet, but its close! |
nice! 😄 |
- add tests for custom device workflow - add tests for custom device port forwarding - add tests for custom device app starting / stopping - add tests for custom device app installing / uninstalling - split config into custom_devices_config.dart and custom_device_config.dart, so at least the CustomDeviceConfig can stay null-safe - make CustomDevicesConfig non-null-safe since it relies on other non-null-safe stuff - change JSON schema URI to refer to the stable branch - fix other warnings - use processManager.killPid instead of process.kill, since thats not compatible with testing
Co-authored-by: Jonah Williams <[email protected]>
- formatting - custom devices feature flag details - set custom_devices.schema.json schema id to the stable one - add "regex" format to the forwardPortSuccessRegex property in the schema
- add `PlatformType.custom` - make CustomDevices use `PlatformType.custom` - make daemon report custom devices are always supported if custom devices feature is enabled
Co-authored-by: Jonah Williams <[email protected]>
- use @VisibleForTesting - use whenComplete - dont use `else` when the if returns unconditionally - improve spacing - add a comment explaining some order of things
- don't store custom devices config in context - add optional ping success regex in config (by default will look for 'ms TTL=' in ping command output) - add end-to-end test for custom devices - make sure ports are unforwarded when app is terminated - implicitly ensure the custom devices config file exists in the constructor rather than when invoking a separate method - fix some formatting
…m_device_test.dart Co-authored-by: Jonah Williams <[email protected]>
…m_device_workflow_test.dart Co-authored-by: Jonah Williams <[email protected]>
- create FakeBundleBuilder and use that in custom_device_test.dart instead of a MockBundleBuilder - make default JSON schema for custom devices config a file URI, pointing to the schema inside the flutter install - use += 1 instead of ++ - await unforwarding in CustomDevicePortForwarder.dispose
Nice! fixed the conflicts |
|
Awesome, will land once tests pass and the build is green again |
added a feature flag that allows enabling / disabling the custom devices feature
add a config file in the default flutter config location (for windows,
%APPDATA%/.flutter_custom_devices.json).the config file is created with the
$schematag and some (disabled) example device configured each time any flutter command is run when the custom devices feature is enabled.the
schematag points tohttps://raw.githubusercontent.com/flutter/flutter/stable/packages/flutter_tools/static/custom-devices.schema.jsonso we get autocompletion. (EDIT: Changed it to stable. Probably better that way, it'll probably confuse people if they get autocorrection for features that aren't yet implemented in stable. If people do want to get autocompletion for master channel features they can just change the URL)added a
CustomDevicesConfigclass for querying the currently configured custom devices (withCustomDeviceConfigrepresenting a specific device config)added string interpolation to
utils.dart(used for replacing things like${hostPort}in the custom device commands)added some testing
did some manual testing and it seems at least the VS Code plugin needs the
linux-desktopflag (plus the custom devices flag) enabled to even list any custom devices. not sure whats up with thatalso made protocol discovery not assert a loopback address since some people may not use port forwarding
by default the target platform is
linux_arm64(doesn't matter anyway since we're only building platform-agnostic stuff rn), didn't want to add a new target platform since that's probably a bigger breaking changethere's a TODO item in the code to make the target platform configurable in the future
resolves Custom device types as a solution for custom embedder support for flutter run #65067
Pre-launch Checklist
///).It's probably better to add some more testing, for example forCustomDevicePortForwarder. Is there anything else I didn't notice I should also test?Some tests don't pass on my local machine but they seem unrelated to anything I've written. For example the
analyze_oncetest fails, because the error message isn't the expected one, orcommands.shard\hermetic\run_test.dartbc it tries to access the flutter artifacts dir atC:\C:\Users\hanne\devel\flutter_sdk\bin\cache\artifactswhich clearly isn't the right syntax. Maybe it's because I'm on Windows?EDIT: Added all the tests. Edited schema URL.