arturdm / arturdm/jacoco-android-gradle-plugin

Jacoco Problem with Gradle Transform Task

Open
#105 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
565
Forks
107
PR merge metrics
No merged PRs in 30d

Description

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`
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the interaction between JaCoCo and the Gradle transform using the app, module A, and module B structure described. Inspect the ScopedArtifacts.Scope.ALL transform inputs and the runtime_library_class_jar/class.jar outputs under Gradle 8.0, comparing them with Gradle 7.0. Done means the transform receives class jars containing JaCoCo instrumentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
build-system, mobile-dev, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.