From 3bc665032cdf0f215d4848cc264cc0cc67c9c7f3 Mon Sep 17 00:00:00 2001 From: simonschiller Date: Tue, 3 Jul 2018 09:01:28 +0200 Subject: [PATCH 1/9] Add option to keep existing avds --- .../main/kotlin/com/gojuno/swarmer/Args.kt | 12 ++++++++-- .../kotlin/com/gojuno/swarmer/Emulators.kt | 24 ++++++++++++------- .../kotlin/com/gojuno/swarmer/ArgsSpec.kt | 6 +++-- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt index 9267ee3..a16b6e4 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt @@ -119,9 +119,17 @@ sealed class Commands { names = ["--use-compat-emulator"], required = false, description = "Use old compat emulator tool. Look https://issuetracker.google.com/issues/66886035 for details. False by default.", - order = 10 + order = 11 + ) + var useCompatEmulator: Boolean = false, + + @Parameter( + names = ["--keep-existing-avds"], + required = false, + description = "Don't recreate avds if one with the same name already exists.", + order = 12 ) - var useCompatEmulator: Boolean = false + var keepExistingAvds: Boolean = false ) : Commands() diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt index 4ca96b4..35c3acc 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt @@ -194,15 +194,21 @@ private fun createAvd(args: Commands.Start): Observable { val startTime = AtomicLong() - return Observable - .merge(iDontWishToCreateCustomHardwareProfile, createAvdProcess) - .first { it is Notification.Exit } - .doOnError { log("Error during creation of avd ${args.emulatorName}, error = $it") } - .retry(3) // https://code.google.com/p/android/issues/detail?id=262719 - .map { Unit } - .doOnSubscribe { log("Creating avd ${args.emulatorName}."); startTime.set(nanoTime()) } - .doOnNext { log("Avd ${args.emulatorName} created in ${(nanoTime() - startTime.get()).nanosAsSeconds()} seconds.") } - .doOnError { log("Could not create avd ${args.emulatorName}, error = $it") } + return if (args.keepExistingAvds && File("$home/.android/avd/${args.emulatorName}.avd").exists()) { + Observable + .just(Unit) + .doOnSubscribe { log("Avd ${args.emulatorName} already exists, will not be overridden.") } + } else { + Observable + .merge(iDontWishToCreateCustomHardwareProfile, createAvdProcess) + .first { it is Notification.Exit } + .doOnError { log("Error during creation of avd ${args.emulatorName}, error = $it") } + .retry(3) // https://code.google.com/p/android/issues/detail?id=262719 + .map { Unit } + .doOnSubscribe { log("Creating avd ${args.emulatorName}."); startTime.set(nanoTime()) } + .doOnNext { log("Avd ${args.emulatorName} created in ${(nanoTime() - startTime.get()).nanosAsSeconds()} seconds.") } + .doOnError { log("Could not create avd ${args.emulatorName}, error = $it") } + } } private fun applyConfig(args: Commands.Start): Observable = Observable diff --git a/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt b/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt index 57e1be2..3d4baf9 100644 --- a/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt +++ b/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt @@ -18,7 +18,8 @@ class ArgsSpec : Spek({ "--emulator-start-options", "-prop option=value", "--emulator-start-timeout-seconds", "180", "--redirect-logcat-to", "logcat.txt", - "--verbose-emulator", "--keep-output-on-exit" + "--verbose-emulator", "--keep-output-on-exit", + "--keep-existing-avds" ) on("parse args with only required fields") { @@ -53,7 +54,8 @@ class ArgsSpec : Spek({ emulatorStartTimeoutSeconds = 180L, redirectLogcatTo = "logcat.txt", verbose = true, - keepOutputOnExit = true + keepOutputOnExit = true, + keepExistingAvds = true ))) } } From eb10a5c689ee546f44c65fc8b0138e885cfe9d69 Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Tue, 31 Jul 2018 08:36:53 +0200 Subject: [PATCH 2/9] Use "emulator -list-avds" to check for existing emulators --- .../kotlin/com/gojuno/swarmer/Emulators.kt | 49 ++++++++++++++----- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt index 35c3acc..7553953 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt @@ -194,20 +194,29 @@ private fun createAvd(args: Commands.Start): Observable { val startTime = AtomicLong() - return if (args.keepExistingAvds && File("$home/.android/avd/${args.emulatorName}.avd").exists()) { - Observable - .just(Unit) - .doOnSubscribe { log("Avd ${args.emulatorName} already exists, will not be overridden.") } + val createAvd = Observable + .merge(iDontWishToCreateCustomHardwareProfile, createAvdProcess) + .first { it is Notification.Exit } + .doOnError { log("Error during creation of avd ${args.emulatorName}, error = $it") } + .retry(3) // https://code.google.com/p/android/issues/detail?id=262719 + .map { Unit } + .doOnSubscribe { log("Creating avd ${args.emulatorName}."); startTime.set(nanoTime()) } + .doOnNext { log("Avd ${args.emulatorName} created in ${(nanoTime() - startTime.get()).nanosAsSeconds()} seconds.") } + .doOnError { log("Could not create avd ${args.emulatorName}, error = $it") } + + return if (args.keepExistingAvds) { + createdEmulators(args).flatMapObservable { + if (it.contains(args.emulatorName)) { + Observable + .just(Unit) + .doOnSubscribe { log("Avd ${args.emulatorName} already exists, will not be overridden.") } + } else { + createAvd + } + } + } else { - Observable - .merge(iDontWishToCreateCustomHardwareProfile, createAvdProcess) - .first { it is Notification.Exit } - .doOnError { log("Error during creation of avd ${args.emulatorName}, error = $it") } - .retry(3) // https://code.google.com/p/android/issues/detail?id=262719 - .map { Unit } - .doOnSubscribe { log("Creating avd ${args.emulatorName}."); startTime.set(nanoTime()) } - .doOnNext { log("Avd ${args.emulatorName} created in ${(nanoTime() - startTime.get()).nanosAsSeconds()} seconds.") } - .doOnError { log("Could not create avd ${args.emulatorName}, error = $it") } + createAvd } } @@ -340,3 +349,17 @@ private fun outputDirectory(args: Commands.Start) = private fun connectedEmulators(): Single> = connectedAdbDevices().take(1).toSingle().map { it.filter { it.isEmulator }.toSet() } + +private fun createdEmulators(args: Commands.Start, timeout: Pair = 60 to SECONDS): Single> = + process( + commandAndArgs = listOf(emulatorBinary(args), "-list-avds"), + timeout = timeout, + unbufferedOutput = true + ).ofType(Notification.Exit::class.java) + .toSingle() + .map { + it.output.readText() + .split(System.lineSeparator()) + .filter { !it.isBlank() } + .toSet() + } From d71bb82ab627935adbd67786b69e35846902a903 Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Tue, 31 Jul 2018 09:43:06 +0200 Subject: [PATCH 3/9] Fix exception if swarmer is called with 0 args --- swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt index a16b6e4..31ef34d 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt @@ -15,7 +15,7 @@ sealed class Commands { val ALIASES_START = listOf("start") val ALIASES_STOP = listOf("stop") - fun fromStringAlias(alias: String): Commands? = when { + fun fromStringAlias(alias: String?): Commands? = when { ALIASES_HELP.contains(alias) -> Help ALIASES_STOP.contains(alias) -> Stop() ALIASES_START.contains(alias) -> Start() @@ -148,7 +148,7 @@ sealed class Commands { ) : Commands() } -fun parseCommand(rawArgs: List) = Commands.fromStringAlias(rawArgs[0]) +fun parseCommand(rawArgs: List) = Commands.fromStringAlias(rawArgs.getOrNull(0)) fun parseStartArguments(rawArgs: List): List = rawArgs From 06dda0c82c5ccf2826fb8d7de52c5aea22f2e026 Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Tue, 31 Jul 2018 09:49:44 +0200 Subject: [PATCH 4/9] Add windows compatibility --- .../kotlin/com/gojuno/swarmer/Emulators.kt | 83 ++++++++++--------- .../com/gojuno/swarmer/EmulatorsSpec.kt | 24 +++--- 2 files changed, 56 insertions(+), 51 deletions(-) diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt index 7553953..df7f68f 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt @@ -1,10 +1,7 @@ package com.gojuno.swarmer import com.gojuno.commander.android.* -import com.gojuno.commander.os.Notification -import com.gojuno.commander.os.home -import com.gojuno.commander.os.log -import com.gojuno.commander.os.process +import com.gojuno.commander.os.* import rx.Completable import rx.Observable import rx.Single @@ -12,16 +9,29 @@ import rx.schedulers.Schedulers import rx.schedulers.Schedulers.io import java.io.File import java.lang.System.nanoTime +import java.util.* import java.util.concurrent.Semaphore import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit.* import java.util.concurrent.TimeoutException import java.util.concurrent.atomic.AtomicLong -val sh: String = "/bin/sh" -val avdManager: String = "$androidHome/tools/bin/avdmanager" -val emulator = "$androidHome/emulator/emulator" -val emulatorCompat = "$androidHome/tools/emulator" +val sh: List = when (os()) { + Os.Linux, Os.Mac -> listOf("/bin/sh", "-c") + Os.Windows -> listOf("cmd", "/C") +} +val avdManager: String = when (os()) { + Os.Linux, Os.Mac -> "$androidHome/tools/bin/avdmanager" + Os.Windows -> "$androidHome/tools/bin/avdmanager.bat" +} +val emulator = when (os()) { + Os.Linux, Os.Mac -> "$androidHome/emulator/emulator" + Os.Windows -> "$androidHome/emulator/emulator.exe" +} +val emulatorCompat = when (os()) { + Os.Linux, Os.Mac -> "$androidHome/tools/emulator" + Os.Windows -> "$androidHome/tools/emulator.exe" +} data class Emulator( val id: String, @@ -102,8 +112,18 @@ private fun startEmulator( .doOnNext { log("Ports for emulator ${args.emulatorName}: ${it.first}, ${it.second}.") } .flatMap { ports -> startEmulatorProcess( - // Unix only, PR welcome. - listOf(sh, "-c", "${emulator(args)} ${if (args.verbose) "-verbose" else ""} -avd ${args.emulatorName} -ports ${ports.first},${ports.second} ${args.emulatorStartOptions.joinToString(" ")} &"), + sh + + + listOf(emulator(args)) + + mutableListOf().apply { + if (args.verbose) add("-verbose") + add("-avd"); add(args.emulatorName) + add("-ports"); add("${ports.first},${ports.second}") + addAll(args.emulatorStartOptions) + } + + + , args ).let { process -> waitForEmulatorToStart(args, connectedAdbDevices, process, ports) @@ -194,7 +214,7 @@ private fun createAvd(args: Commands.Start): Observable { val startTime = AtomicLong() - val createAvd = Observable + return Observable .merge(iDontWishToCreateCustomHardwareProfile, createAvdProcess) .first { it is Notification.Exit } .doOnError { log("Error during creation of avd ${args.emulatorName}, error = $it") } @@ -203,21 +223,6 @@ private fun createAvd(args: Commands.Start): Observable { .doOnSubscribe { log("Creating avd ${args.emulatorName}."); startTime.set(nanoTime()) } .doOnNext { log("Avd ${args.emulatorName} created in ${(nanoTime() - startTime.get()).nanosAsSeconds()} seconds.") } .doOnError { log("Could not create avd ${args.emulatorName}, error = $it") } - - return if (args.keepExistingAvds) { - createdEmulators(args).flatMapObservable { - if (it.contains(args.emulatorName)) { - Observable - .just(Unit) - .doOnSubscribe { log("Avd ${args.emulatorName} already exists, will not be overridden.") } - } else { - createAvd - } - } - - } else { - createAvd - } } private fun applyConfig(args: Commands.Start): Observable = Observable @@ -350,16 +355,16 @@ private fun outputDirectory(args: Commands.Start) = private fun connectedEmulators(): Single> = connectedAdbDevices().take(1).toSingle().map { it.filter { it.isEmulator }.toSet() } -private fun createdEmulators(args: Commands.Start, timeout: Pair = 60 to SECONDS): Single> = - process( - commandAndArgs = listOf(emulatorBinary(args), "-list-avds"), - timeout = timeout, - unbufferedOutput = true - ).ofType(Notification.Exit::class.java) - .toSingle() - .map { - it.output.readText() - .split(System.lineSeparator()) - .filter { !it.isBlank() } - .toSet() - } +private fun os(): Os { + val os = System.getProperty("os.name", "unknown").toLowerCase(Locale.ENGLISH) + + return if (os.contains("mac") || os.contains("darwin")) { + Os.Mac + } else if (os.contains("linux")) { + Os.Linux + } else if (os.contains("windows")) { + Os.Windows + } else { + throw IllegalStateException("Unsupported os $os, only ${Os.values()} are supported.") + } +} diff --git a/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt b/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt index e863a08..8fe8de2 100644 --- a/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt +++ b/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt @@ -174,17 +174,17 @@ class EmulatorsSpec : Spek({ waitForEmulatorToFinishBoot = waitForEmulatorToFinishBoot ) } - - START_COMMANDS.forEach { command -> - it("should start emulators") { - verify(startEmulatorsProcess).invoke( - listOf( - "/bin/sh", "-c", - "${emulator(command)} ${if (command.verbose) "-verbose" else ""} -avd ${command.emulatorName} -ports ${EMULATOR_PORTS.first},${EMULATOR_PORTS.second} ${command.emulatorStartOptions.joinToString(" ")} &" - ), - command - ) - } - } +// todo fix tests +// START_COMMANDS.forEach { command -> +// it("should start emulators") { +// verify(startEmulatorsProcess).invoke( +// sh + +// listOf( +// "${emulator(command)} ${if (command.verbose) "-verbose" else ""} -avd ${command.emulatorName} -ports ${EMULATOR_PORTS.first},${EMULATOR_PORTS.second}" +// ), +// command +// ) +// } +// } } }) \ No newline at end of file From 2699c4a8ad48b2d22b600abf5d16f36aee6e3435 Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Tue, 31 Jul 2018 15:28:01 +0200 Subject: [PATCH 5/9] Fix emulator start command --- .../main/kotlin/com/gojuno/swarmer/Emulators.kt | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt index df7f68f..21c3622 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt @@ -20,6 +20,10 @@ val sh: List = when (os()) { Os.Linux, Os.Mac -> listOf("/bin/sh", "-c") Os.Windows -> listOf("cmd", "/C") } +val runInBackground: String = when (os()) { + Os.Linux, Os.Mac -> "&" + Os.Windows -> "" +} val avdManager: String = when (os()) { Os.Linux, Os.Mac -> "$androidHome/tools/bin/avdmanager" Os.Windows -> "$androidHome/tools/bin/avdmanager.bat" @@ -112,18 +116,7 @@ private fun startEmulator( .doOnNext { log("Ports for emulator ${args.emulatorName}: ${it.first}, ${it.second}.") } .flatMap { ports -> startEmulatorProcess( - sh - + - listOf(emulator(args)) - + mutableListOf().apply { - if (args.verbose) add("-verbose") - add("-avd"); add(args.emulatorName) - add("-ports"); add("${ports.first},${ports.second}") - addAll(args.emulatorStartOptions) - } - - - , + sh + "${emulator(args)} ${if (args.verbose) "-verbose " else ""}-avd ${args.emulatorName} -ports ${ports.first},${ports.second} ${args.emulatorStartOptions.joinToString(" ")} $runInBackground".trim(), args ).let { process -> waitForEmulatorToStart(args, connectedAdbDevices, process, ports) From 9fde174fa243a425889b90274cb710567e552461 Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Wed, 1 Aug 2018 08:30:48 +0200 Subject: [PATCH 6/9] Fix tests --- .../com/gojuno/swarmer/EmulatorsSpec.kt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt b/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt index 8fe8de2..18c48b0 100644 --- a/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt +++ b/swarmer/src/test/kotlin/com/gojuno/swarmer/EmulatorsSpec.kt @@ -174,17 +174,17 @@ class EmulatorsSpec : Spek({ waitForEmulatorToFinishBoot = waitForEmulatorToFinishBoot ) } -// todo fix tests -// START_COMMANDS.forEach { command -> -// it("should start emulators") { -// verify(startEmulatorsProcess).invoke( -// sh + -// listOf( -// "${emulator(command)} ${if (command.verbose) "-verbose" else ""} -avd ${command.emulatorName} -ports ${EMULATOR_PORTS.first},${EMULATOR_PORTS.second}" -// ), -// command -// ) -// } -// } + + START_COMMANDS.forEach { command -> + it("should start emulators") { + verify(startEmulatorsProcess).invoke( + sh + + listOf( + "${emulator(command)} ${if (command.verbose) "-verbose" else ""} -avd ${command.emulatorName} -ports ${EMULATOR_PORTS.first},${EMULATOR_PORTS.second} ${command.emulatorStartOptions.joinToString(" ")} $runInBackground".trim() + ), + command + ) + } + } } }) \ No newline at end of file From 913869bd1368c398210cf96e8f7c8c1c419b8d08 Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Wed, 1 Aug 2018 08:33:47 +0200 Subject: [PATCH 7/9] Revert changes. --- swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt index 31ef34d..7d4c3d1 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Args.kt @@ -119,17 +119,9 @@ sealed class Commands { names = ["--use-compat-emulator"], required = false, description = "Use old compat emulator tool. Look https://issuetracker.google.com/issues/66886035 for details. False by default.", - order = 11 - ) - var useCompatEmulator: Boolean = false, - - @Parameter( - names = ["--keep-existing-avds"], - required = false, - description = "Don't recreate avds if one with the same name already exists.", - order = 12 + order = 10 ) - var keepExistingAvds: Boolean = false + var useCompatEmulator: Boolean = false ) : Commands() From 3faaa2b2358b4903abd54481bc9f3763ff92f61d Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Wed, 1 Aug 2018 08:35:51 +0200 Subject: [PATCH 8/9] Revert changes. --- swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt b/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt index 3d4baf9..57e1be2 100644 --- a/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt +++ b/swarmer/src/test/kotlin/com/gojuno/swarmer/ArgsSpec.kt @@ -18,8 +18,7 @@ class ArgsSpec : Spek({ "--emulator-start-options", "-prop option=value", "--emulator-start-timeout-seconds", "180", "--redirect-logcat-to", "logcat.txt", - "--verbose-emulator", "--keep-output-on-exit", - "--keep-existing-avds" + "--verbose-emulator", "--keep-output-on-exit" ) on("parse args with only required fields") { @@ -54,8 +53,7 @@ class ArgsSpec : Spek({ emulatorStartTimeoutSeconds = 180L, redirectLogcatTo = "logcat.txt", verbose = true, - keepOutputOnExit = true, - keepExistingAvds = true + keepOutputOnExit = true ))) } } From 8d9e451bbfe37e08735f261e4ccd8b18c279dbf5 Mon Sep 17 00:00:00 2001 From: Jakob Grabner Date: Sat, 25 Aug 2018 10:21:06 +0200 Subject: [PATCH 9/9] Use `os()` from commander Update commander to 0.1.8 -> 0.1.10 Update jCommander to 1.71 -> 1.72 Update kotlin to 1.2.41 -> 1.2.61 --- dependencies.gradle | 6 +++--- .../main/kotlin/com/gojuno/swarmer/Emulators.kt | 17 +---------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index c69b068..943b84a 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,9 +1,9 @@ ext.versions = [ - kotlin : '1.2.41', + kotlin : '1.2.61', rxJava : '1.3.8', - jCommander : '1.71', - commander : '0.1.8', + jCommander : '1.72', + commander : '0.1.10', junit : '4.12', junitPlatform: '1.0.1', diff --git a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt index 21c3622..ac2720d 100644 --- a/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt +++ b/swarmer/src/main/kotlin/com/gojuno/swarmer/Emulators.kt @@ -9,7 +9,6 @@ import rx.schedulers.Schedulers import rx.schedulers.Schedulers.io import java.io.File import java.lang.System.nanoTime -import java.util.* import java.util.concurrent.Semaphore import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit.* @@ -346,18 +345,4 @@ private fun outputDirectory(args: Commands.Start) = } private fun connectedEmulators(): Single> = - connectedAdbDevices().take(1).toSingle().map { it.filter { it.isEmulator }.toSet() } - -private fun os(): Os { - val os = System.getProperty("os.name", "unknown").toLowerCase(Locale.ENGLISH) - - return if (os.contains("mac") || os.contains("darwin")) { - Os.Mac - } else if (os.contains("linux")) { - Os.Linux - } else if (os.contains("windows")) { - Os.Windows - } else { - throw IllegalStateException("Unsupported os $os, only ${Os.values()} are supported.") - } -} + connectedAdbDevices().take(1).toSingle().map { it.filter { it.isEmulator }.toSet() } \ No newline at end of file