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

Don't add jacoco tasks for ignored build variants #69

Merged
merged 2 commits into from
Jul 11, 2017
Merged

Don't add jacoco tasks for ignored build variants #69

merged 2 commits into from
Jul 11, 2017

Conversation

passsy
Copy link
Contributor

@passsy passsy commented Jul 7, 2017

Fixes #67

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.

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.
Copy link
Owner

@vanniktech vanniktech left a 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 }
Copy link
Owner

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?

Copy link
Contributor Author

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

Copy link
Owner

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 }
Copy link
Owner

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
Copy link
Owner

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

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?

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

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

Cool, thanks 👍

@vanniktech vanniktech merged commit a59770f into vanniktech:master Jul 11, 2017
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.

excluded variants break build
2 participants