-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add android run --app #389
Conversation
525a03d
to
f37602a
Compare
@@ -45,7 +47,7 @@ class AndroidArgs( | |||
override val resultsHistoryName = gcloud.resultsHistoryName | |||
|
|||
private val androidGcloud = androidGcloudYml.gcloud | |||
val appApk = androidGcloud.app | |||
val appApk = if (cmd.app.isEmpty()) androidGcloud.app else cmd.app |
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.
Basically, AndroidArgs
will be created with cmdline class + yml information.
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.
If we mark absent command values as null we could shorten this to:
cmd.app ?: androidGcloud.app
what do you think?
@Test | ||
fun androidArgs_overrideAppFromCmdLine() { | ||
val cmd = AndroidRunCommand() | ||
CommandLine(cmd).parse("--app", testApk) |
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 used testApk
to avoid having a separate apk just to have a working test.
683779a
to
cce436e
Compare
Codecov Report
@@ Coverage Diff @@
## master #389 +/- ##
============================================
+ Coverage 79.88% 79.92% +0.03%
- Complexity 476 478 +2
============================================
Files 66 66
Lines 1546 1549 +3
Branches 234 234
============================================
+ Hits 1235 1238 +3
Misses 173 173
Partials 138 138 |
|
||
fun load(data: String): AndroidArgs { | ||
fun load(data: String, cmd: AndroidRunCommand): AndroidArgs { |
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 default to an empty cmd:
fun load(data: String, cmd: AndroidRunCommand = AndroidRunCommand()): AndroidArgs {
then we don't need a bunch of emptyCmdLine
in the tests
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.
good idea!
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.
provided some feedback, I like the idea of passing in AndroidRunCommand to AndroidArgs.
@@ -35,4 +36,7 @@ class AndroidRunCommand : Runnable { | |||
|
|||
@Option(names = ["-h", "--help"], usageHelp = true, description = ["Prints this help message"]) | |||
var usageHelpRequested: Boolean = false | |||
|
|||
@Option(names = ["--app"], description = ["The path to the application binary file."]) |
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.
we should borrow the descriptions from Firebase:
The path to the application binary file. The path may be in the local filesystem or in Google Cloud Storage using gs:// notation.
https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run
I think Flank supports gs://
notation for remote apks.
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.
fixed
cce436e
to
e20c32e
Compare
@@ -45,7 +47,7 @@ class AndroidArgs( | |||
override val resultsHistoryName = gcloud.resultsHistoryName | |||
|
|||
private val androidGcloud = androidGcloudYml.gcloud | |||
val appApk = androidGcloud.app | |||
val appApk = cmd.app ?: androidGcloud.app |
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.
thoughts on cli.app
?
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.
sure! done!
e20c32e
to
ef47288
Compare
@@ -223,8 +225,6 @@ AndroidArgs | |||
assert(projectId, "mockProjectId") | |||
|
|||
// AndroidGcloudYml | |||
assert(appApk, appApk) | |||
assert(testApk, testApk) |
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 reverted these deletions.
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, I forgot to comment about this diff.
That assert doesn't make sense to me, what are you testing?
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.
Thanks for commenting, I fixed that here: 29670fe
The intent is to test the expected values are present on androidArgs
. The name was shadowed. I capture the values above the with
statement to resolve the conflict.
@Test | ||
fun androidRunCommandApp() { | ||
val cmd = AndroidRunCommand() | ||
CommandLine(cmd).parse("--app", "myApp.apk") |
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.
Added a test to verify null is the default value when --app
is omitted.
app: $appApk | ||
test: $testApk | ||
|
||
flank: |
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.
flank:
may be omitted entirely from the YAML. I updated this test.
#365