TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.36k stars 2.57k forks source link

Release a version with Java module support #1338

Closed anthonyvdotbe closed 11 months ago

anthonyvdotbe commented 11 months ago

This project was modularized via https://github.com/TooTallNate/Java-WebSocket/pull/1309. To enable dependents such as Playwright to complete their transition to Java modules as well, I'd like to ask releasing a new version of Java-WebSocket.

PhilipRoman commented 11 months ago

@marci4 I don't know how the release process works - is there anything blocking a new version? If there is anything I can help with, just tell me. I'll have some free time next week.

marci4 commented 11 months ago

@PhilipRoman I don't think so. I am uncertain how I can get a java 7 compatible binary with java module support. Do you have any insight on this for me?

Started #1339

anthonyvdotbe commented 11 months ago

@marci4 Everything except the module descriptor is compiled with --release 7. For the module descriptor this is --release 9. By using a multi-release JAR, the module descriptor ends up in the META-INF/versions/9 directory of the JAR. So Java SE 7/8 runtimes won't notice the module descriptor (since they don't look in the META-INF directory for class files) and will work as before. So doing a Maven build suffices to get a JAR which is compatible with any Java SE 7+ runtime and supports Java modules on any Java SE 9+ runtime.

marci4 commented 11 months ago

@anthonyvdotbe thank you for the explanation. I don't do any java in my day job, so I have no clue on these new changes.

Pushed a snapshot here https://oss.sonatype.org/content/repositories/snapshots/org/java-websocket/Java-WebSocket/1.5.4-SNAPSHOT/

Could you take a look and just give me a short thumps up, if everything is as expected? Thank you.

anthonyvdotbe commented 11 months ago

@marci4 Everything is as expected, thanks 👍

jar.exe -d -f .\Java-WebSocket-1.5.4-20230714.160324-3.jar --release 9 shows the JAR is a proper Java module (output below) and e.g. javap -v .\org\java_websocket\client\DnsResolver.class shows that the class files are compiled against Java SE 7 (major version: 51)

releases: 9

org.java_websocket@1.5.4-SNAPSHOT jar:file:///C:/Users/antho/Downloads/./Java-WebSocket-1.5.4-20230714.160324-3.jar!/META-INF/versions/9/module-info.class
exports org.java_websocket
exports org.java_websocket.client
exports org.java_websocket.drafts
exports org.java_websocket.enums
exports org.java_websocket.exceptions
exports org.java_websocket.extensions
exports org.java_websocket.extensions.permessage_deflate
exports org.java_websocket.framing
exports org.java_websocket.handshake
exports org.java_websocket.interfaces
exports org.java_websocket.protocols
exports org.java_websocket.server
requires java.base mandated
requires org.slf4j transitive
contains org.java_websocket.util
marci4 commented 11 months ago

Fixed with #1339