Hi,

do you have an idea what is the actual difference between the class files?

You can decompile the different class versions with javap -p -c and diff the result.

Regards,
-marc


On 2018-02-17 00:21, mko...@gmail.com wrote:
I'm working on a Gradle plugin
(https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin)
that makes it simple to build and test Jenkins Shared Libraries.
Jenkins Shared Libraries operate on source code instead of compiled
code. Jenkins itself embeds Groovy for compilation of various pipeline
scripts. It performs some manipulations before execution. The code
that comes out seems to be deterministic from what I can tell.

I am trying to figure out a way to coverage for these source Groovy
files when they are compiled and executed in a Jenkins runtime. I've
documented my journey so far in
https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin/issues/32
but here is a summary of where I am currently at:


* I can get execution data for the classes
* Dumping classpath shows multiple instances of the library classes (1
per test they are used in)
* Attempting to get a report fails with
`java.lang.IllegalStateException: Can't add different class with same
name: com/mkobit/libraryexample/ExampleSrc`. There are a few other
duplicates as well
* Filtering down the report to only a single specific file allows me
to generate a coverage report, but I only get it for the test was
filtered
(https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin/issues/32#issuecomment-366371128)

What I want to try and figure out is, what is the right way forward to
"merge" the execution data together for the original source file? It
sounds similar-ish to https://github.com/jacoco/jacoco/issues/197 so
I'll add a comment there as well.

Here are some reproduction steps:

1. `git clone -b 'mk/coverage-investigation'
https://github.com/mkobit/jenkins-pipeline-shared-library-example.git`
2. `cd jenkins-pipeline-shared-library-example`
3. `./gradlew integrationTest jacocoIntegrationTestReport -s ==> See
error mentioned above about duplicate classnames
4. `find
build/jacoco/classpathdumps/com/mkobit/libraryexample/ExampleSrc.* |
head -n 1 | xargs -n 1 basename` ==> this will get one of the classes.
for me this time, it was "ExampleSrc.99203068b63d74ec.class"
5. Replace the class name at
https://github.com/mkobit/jenkins-pipeline-shared-library-example/blob/6d268d56c86c626312bc76a9e00051c5749c28d1/build.gradle.kts#L52
with the class name above and uncomment the line
6. `./gradlew jacocoIntegrationTestReport` ==> Generate report for single class
7. Open HTML report at
build/reports/jacoco/jacocoIntegrationTestReport/html/index.html and
see results for class
8. find
build/jacoco/classpathdumps/com/mkobit/libraryexample/ExampleSrc.* |
tail -n 1 | xargs -n 1 basename ==> get name for other class
9. Repeat steps 4-7 with result from other class to see different

--
You received this message because you are subscribed to the Google Groups "JaCoCo 
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/ebabe3aff26f96248b1994370f627290%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to