This repository has been archived by the owner on Dec 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Add windows compatibility #45
Open
jakob-grabner
wants to merge
10
commits into
gojuno:master
Choose a base branch
from
jakob-grabner:feature/windows_compatibility
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3bc6650
Add option to keep existing avds
simonschiller eb10a5c
Use "emulator -list-avds" to check for existing emulators
rtjag d71bb82
Fix exception if swarmer is called with 0 args
rtjag 06dda0c
Add windows compatibility
rtjag 2699c4a
Fix emulator start command
rtjag 9fde174
Fix tests
rtjag 913869b
Revert changes.
rtjag 3faaa2b
Revert changes.
rtjag 8d9e451
Use `os()` from commander
rtjag 2d6facd
Merge remote-tracking branch 'gojuno/master' into feature/windows_com…
rtjag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ 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.os | ||
import com.gojuno.commander.os.Os | ||
import rx.Completable | ||
import rx.Observable | ||
import rx.Single | ||
|
@@ -18,10 +20,26 @@ 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<String> = 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" | ||
} | ||
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 +120,7 @@ private fun startEmulator( | |
.doOnNext { log("Ports for emulator ${args.emulatorName}: ${it.first}, ${it.second}.") } | ||
.flatMap { ports -> | ||
startEmulatorProcess( | ||
// Unix only, PR welcome. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I knew someone will delete this line haha |
||
listOf(sh, "-c", "${emulator(args)} ${if (args.verbose) "-verbose" else ""} -avd ${args.emulatorName} -ports ${ports.first},${ports.second} ${args.emulatorStartOptions.joinToString(" ")} &"), | ||
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) | ||
|
@@ -362,4 +379,4 @@ private fun createdEmulators(args: Commands.Start, timeout: Pair<Int, TimeUnit> | |
.filter { !it.isBlank() } | ||
.map { it.trim() } | ||
.toSet() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
.exe
! RUN DON'T LOOK BACK