Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Installation errors should break the build #104

Merged
merged 2 commits into from
Jan 4, 2017
Merged

Conversation

tasomaniac
Copy link
Contributor

@tasomaniac tasomaniac commented Jan 4, 2017

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 for run 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:

image

Fixes #46

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

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.

Copy link
Contributor

@devisnik devisnik left a 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 \[(.*?)\]/
Copy link
Contributor

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.

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 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@devisnik devisnik merged commit 2e6ec10 into develop Jan 4, 2017
@devisnik devisnik deleted the 46/install-error branch January 4, 2017 17:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants