-
Notifications
You must be signed in to change notification settings - Fork 17
Added option to stop emulators. (#15) #16
Added option to stop emulators. (#15) #16
Conversation
JCommander(JCommanderArgs()).usage() | ||
System.exit(0) | ||
} | ||
|
||
if (COMMAND_STOP_NAMES.firstOrNull { rawArgs.contains(it) } != null) { | ||
stopAllEmulators().toBlocking().firstOrDefault(Unit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, let's move it to main(), parseArgs() should definitely not be doing anything like that
Maybe return sealed class of parse result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thought about it. Decided to go easy way, though=\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, it'd never easy man, never easy
.map { emulator -> | ||
process( | ||
listOf(adb, "-s", emulator.id, "emu", "kill"), | ||
timeout = 5 to SECONDS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm pretty sure we'll overpass this timeout on our highloaded CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess something like 15 seconds would be a better default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, lets try 15
private fun connectedEmulators(): Observable<Iterable<AdbDevice>> = | ||
connectedAdbDevices().map { it.filter { it.isEmulator } } | ||
|
||
fun stopAllEmulators(): Observable<Unit> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Completable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
3c7b72c
to
b795c4e
Compare
@@ -2,7 +2,7 @@ ext.versions = [ | |||
kotlin : '1.1.1', | |||
|
|||
rxJava : '1.2.9', | |||
jCommander : '1.66', | |||
jCommander : '1.71', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old version was hiding JCommander.newBuilder
49aacb8
to
20861e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More tests please, other than that LGTM!
20861e8
to
b32d634
Compare
b32d634
to
bb54d0f
Compare
fun parseStartArguments(rawArgs: List<String>): List<Commands.Start> = | ||
rawArgs | ||
.subList(1, rawArgs.size) // skip command | ||
.fold(ArrayList<ArrayList<String>>()) { accumulator, value -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh finally
.map { it.doOnNext { log("Emulator $it is ready.") } } | ||
|
||
Observable.zip(startEmulators, { startedEmulator -> startedEmulator }) | ||
rawArgs.toList().apply { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is awesome!
))) | ||
} | ||
} | ||
|
||
fun SpecBody.onEmulatorNameVariants() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, we need to del this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO
import rx.Single | ||
import java.util.concurrent.TimeUnit | ||
|
||
class EmulatorsSpec : Spek({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.