-
Notifications
You must be signed in to change notification settings - Fork 73
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
Don't add jacoco tasks for ignored build variants #69
Don't add jacoco tasks for ignored build variants #69
Conversation
When using a variantFilter to ignore certain variants the plugin was still generating the corresponding tasks variantFilter { variant -> if (variant.name == "debug") { variant.setIgnore(true) } } Caused: Could not determine the dependencies of task ':app:jacocoTestReportDebug'. This broke the gradle `build` command The new implementation uses android.libraryVariants or android.applicationVariants instead of iterating manually over buildTypes and flavors. The bug is fixed because ignored variants are not included.
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 like it. Two questions and one little nit. Also that will re-trigger the build which will hopefully let it run.
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated
androidMock.metaClass.getBuildTypes = { buildTypesMock } | ||
def appVariants = buildTypesMock.collect { bt -> | ||
def variant = new MockFor(BaseVariant) | ||
variant.metaClass.getFlavorName = { null } |
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.
do we need to do 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.
Actually not, I just wanted to be explicit. It is required to be null
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.
Okay then leave it there.
androidMock.metaClass.getBuildTypes = { buildTypesMock } | ||
def appVariants = buildTypesMock.collect { bt -> | ||
def variant = new MockFor(BaseVariant) | ||
variant.metaClass.getFlavorName = { null } |
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.
do we need to do this?
androidMock.metaClass.getApplicationVariants = { appVariants } | ||
androidMock.metaClass.testOptions = null | ||
project.metaClass.android = androidMock | ||
// fake all with each |
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.
Can you transform it to a sentence?
additionalSourceDirs = subProject.files(coverageSourceDirs) | ||
sourceDirectories = subProject.files(coverageSourceDirs) | ||
executionData = | ||
subProject.files("${subProject.buildDir}/jacoco/${testTaskName}.exec") |
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.
can you squeeze it into one line?
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.
Cool, thanks 👍
Fixes #67
The new implementation uses
android.libraryVariants
orandroid.applicationVariants
instead of iterating manually over buildTypes and flavors. The bug is fixed because ignored variants are not included.