Skip to content

Jacoco Problem with Gradle Transform Task #105

@Nash123-start

Description

@Nash123-start

Hi, I use jacoco and ScopedArtifacts.Scope.ALL to do some transform work in my project.
The gradle tool version is 8.0
My project structure is as follows:
app
module a
module b
app includes module a and module b
in app I use ScopedArtifacts.Scope.ALL to write a gradle plugin
there is the code :

image image

and I use jacoco in module A and module B too
there is the jacoco code:
image

now there comes the problem the jacoco task is execute before transform task
After the jacoco task is finished, the transform task will get the input dir and input jar( module A class.jar module B class.jar)
but when I print the path of input jar , I found that the input jar is still the original jar file without jacoco Instrumentation code.

example:
after jacoco task
the input jar @get:InputFiles abstract val allJars: ListProperty<RegularFile>
class path in the plugin is
Module A/build/intermediates/runtime_library_class_jar/class.jar(without jacoco Instrumentation code)
Module B /build/intermediates/runtime_library_class_jar/class.jar(without jacoco Instrumentation code)

That means jacoco didn't work in my project due to the using of transform task by code mentioned above, because the transform task still use the original class jar ( module A class.jar without jacoco Instrumentation code and module B class.jar without jacoco Instrumentation code) to general the final class.jar that will finally saved in app/build/intermediates/classes/all/class.jar.
So how can I do to get the right class.jar of module A and module B that include jacoco Instrumentation code
and in gradle 7.0
I found that
Module A/build/intermediates/runtime_library_class_jar/class.jar
Module B /build/intermediates/runtime_library_class_jar/class.jar
include the jacoco Instrumentation code
but in gradle 8.0 it's not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions