-
Notifications
You must be signed in to change notification settings - Fork 0
Code Coverage Plugin #110
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
Code Coverage Plugin #110
Conversation
...s/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoveragePlugin.kt
Outdated
Show resolved
Hide resolved
...s/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoveragePlugin.kt
Outdated
Show resolved
Hide resolved
|
We should have a description indicating what this does, precisely, in the PR description, and links to the documentation of the features used in the code comments, so future authors can have a starting place to go when looking at this code. |
...s/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoveragePlugin.kt
Outdated
Show resolved
Hide resolved
...s/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoveragePlugin.kt
Outdated
Show resolved
Hide resolved
|
An overall comment, was there a specific reason for using kotlin here? I mean its nice, but I think we also need to get the team onboarded with kotlin as well. |
...s/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoveragePlugin.kt
Outdated
Show resolved
Hide resolved
...s/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoveragePlugin.kt
Outdated
Show resolved
Hide resolved
|
How would this plugin work on Non-Android gradle modules such as |
I agree with you, will arrange a brownbag on Kotlin |
Non-Android projects support is being added |
The support for Java projects is now available |
AdamBJohnsonx
left a comment
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.
Minor comments. If it works, I'm for it.
plugins/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoverage.kt
Outdated
Show resolved
Hide resolved
plugins/buildsystem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoverage.kt
Outdated
Show resolved
Hide resolved
...stem/src/main/java/com/microsoft/identity/buildsystem/codecov/CodeCoverageReportExtension.kt
Outdated
Show resolved
Hide resolved
|
Were we able to verify that just running the tests doesn't run coverage? (basically only code coverage specific gradle tasks will run the coverage) |
shahzaibj
left a comment
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.
It looks fine to me. I think we just need to see it working e2e now.
|
Cool, I will go ahead and merge this in, thanks @AdamBJohnsonx & @shahzaibj |
Yeah, these changes made that possible - c1145c5 |
…system/codecov/CodeCoverageReportExtension.kt Co-authored-by: Shahzaib <37125644+shahzaibj@users.noreply.github.com>
Code Coverage Plugin
Intro
Code coverage is a software metric used to measure how many lines of our code are executed during automated tests.
JaCoCo is a free Java code coverage tool and the JaCoCo plugin provides code coverage metrics for Java code via integration with JaCoCo.
Why
In order to generate JaCoCo unit test coverage reports for Android projects you need to create
JacocoReporttasks and configure them by providing paths to source code, execution data and compiled classes. It's not straightforward since Android projects can have different flavors and build types thus requiring additional paths to be set. This plugin configures theseJacocoReporttasks automatically.Usage
plugins { ... id 'com.gradle.plugin-publish' version '0.14.0' // or whatever version is most recent } codeCoverageReport{ html.enabled = true // by default it's true xml.enabled = true // by default it's true csv.enabled = true // by default it's false unitTests.enabled = true // whether code coverage tasks for unit tests will be generated androidTests.enabled = true // whether code coverage tasks for instrumentation tests will be generated excludeFlavors = [''] // the product flavors to exclude when generating the code coverage tasks excludeClasses = [''] // additional classes to exclude - most are already catered for destination = '/some/other/directory' // if you want to configure a custom path to save the code coverage reports, by default your report gets saved in `[project]/build/jacoco/{flavor}{build type}{project}{test type}CoverageReport` includeNoLocationClasses = true // To include Robolectric tests in the Jacoco report this needs to be true } android { buildTypes { debug { testCoverageEnabled true // this instructs the plugin to generate code coverage reports for this build type ... } release { testCoverageEnabled false // this instructs the plugin to NOT generate code coverage reports for this build type ... } } ... productFlavors { local {} dist {} } }The above configuration creates a
JacocoReporttask for each variant in the form of{flavor}{build type}{project}{test type}CoverageReportBy default these are the excluded classes under Constants