Add --machine support for flutter attach (#19077)
* Extract some of startApp into a reusable method * Get basic attach --machine working * Attach --machine tweaks Move validation to validate method and create daemon early so we get the startup event before trying to get a connection. * Bump daemon version so we know whether it's valid to flutter attach * Tweak output text * Swap package imports for relative * Review tweaks (naming, formatting, typedefs) * Separate arguments from process spawning This will make calling attach easier * Add a basic test for flutter attach --machine * Fix crash if port unforward modifies the list of forwarded ports * Add a no-op port forwarder for flutter-tester * Switch to using BasicProject instead of our own inline code * Fix expectation in test now we have a portForwarder * Remove stale TODO (this is done) * Tweak formatting * Change some Completers to void to fix Dart 2 issues
This commit is contained in:
@@ -10,7 +10,7 @@ flutter daemon
|
||||
|
||||
It runs a persistent, JSON-RPC based server to communicate with devices. IDEs and other tools can start the flutter tool in this mode and get device addition and removal notifications, as well as being able to programmatically start and stop apps on those devices.
|
||||
|
||||
A set of `flutter daemon` commands/events are also exposed via `flutter run --machine` which allows IDEs and tools to launch flutter applications and interact to send commands like Hot Reload. The command and events that are available in this mode are documented at the bottom of this document.
|
||||
A set of `flutter daemon` commands/events are also exposed via `flutter run --machine` and `flutter attach --machine` which allow IDEs and tools to launch and attach to flutter applications and interact to send commands like Hot Reload. The command and events that are available in these modes are documented at the bottom of this document.
|
||||
|
||||
## Protocol
|
||||
|
||||
@@ -182,9 +182,9 @@ The returned `params` will contain:
|
||||
- `emulatorName` - the name of the emulator created; this will have been auto-generated if you did not supply one
|
||||
- `error` - when `success`=`false`, a message explaining why the creation of the emulator failed
|
||||
|
||||
## Flutter Run --machine
|
||||
## 'flutter run --machine' and 'flutter attach --machine'
|
||||
|
||||
When running `flutter run --machine` the following subset of the daemon is available:
|
||||
When running `flutter run --machine` or `flutter attach --machine` the following subset of the daemon is available:
|
||||
|
||||
### daemon domain
|
||||
|
||||
@@ -219,5 +219,6 @@ See the [source](https://github.com/flutter/flutter/blob/master/packages/flutter
|
||||
|
||||
## Changelog
|
||||
|
||||
- 0.4.1: Added `flutter attach --machine`
|
||||
- 0.4.0: Added `emulator.create` command
|
||||
- 0.3.0: Added `daemon.connected` event at startup
|
||||
|
||||
Reference in New Issue
Block a user