-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-Release-Jar with initial support for JDK 9 and JDK 10 NIO API #120
Conversation
…e transferTo Provides potential higher performance. Signed-off-by: Markus KARG <markus@headcrashing.eu>
Provides potential higher performance. Signed-off-by: Markus KARG <markus@headcrashing.eu>
Signed-off-by: Markus KARG <markus@headcrashing.eu>
This is a great example I could even use in my project. @rfscholte is the expert here. |
Please also confirm that every accessible method of touched by a test. The most tricky part with MRJAR is to keep all these method signatures in sync. |
I wonder if somebody knows a simple way to let Maven (here: on a JDK 10+ runtime) run tests multiple times using several release levels, so it effectively "fakes" being a JDK 8, 9, 10... VM?
I think the best way here would not be to keep them in sync, but instead let the |
Right, if the amount of copied code is rather large, it is better to introduce a class just for the specific versions-implementations. Regarding running the tests: https://maven.apache.org/plugins/maven-compiler-plugin/multirelease.html contains all kinds of strategies, none is perfect. So far this setup + a CI server works best for our projects. |
I will refactor the code of this PR in that way, so we have only the actually modified methods in the version-specific source folders.
As the test matrix is already in place, the sole problem we have with this PR is that we need to split the stages for build from the stages for test. In the end, build stage must happen on JDK 10 and higher only, and that artifact is then to be tested on 8...16. I think that should work. Any better idea? |
Signed-off-by: Markus KARG <markus@headcrashing.eu>
Refactored code in bc5b0ab. No more complete duplicates of |
I think we can simplify without using a singleton. |
Signed-off-by: Markus KARG <markus@headcrashing.eu>
Refactored in e16dc59. I prefer keeping the name |
Signed-off-by: Markus KARG <markus@headcrashing.eu>
I have modified the Github CI script in cecd035 so it will build with JDK 15 always but just tests with the full matrix, hence the JDK 8 and 9 test is green again now! :-) If we need to proof that we can build (not just test) on a full matrix (excluding builds on 8 and 9 as certainly these won't be able to compile Java 10 source code), then I could modify |
No, this is not good. You can only verify it works with JDK8 by building and testing it with JDK8. |
Why can't I see if the JAR works on JDK 8 when I build it on 15 but test it with 8? For what is the test good then...? That makes no sense to me since the result of that would be that on JDK 9 you end up with a JAR that would contain the variants for 8 and 9 but not for 10. So if we do not build with 10+ always, you would effectively get different content in the JAR. Why should somebody want that? |
How do you test it with JDK8? |
I don't understand the question. As you can see in https://github.com/codehaus-plexus/plexus-utils/pull/120/checks?check_run_id=1640215941#step:7:12, the current CI matrix tests on Java 8, but it uses the JAR built using JDK 15 for the tests (see https://github.com/codehaus-plexus/plexus-utils/pull/120/checks?check_run_id=1640215941#step:5:10). This works pretty well as long as what you want to test is whether a JDK 15 built JAR works (i. e. finds the default implementation) on JDK 8. |
@rfscholte WDYT? |
please just use JDK activated profiles. This will also make it easier to test locally. |
This reverts commit cecd035.
@rfscholte According to your wish, I have undone the Gitlab CI change, so now you can locally build using JDK 8 or 9 to get different multi-release JARs for those platforms (while still the general idea is to build on JDK 10+ to get the sole one to be published on Maven Central). Is it now in the way that you prefer? |
ec26540
to
d430deb
Compare
What??? what has been done regarding #120 (comment) ??? If some jdk level is required we must enforce it via some enforcer rules to provide easy human readable message. |
And seriously such change must be squashed into a single commit when merged in master branch. |
I'm definitely -1 on such changes!!! |
can you please fix that!! |
Merging dirty commits is a no go. |
@michael-o and it's too late now... |
True, I don't understand that |
Sorry if I did something wrong, but nobody was responding since five days, even after explicitly asking for comments, so I thought you are all fine (just as Robert was, who explicitly answered earlier). I do not see that an enforcer is needed, as no particular JDK level is actually needed. The solution works well with any JDK level, and the description of the PR clearly explains how it works. No harm is done actually. Whether or not you squash changes is a question of likes and dislikes. Neither did somebody request that, not did I find a written rule about that, and in many projects "dirty" commits for accepted in SNAPSHOTs. So if there is such a rule, and if you get asked by a new committer about comments, then you maybe should refer to it and request a change when asked for. I did not merge "hastily", I asked days ago. Sorry guys, but staying silent for five days was simply misunderstood. |
Guys, I am taking your comment very seriously so I checked the points you mentioned today. In fact, to me comment #120 (comment) was resolved by me changing the PR description and nobody responded to that, so I thought you are fine. The comments, besides two, are independent, and not dirty. For me, supporting Java 9, 10, MJARs, and changing things later due to Robert's request, are neither intermediate nor dirty commits, so actually I thought it is good to have them separate (some OS projects even prevent squashing but insist on having the full history of each merge branch). "dirty" is only the support for JDK 15, and yes, if you would have told me earlier (you had time since Janary 16 and was asked explicitly five days ago) I certainly would have followed your request. So how to go on from here? Do you want me change change something now then please exactly tell me what. If there is a document that I shall read to prevent future "surprises" then please directly point me to that link. Thanks guys, and sorry again. |
The problem ist that this topic is complex, I am not qualified to judge here. Most aren't. Five days sounds a lot, but it isn't. Most need weeks to find time for this. I am slow. |
I totally understand that, but the truth is, the PR is open since January 1st and the discussions werde finished in January 26th, so this is much more than five days. The five days were just a final reminder. Robert is the defintive expert, and he was fine with the solution provides by January 26th already. |
If @rfscholte was fine with that, I am too. But a cleanup is imperative. |
Sorry but you are wrong! Enforcer rule is definitely needed as asked here: #120 (review) If I build the project with java11 or java8 or java9 the produced jar will have different content. jdk 11 build jar content:
jdk8 build jar content:
Your comment on no rule written on squash etc... Well it's really a common sense as this pr just have different commits with non related comments... 5 days. what is 5 days in a world with global pandemic, people working on different timezone and with easter weekend (school holidays which can change a lot the availability of some contributors) |
@olamy Sorry but you are wrong in some points, and I would kindly ask you to check my original commit for MJAR support instead of just looking at the final PR.
I deliberately did not squash it and deliberately waited for months for you to be able to follow exactly that situation. So until you find an agreement with Robert, I simply cannot fix this, because what he wanted me to do is exactly the opposite of what you want me to do, and he was very eager about this discussion, while you had time since January 26th to respond but just didn't. |
To ensure the the Java 8 classes still work with Java 8, you must run it with JDK8. That's why the CI server is important, you cannot verify this with a single Maven build on your local system. |
So where to go from here, just add a commit ontop which adds the enforcer rule on the release profile, or squashing everything (i. e. breaking the branch's history) or just squashing the changes you personally requested (which still breaks history)? I need clear instructions how it is definitively to be done, since (as I said) this is not common sense and done differently in other open source projects. Thanks. |
java15 as a minimun? really? not sure the IT industry has reached such level.
who cares about having this in a code history. We are not here to store some fingers pointing. It's already part of the PR discussion no really need to add more.
As I read this comment, some commits cannot work separately so better to have a single one.
Perso I don't see adding this build complexity (debugging) as a real step forward. Does it really worth? Is it really so much performant? |
@olamy JDK 15 was initially proposed as the enforced build JDK as it was the latest GA release available on Github, so it would allow to add support for more version folders in the MJAR without changing the POM; anyways I just told you that to proof that I did have the idea of enforcing the JDK version used for the build (just as you do request it). Hence I have no problem with reducing the enforcement to just JDK 11 at all, I'm just waiting for instructions as you see in the PR comments. Whether something is a dead horse plays no role for MJARs: These are the minimum levels the API changes will work upon, so in fact, we do currently support 8, 9 and 10, but actually 8, 9, 10, 11, 12, 13, 14, 15, 16, 17-EA with this very same solution. "Just 11" would not work as @rfscholte insisted on having support for 8, too (see the PR history). And yes, it is worth the complexity, and we should concentrate our discussion on going forward not backwards. @rfscholte As I do not want to do a second failure in your unwritten processes, I need clear instructions whether I may directly rewrite the history (as apparently targeted by @olamy IIUC his complaint) or whether I may push the needed commit for the enforcer just ontop, or whether I shall provide a new PR with just that single commit. Or whatever else this community wants me to do to stop the discussion about the past and go in the right direction for the future. See, now that I learned that nobody will point a finger on anybody (which I really appreciate) I really want to help fixing the "mess" as best as I can, but *I need to know which way the majority wants me to go. Thanks. |
This is the first time I hit this situation, so I'd follow Oliviers advice here. |
please provide a PR. rewriting master branch history is just worst. |
I will provide a PR for the enforcer. Regarding JMH I will look into something on my Youtube channel regarding performance in general. |
take it easy buddy we do not need some TV show but just few jmh tests.... |
comparing old-school code with NIO 10 code sounds like a good topic for a shootout video, and I am always looking for interesting topics for my channel anyways |
@olamy It took some time as I was rather busy, but meanwhile I found the time to provide the JMH benchmark. Ignoring all the out-commented benchmarks, it effectively just compares what Plexus-Utils did before (using NIO 7) and after (using NIO 9 and NIO 10) my merge of the MRJAR PR. I have performed this benchmark on both, Linux and Windows, and while certainly the difference currently is not dramatic yet, I personally would say the complexity (which I, in fact, would not say is really big) is worth the improved throughput, in particular as the rather complex implementation of the transferTo() methods clearly could be further optimized, while the explicit custom code that one had to write in lieu of transferTo() simply already reached the peak optimization that is possible outside of the JRE. The actual numbers of my Windows Laptop are:
Some actual numbers of a Linux cloud container:
What these numbers do tell us is that the differences between NIO 7, 9 and 10 are different on Windows and Linux (besides the fact that one cannot compare a Windows Laptop to a Linux cloud container, certainly), but also, and this is much more important, If that means that you want to undo NIO 9 support until then, feel free... but I personaly think we should not workaround specific performance bugs of particular JDK implementations but instead fix them, as we do not know if they even exist in JDK 17 or on ARM or on Mac... |
@olamy More performance news. Looked into the JRE source and did some more benchmarks. Actually the performance drop of |
@olamy Performance update: Filed enhancement proposal meanwhile, now waiting for OpenJDK's answer. If they accept it, |
Turning Plexus Utils into a Multi-Release-Jar to allow using the best API on each platform version available without increasing the minimum platform version.
This PR effectively replaces PRs #112 and #113, as per using NIO API there is no need for these separate PRs (they simply intended to use NIO API).
Note: Due to the way MRJARs are built, the actual content of the outcoming JAR is limited by the actual JDK release used to build. When using JDK 9, no JDK 10 APIs will be contained, etc..