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

Task should not fail if xml report is not enabled #12

Open
fabianMendez opened this issue Jan 28, 2019 · 3 comments
Open

Task should not fail if xml report is not enabled #12

fabianMendez opened this issue Jan 28, 2019 · 3 comments

Comments

@fabianMendez
Copy link

fabianMendez commented Jan 28, 2019

Since this plugin relies in the xml report being enabled for the jacoco plugin:

jacocoTestReport {
    reports {
        xml.enabled true
    }
}

File jacocoTestReport = new File("${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml")
if (!jacocoTestReport.exists()) {
logger.error('Jacoco test report is missing.')
throw new GradleException('Jacoco test report is missing.')
}

It should not fail if this report is not enabled and maybe it could show a warning

Also, it could be better if the path of the report is taken from jacocoTestReport.reports.xml.destination

@jansauer
Copy link
Owner

jansauer commented Feb 3, 2019

Hi @fabianMendez
My train of thought was that if the plugin already enables the jacoco report and it is still not there something is going really wrong and only writing an error and a still successful build would not be enough. Do you have a use case were this would be desirable?

I thing that i had tried the part with the destination configuration but it didn't worked. Since I can't remember what the reason was i will give it a second go :-D having a hardcoded path is really bad taste.

@fabianMendez
Copy link
Author

My problem was that the xml report is not enabled by default and the README does not mention that it should be enabled, so I had to search the error message in this repository which lead me to the conclusion that I had to enable it.

Updating the readme should be enough 👍

@manuelprinz
Copy link

I had an issue with composite builds, as the plugin was confused about where project.buildDir is. I think the error was good for failing the build, but not too helpful.

Another way of thinking would be to generate a warning and set the task output to SKIPPED or NO-SOURCE, which could be achieved easily with newer Gradle APIs. I think the is what I would expect, but maybe this is just me. 😉 (Or make it configurable.) In my case the GitLab CI would have failed, because no coverage output was found.

I am happy to contribute to a solution!

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

No branches or pull requests

3 participants