-
Notifications
You must be signed in to change notification settings - Fork 37
Installation errors should break the build #104
Conversation
@@ -70,6 +70,6 @@ class Device { | |||
} | |||
|
|||
String toString() { | |||
getClass().name + [id: id, sdk: sdkVersion(), version: androidVersion(), brand: brand(), manufacturer: manufacturer(), model: model(), country: country(), language: language(), timezone: timezone()] | |||
getClass().simpleName + [id: id, sdk: sdkVersion(), version: androidVersion(), brand: brand(), manufacturer: manufacturer(), model: model(), country: country(), language: language(), timezone: timezone()] |
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.
Also decided to use simpleName
here. The name was too verbose. Now it just says Device
which makes sense.
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 stuff. 👍
@Override | ||
protected handleCommandOutput(def text) { | ||
super.handleCommandOutput(text) | ||
def matcher = text =~ /Failure \[(.*?)\]/ |
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.
Somewhat hacky, but fine with me as long at it fixes the behaviour.
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 know with Nougat release, Android team did a lot of refactoring in adb. I remember I listened in this podcast. They know forward exit code and error stream of the command being run on the device when we run adb shell
.
Unfortunately adb install
always succeeds with this message in it. I think I need to open a bug report about 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.
Here is the report to ⭐️
https://code.google.com/p/android/issues/detail?id=231464
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.
👍
The Problem
The problem was that the build was marked as successful even when the installation failed.
This was bad for
installDevice
task. But it was even worse forrun
because it runs the old version assuming that the installation was successful.Solution
Our plugin does not really handles errors. Also the
adb
almost always exits with success (code 0) and never writes into error stream.We should investigate and maybe even report back to Google places where we can make use of error codes.
But in this specific case (APK installation), it is feasible to look at the output.
Now, I am searching for
Failure
in the text and break the build with the original failure error code. It looks like this:Fixes #46