Skip to content
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

Replace waiting for android emulator with a sleep and a list device call to verify emulator is running #4261

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/android/javalib/1-hello-world/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ object app extends AndroidAppModule {

> ./mill show app.startAndroidEmulator

> ./mill show app.waitForDevice
...emulator-5554...
> sleep 20 && ./mill show app.adbDevices
...emulator-5554...device...

> ./mill show app.it | grep '"OK (1 test)"'
..."OK (1 test)",
Expand Down
8 changes: 4 additions & 4 deletions example/android/kotlinlib/1-hello-kotlin/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ object app extends AndroidAppKotlinModule {

> ./mill app.createAndroidVirtualDevice

> sleep 60 && ./mill show app.startAndroidEmulator
> ./mill show app.startAndroidEmulator

> ./mill show app.waitForDevice
...emulator-5556...
> sleep 20 && ./mill show app.adbDevices
...emulator-5556...device...

> ./mill show app.it | grep '"OK (1 test)"'
..."OK (1 test)",
..."OK (1 test)",

> cat out/app/it/test.json | grep '"OK (1 test)"'
..."OK (1 test)"...
Expand Down
8 changes: 6 additions & 2 deletions scalalib/src/mill/javalib/android/AndroidAppModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ trait AndroidAppModule extends JavaModule {
*
* @return The log line that indicates the emulator is ready
*/
def startAndroidEmulator: T[Option[String]] = Task {
def startAndroidEmulator: T[String] = Task {
val ciSettings = Seq(
"-no-snapshot-save",
"-no-window",
Expand Down Expand Up @@ -848,7 +848,11 @@ trait AndroidAppModule extends JavaModule {

T.log.info(s"Emulator started with message $bootMessage")

bootMessage
bootMessage.get
}

def adbDevices: T[String] = Task {
os.call((androidSdkModule().adbPath().path, "devices", "-l")).out.text()
}

def waitForDevice: Target[String] = Task {
Expand Down
Loading