Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Update jacoco version - #55

Merged
centic9 merged 1 commit into
jenkinsci:masterfrom
bootstraponline:update_jacoco_version
Nov 22, 2015
Merged

centic9 merged 1 commit into
jenkinsci:masterfrom
bootstraponline:update_jacoco_version

Conversation

@bootstraponline

Copy link
Copy Markdown
Contributor

@centic9

centic9 commented Jun 1, 2015

Copy link
Copy Markdown
Member

Unfortunately we cannot merge this right away as it breaks compatibility to older versions of jacoco.exec, thus breaking any project that still uses <=0.7.4. Some other solution is necessary, likely a new plugin which is based on the xml/tml report would be the right thing to do here...

@bootstraponline

Copy link
Copy Markdown
Contributor Author

Ok, thanks for the info.

@jenkinsadmin

Copy link
Copy Markdown
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@iNikem

iNikem commented Jun 12, 2015

Copy link
Copy Markdown

So now all users who has updated jacoco version in their build tool will get no coverage info from Jenkins? New solutions notoriously take a lot of time.

@bootstraponline

Copy link
Copy Markdown
Contributor Author

So now all users who has updated jacoco version in their build tool will get no coverage info from Jenkins?

Correct.

@centic9

centic9 commented Jun 12, 2015

Copy link
Copy Markdown
Member

Yes, unfortunately this is the current state due to the initial decision to base the visualization on the jacoco.exec binary and not the resulting .xml-file, I can't think of any other way than to rewrite the plugin to be based on the XML-data instead.

@centic9

centic9 commented Jul 22, 2015

Copy link
Copy Markdown
Member

@CSchulz

CSchulz commented Jul 23, 2015

Copy link
Copy Markdown

What about a determination which jacoco.exec file version is present and change the interpreter?

@centic9

centic9 commented Jul 24, 2015

Copy link
Copy Markdown
Member

It's probably not easy to package two different versions, you need to shade at least one of them and switch. We can put it in if somebody comes up with the relevant patches to code and pom.xml.

Also I couldn't see a "version" in the file after a quick look, is there a way to distinguish which version wrote the file?

However the official statement from the JaCoCo development team is that the binary format is internal and should not be used across different versions of JaCoCo, so the "real" fix is to use the XML Report...

@CSchulz

CSchulz commented Aug 6, 2015

Copy link
Copy Markdown

The header contains some data about it:

https://github.com/jacoco/jacoco/blob/master/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataWriter.java#L68

I am on your side centic9, the xml report would be the better choice.

@tarzanek

tarzanek commented Aug 6, 2015

Copy link
Copy Markdown

hmm, what about doing the same as jacoco did?
upgrade plugin version, jacoco version and tell people who are still on 0.7.4 and lower to not upgrade to latest jacoco jenkins plugin?
after all this is a developer tool, not breathing mechanism in a shuttle, so let's keep it easy and with proper setting expectations even such upgrade is doable without much harm, hmm? ;)

@CSchulz

CSchulz commented Aug 7, 2015

Copy link
Copy Markdown

Would be another way. I like the idea, make it simple as possible. Administrators have to read the release notes and similar before updating.

@centic9 What do you think?

@centic9

centic9 commented Aug 9, 2015

Copy link
Copy Markdown
Member

I thought about doing this, but I am running into roadblocks with this myself, I have an open source project which I contribute to, I build it both locally on a Jenkins instance and on another shared Jenkins instance which I do not maintain. So if I raise JaCoCo to 0.7.5 in this project, I can get this to build on my local Jenkins instance by using a newer JaCoCo plugin, but it will not build any more on the global one. If I get the global Jenkins to be updated as well, many other projects that are built on that instance will break unless they update their JaCoCo dependency, which may cause the projects to fail on yet other Jenkins instances...

As a result I would expect some negative responses/bug-entries/... as many admins expect the newer versions to be backwards compatible to some degree without failing completely.

@CSchulz

CSchulz commented Aug 9, 2015

Copy link
Copy Markdown

In this case the header I pointed out the days would be the solution.

@sworisbreathing

Copy link
Copy Markdown

+1 for this issue. I just ran into the error and had to downgrade to 0.7.4 in my project.

I thought about doing this, but I am running into roadblocks with this myself, I have an open source project which I contribute to, I build it both locally on a Jenkins instance and on another shared Jenkins instance which I do not maintain. So if I raise JaCoCo to 0.7.5 in this project, I can get this to build on my local Jenkins instance by using a newer JaCoCo plugin, but it will not build any more on the global one. If I get the global Jenkins to be updated as well, many other projects that are built on that instance will break unless they update their JaCoCo dependency, which may cause the projects to fail on yet other Jenkins instances...

As a result I would expect some negative responses/bug-entries/... as many admins expect the newer versions to be backwards compatible to some degree without failing completely.

I could see this scenario becoming a problem if the existing plugin changed from using the binary files to the XML reports. Existing jobs would need to be reconfigured to point to the XML files instead of the binaries.

If the change is made to this plugin, it's probably a good idea to provide some sensible defaults to help with the upgrade path (naive approach: just copy the exec files path and replace .exec with .xml). You'll still break a few builds for edge cases, but hopefully the vast majority of upgrades will be pretty painless.

@shakuzen

Copy link
Copy Markdown

SonarQube seems to be able to handle the new version of JaCoCo fine. Is there any progress on this issue?

@cardil

cardil commented Nov 19, 2015

Copy link
Copy Markdown

Yup. @SonarSource guys now (from 5.2 version) just support both versions of jacoco. And they display warning message that you are using older version and you should consider to upgrade. For a good couple months they just use old version and builds just fail with 0.7.5.

I think of couple simple solutions, that could deliver seamless work/upgrade without introducing regression into many people builds:

  1. Look what have @SonarSource guys did somewhere here :-P : SonarSource/sonarqube@5.1...5.2 This was fun, but it's accually here: https://github.com/SonarSource/sonar-java/blob/master/java-jacoco-previous/pom.xml
  2. Hack classloader a little bit, maybe like: http://stackoverflow.com/a/60766
  3. Maybe some lightweight OSGI container inside your plugin :-P Maybe: http://karaf.apache.org/
  4. Fork Jacoco 0.7.4, change their package, repackage, release, and use both versions depending on .exec version

Last solution is best for me. What do you think about my propositions?

BTW. I also think that, when you use 0.7.4 or 0.7.5 exec file, there should be a warning to switch to XML version.

RANT! It's 2015 now, guys. Did you hear about semantic versioning? Jacoco 0.7.5 should be 1.0.0, because it breaks compatibility. Sirously, more Java developers should know semver.org

centic9 added a commit that referenced this pull request Nov 22, 2015
@centic9
centic9 merged commit 8c54a20 into jenkinsci:master Nov 22, 2015
@cardil

cardil commented Nov 24, 2015

Copy link
Copy Markdown

Just merge after all of this discussion? What next?

@centic9

centic9 commented Nov 24, 2015

Copy link
Copy Markdown
Member

Not much likely as no-one seems to be able to put effort into a different/better solution...

@cardil

cardil commented Nov 24, 2015

Copy link
Copy Markdown

Mayby I will provide a PR with additional support for http://search.maven.org/#artifactdetails%7Corg.sonarsource.java%7Cjava-jacoco-previous%7C3.7.1%7Cjar

@centic9

centic9 commented Nov 24, 2015

Copy link
Copy Markdown
Member

Yes, a PR would be highly welcome!

@MarkRx

MarkRx commented Jan 26, 2017 •

Copy link
Copy Markdown

I don't mean to bring up a dead thread but have there been any updates on this? We would like to upgrade our plugin to the latest version so we can have Jenkins pipeline support but cannot because hundreds of jobs use the old one which only works with jacoco 0.7.4 and below. Has XML read support been added? How bad was the backwards compatibility breakage? Could a custom org.jacoco.core.data.ExecutionDataReader be written to read in old formats and store them in memory converting them to the new form?

Update: Looks like if there was a way to determine the version (or try again with the old version if loading with the new version results in all 0's or something) then https://mvnrepository.com/artifact/org.sonarsource.java/java-jacoco-previous/4.4.0.8066 might work as suggested.

@centic9

centic9 commented Jan 27, 2017

Copy link
Copy Markdown
Member

Using the XML file proved to be quite some work when I last did take a quick look. Without somebody willing to invest the time and effort to build it, it won't be available anytime soon.

Adding support for the older format may be possible, but you would likely need to "shadow" the older code of JaCoCo and try that if the newer one is not able to read the information from the binary. Again it will only happen if somebody steps up to provide the changes and is willing to maintain it to some degree.

@MarkRx

MarkRx commented Jan 31, 2017 •

Copy link
Copy Markdown

I was able to use the shadowing approach by having delegates of ExecutionDataReader and Analyzer to call the real implementation or a shadowed 0.7.4 compatible one mentioned earlier based on the exec file versions. The file format of the exec files starts with a header of

0x01 0xC0 0xC0 <version byte1> <version byte2>.

0.7.4 uses version 0x1006. 0.7.5 - present uses version 0x1007.

I may not be able to contribute - it depends on legal. Where is the license for this repository?

@bootstraponline

Copy link
Copy Markdown
Contributor Author

Where is the license for this repository?

https://github.com/jenkinsci/jacoco-plugin/blob/master/pom.xml#L2

@centic9

centic9 commented Feb 1, 2017

Copy link
Copy Markdown
Member

As this PR is already merged/closed you should probably start a new issue or PR where you describe this so at least someone else can re-do the work if you are not able to contribute it.

@MarkRx

MarkRx commented Mar 23, 2017 •

Copy link
Copy Markdown

PR for backwards compatibility @ #82

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants