devtools/madb: apply the recent changes in the flutter command line tool.
* "madb install" now calls "flutter install" if applicable.
* "flutter start" -> "flutter run"
* --android-device-id -> --device-id
Change-Id: Ic976190053e6cb2bd9a3a0061ec95bc756ab92b2
diff --git a/madb/doc.go b/madb/doc.go
index ecd2329..e287c42 100644
--- a/madb/doc.go
+++ b/madb/doc.go
@@ -334,8 +334,8 @@
launch, based on the build scripts found in the current working directory.
1) If the working directory contains a Flutter project (i.e., has
-"flutter.yaml"), this command will run "flutter start
---android-device-id=<device serial>" for all the specified devices.
+"flutter.yaml"), this command will run "flutter start --device-id <device
+serial>" for all the specified devices.
2) If the working directory contains a Gradle Android project (i.e., has
"build.gradle"), this command will run a small Gradle script to extract the
@@ -389,7 +389,7 @@
to stop, based on the build scripts found in the current working directory.
1) If the working directory contains a Flutter project (i.e., has
-"flutter.yaml"), this command will run "flutter stop --android-device-id=<device
+"flutter.yaml"), this command will run "flutter stop --device-id <device
serial>" for all the specified devices.
2) If the working directory contains a Gradle Android project (i.e., has
diff --git a/madb/install.go b/madb/install.go
index 133e430..b9cfc11 100644
--- a/madb/install.go
+++ b/madb/install.go
@@ -78,9 +78,10 @@
return runGoshCommandForDevice(cmd, d, true)
}
- // TOOD(youngseokyoon): support Flutter projects.
if isFlutterProject(wd) {
- return fmt.Errorf("Not implemented for flutter yet.")
+ cmdArgs := []string{"install", "--device-id", d.Serial}
+ cmd := sh.Cmd("flutter", cmdArgs...)
+ return runGoshCommandForDevice(cmd, d, false)
}
return fmt.Errorf("Could not find the target app to be installed. Try running 'madb install' from a Gradle or Flutter project directory.")
diff --git a/madb/start.go b/madb/start.go
index e724b1d..db30631 100644
--- a/madb/start.go
+++ b/madb/start.go
@@ -48,7 +48,7 @@
scripts found in the current working directory.
1) If the working directory contains a Flutter project (i.e., has "flutter.yaml"), this command will
-run "flutter start --android-device-id=<device serial>" for all the specified devices.
+run "flutter start --device-id <device serial>" for all the specified devices.
2) If the working directory contains a Gradle Android project (i.e., has "build.gradle"), this
command will run a small Gradle script to extract the application ID and the main activity name.
@@ -95,9 +95,9 @@
}
// In case of flutter, the application ID is not even needed.
- // Simply run "flutter start --android-device-id <device_serial>" on all devices.
+ // Simply run "flutter run --device-id <device_serial>" on all devices.
if isFlutterProject(wd) {
- cmdArgs := []string{"start", "--android-device-id", d.Serial}
+ cmdArgs := []string{"run", "--device-id", d.Serial}
cmd := sh.Cmd("flutter", cmdArgs...)
return runGoshCommandForDevice(cmd, d, false)
}
diff --git a/madb/stop.go b/madb/stop.go
index 4cabfbd..cdec886 100644
--- a/madb/stop.go
+++ b/madb/stop.go
@@ -36,7 +36,7 @@
the build scripts found in the current working directory.
1) If the working directory contains a Flutter project (i.e., has "flutter.yaml"), this command will
-run "flutter stop --android-device-id=<device serial>" for all the specified devices.
+run "flutter stop --device-id <device serial>" for all the specified devices.
2) If the working directory contains a Gradle Android project (i.e., has "build.gradle"), run a
small Gradle script to extract the application ID. In this case, the extracted ID is cached, so
@@ -72,9 +72,9 @@
}
// In case of flutter, the application ID is not even needed.
- // Simply run "flutter stop --android-device-id <device_serial>" on all devices.
+ // Simply run "flutter stop --device-id <device_serial>" on all devices.
if isFlutterProject(wd) {
- cmdArgs := []string{"stop", "--android-device-id", d.Serial}
+ cmdArgs := []string{"stop", "--device-id", d.Serial}
cmd := sh.Cmd("flutter", cmdArgs...)
return runGoshCommandForDevice(cmd, d, false)
}