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

Add android run --app #389

Merged
merged 5 commits into from
Nov 14, 2018
Merged

Conversation

Macarse
Copy link
Contributor

@Macarse Macarse commented Nov 13, 2018

@@ -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
Copy link
Contributor Author

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.

Copy link
Contributor

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)
Copy link
Contributor Author

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.

@Macarse Macarse force-pushed the macarse/issue365 branch 3 times, most recently from 683779a to cce436e Compare November 13, 2018 22:33
@codecov-io
Copy link

codecov-io commented Nov 13, 2018

Codecov Report

Merging #389 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             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 {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea!

Copy link
Contributor

@bootstraponline bootstraponline left a 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."])
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@bootstraponline bootstraponline changed the title For review only Add android run --app Nov 14, 2018
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on cli.app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! done!

@@ -223,8 +225,6 @@ AndroidArgs
assert(projectId, "mockProjectId")

// AndroidGcloudYml
assert(appApk, appApk)
assert(testApk, testApk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted these deletions.

Copy link
Contributor Author

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?

Copy link
Contributor

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")
Copy link
Contributor

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.

@bootstraponline bootstraponline mentioned this pull request Nov 14, 2018
34 tasks
app: $appApk
test: $testApk

flank:
Copy link
Contributor

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.

@bootstraponline bootstraponline merged commit 38f100d into Flank:master Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants