scoverage / gradle-scoverage

A plugin to enable the use of Scoverage in a gradle Scala project
Apache License 2.0
53 stars 38 forks source link

Gradle 7 incompatibility due to implicit dependency #163

Closed smourapina closed 3 years ago

smourapina commented 3 years ago

Running gradle-scoverage under Gradle 7 (in this case 7.1.1.) results in the following warnings for multiple coverage tasks:

> Task :some-module:jar
Execution optimizations have been disabled for task ':some-module:jar' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/some-module/build/libs/some-module.jar'. Reason: Task ':some-module:reportTestScoverage' uses this output of task ':some-module:jar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.

Can you please check this issue?

maiflai commented 3 years ago

It's a known issue and being looked at as part of https://github.com/scoverage/gradle-scoverage/issues/150.

I agree it means that Gradle cannot optimise the task, but I think it's not something that prevents the current use of the plugin?

smourapina commented 3 years ago

Thanks for the quick feedback @maiflai. Indeed it does not prevent the use of the plugin, but it would be good to fix it!

If it is ok, I will leave this issue open for the time being, as a reference in case other users experience the same.

eyalroth commented 3 years ago

I don't think this is related to #150.

I opened a PR that should fix this warning.

smourapina commented 3 years ago

Much appreciated @eyalroth, thank you!

smourapina commented 3 years ago

I have tried this in the meantime, and the change does indeed get rid of the message above for dependency on the :some-module:jar task.

However, I still have warnings for the following tasks:

From what I understand from the change introduced, these tasks should have been included even before, with the dependency on testTask, but it does not seem to be the case.

Can you please reopen this and take a look @eyalroth or @maiflai ?