-
Notifications
You must be signed in to change notification settings - Fork 52
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
Added ability to specify inclusion filter for source sets #726
Conversation
5ac91be
to
cd71b38
Compare
} | ||
``` | ||
|
||
This way, only classes from the `main` source set will be included in the report, but not from others. |
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.
Isn't this includedSourceSets
then?
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.
Or at least excludeEverySourceSetExcept
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 would like to get away from naming included
. On the other hand, such things are now called included
in the entire DSL.
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.
Ok, let it be included
for now
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'm afraid we can move from this naming only for all functions at once, when we'll migrate whole Kover plugin
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.
Yes, I took this into account
|
||
val included = variant.excludedOtherSourceSets.get() | ||
// if `test` is not included so we need to check it | ||
if (compilationName == "test" && "test" !in 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.
Isn't it the same condition as included.isNotEmpty() && compilationName !in included
?
Also, you can add a test case for "test"
source set name.
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.
Indeed, I was a little hasty to add a separate condition
assertTrue(buildResult.isSuccessful, "Build should be successful") | ||
classCounter("kotlinx.kover.examples.sourcesets.MainClass").assertAbsent() | ||
classCounter("kotlinx.kover.examples.sourcesets.FooClass").assertAbsent() | ||
classCounter("kotlinx.kover.examples.sourcesets.ExtraClass").assertPresent() |
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.
Add classCounter("kotlinx.kover.examples.sourcesets.TestClasses")
to this test and all above
|
||
val included = variant.includedSourceSets.get() | ||
|
||
if (included.isEmpty() && compilationName == "test") { |
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.
Are tests excluded by default? Is it mentioned somewhere in the documentation?
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.
Yes, test
source set excluded by default.
val builder = StringBuilder() | ||
koverBlocks.forEach { block -> | ||
builder.appendLine() | ||
builder.append(block(language, "8.12")) |
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.
Is 8.12 a Gradle version? Shouldn't it be some constant?
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.
Yes, any version of Gradle with support for assign operator redefinition is needed here.
Resolves #714