-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fixes executionData
file getting overridden
#21
Conversation
}.get() | ||
) | ||
it.outputFile = File(buildDir, "/testkit/${taskProvider.name}/testkit-gradle.properties") | ||
it.destinationFile.set(destinationFile.get().path) // .get() breaks the circular dependency |
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 not sure if this .get()
was intentional but my natural approach to this will be:
it.destinationFile.set(destinationFile.map(File::getPath))
The problem is that also adds a dependency from jacocoTestKitPropertiesTask
to taskProvider
and as later we do:
taskProvider.configure { it.dependsOn(jacocoTestKitPropertiesTask) }
a circular dependency is form.
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.
There is even a comment in this line // .get() breaks the circular dependency
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.
The comment was to state that without a .get()
that breaks the dependency inference of the Property API, a dependency loop is made.
Anyway I've just removed it.
Unit tests are failing on Bitrise CI:
|
Just fixed them |
Codecov Report
@@ Coverage Diff @@
## master #21 +/- ##
============================================
- Coverage 92.68% 91.11% -1.58%
Complexity 8 8
============================================
Files 4 4
Lines 41 45 +4
Branches 2 3 +1
============================================
+ Hits 38 41 +3
Misses 2 2
- Partials 1 2 +1
Continue to review full report at Codecov.
|
it.jacocoRuntimePath.set(jacocoRuntimePathProvider) | ||
} | ||
|
||
dependencies.add(configurationRuntime, files(testKitDir(taskProvider.name))) | ||
taskProvider.configure { it.dependsOn(jacocoTestKitPropertiesTask) } | ||
|
||
tasks.withType(JacocoReport::class.java) | ||
.matching { it.name == "jacoco${taskProvider.name.capitalize()}Report" } |
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.
If provider name starts with i
and default locale at runtime is set to Turkish or Azeri then capitalization will result in capital dotted İ
so no match will be probably found.
Anyway we have a similar existing capitalize https://github.com/koral--/jacoco-gradle-testkit-plugin/pull/15#discussion_r418568736 so it's fine for now to leave it also here.
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 this was the most controversial part of the change, as I generally don't like reference tasks by name miming their internal plugin logic to name them. But I couldn't find a way to archive this without making too much refactor on the current code.
Do you have any plans to do a new release? I have an internal PR blocked due to this. Actually I did a workaround, but it would be nice just to point to the latest version :) |
Hi @koral-- , I've noted this seems to be incompable with Build Cache. I'll be resarching how to get it work. The two files are there when the I've tried adding: tasks.withType<Test> {
outputs.file("$buildDir/jacoco/$name-gradle-runner.exec")
} But still now working 🤔 |
This PR addresses the being discussed here gradle/gradle#16603 (comment) regarding Gradle's Build Cache failing to pack an entry.
The root cause is a race condition caused by this plugin, because the execution data is getting feed (and overridden) by two Jacoco agents: the one from the
Test
class and the other one that runs inside it with aGradleRunner
.The fixing approach is to create a companion execution data file and make it's associated
JacocoReport
task to also feed from it.