Skip to content
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

Introduce Java 9 module compatibility #5543

Merged
merged 5 commits into from Apr 5, 2024
Merged

Conversation

trustin
Copy link
Member

@trustin trustin commented Mar 28, 2024

Motivation:

Some users are having issues with using Armeria as a Java 9 module because:

  • Armeria core JAR contains module-info.class from Bouncy Castle, which should be removed during the shading process.
  • Armeria doesn't define module metadata at all

Modifications:

  • Updated gradle-scripts to exclude module-info.class while shading.
    • This removes Bouncy Castle's module-info.class from the final JAR, fixing the issue mentioned in the previous section.
  • Updated gradle-scripts to auto-inject the Automatic-Module-Name property into META-INF/MANIFEST.MF so that JVM auto-generates the module metadata.
  • Miscellaneous:
    • Overwrote the Created-By property in META-INF/MANIFEST.MF so that the manifest file's content doesn't change depending on JDK version.

Result:

  • (new feature) Armeria JARs are now Java modules.

Motivation:

Some users are having issues with using Armeria as a Java 9 module
because:

- Armeria core JAR contains `module-info.class` from Bouncy Castle,
  which should be removed during the shading process.
- Armeria doesn't define module metadata at all

Modifications:

- Updated `gradle-scripts` to exclude `module-info.class` while shading.
  - This removes Bouncy Castle's `module-info.class` from the final JAR,
    fixing the issue mentioned in the previous section.
- Updated `gradle-scripts` to auto-inject the `Automatic-Module-Name`
  property into `META-INF/MANIFEST.MF` so that JVM auto-generates the
  module metadata.
- Miscellaneous:
  - Overwrote the `Created-By` property in `META-INF/MANIFEST.MF` so
    that the manifest file's content doesn't change depending on JDK
    version.

Result:

- (new feature) Armeria JARs are now Java modules.
@trustin trustin added this to the 1.28.0 milestone Mar 28, 2024
Copy link

codecov bot commented Mar 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.07%. Comparing base (8678567) to head (a1de02d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5543      +/-   ##
============================================
+ Coverage     74.04%   74.07%   +0.02%     
- Complexity    20871    20901      +30     
============================================
  Files          1809     1809              
  Lines         76857    76940      +83     
  Branches       9809     9833      +24     
============================================
+ Hits          56912    56994      +82     
+ Misses        15304    15297       -7     
- Partials       4641     4649       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

gradle/scripts/lib/java.gradle Outdated Show resolved Hide resolved
Co-authored-by: minux <songmw725@gmail.com>
Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good!

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked that Automatic-Module-Name is set for output jars 👍 Thanks @trustin 🙇 👍 🙇

@trustin trustin merged commit b1a1044 into line:main Apr 5, 2024
18 checks passed
@trustin trustin deleted the modularity branch April 5, 2024 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants