phxql / argon2-jvm

Argon2 Binding for the JVM
GNU Lesser General Public License v3.0
330 stars 32 forks source link

Build a multi-release and provide a module descriptor #85

Closed A248 closed 3 years ago

A248 commented 3 years ago

Uses multi-release jars to add full module-info support. Placing module-info inside META-INF/versions/ is the same approach taken by HikariCP and Log4jJ. Some other libraries like Gson and Lombok simply put it in the root of the jar, but seeing as this library supports JDK 6, care has to be taken to preserve compatibility.

JDK 11 will be required to build argon2-jvm. To ensure compatibility, the --release flag is used to prevent calls to newer API methods, which also improves compatibility if you were already building on a newer JDK.

This is marked as a draft for now because there is still one issue with the build process I need to work out. Besides module-info.class, every other class is duplicated in META-INF/versions/11, which can be observed with cd argon2-jvm-nolibs/build/libs && unzip argon2-jvm-nolibs-2.11-SNAPSHOT.jar. I'll keep wrestling with gradle unless someone else knows a solution.

Another factor I will investigate is the relation between JNI resources and JPMS. Also, I'm thinking about adding more compatibility tests besides the current one. If one is not careful, adding module-info sometimes breaks features when running on the module path.


As an unrelated suggestion, have you considered changing the default branch of the repository to master? A previous project I worked on had a non-default dev branch to target PRs to, but it happened several times that PRs were made and even merged to the main/master branch.

A248 commented 3 years ago

@phxql Looks like this is ready

phxql commented 3 years ago

This works like a charm, thanks a lot for your effort!