ben-manes / caffeine

A high performance caching library for Java
Apache License 2.0
15.78k stars 1.59k forks source link

MANIFEST.MF missing ImplementationVersion #889

Closed melloware closed 1 year ago

melloware commented 1 year ago

Looking at your Manifest its missing Implementation version.

This means in Java code I cannot detect the Caffeine version using Caffeine.class.getPackage().getImplementationVersion() which is standard practice. Unless I can get the version some other way?

Manifest-Version: 1.0
Automatic-Module-Name: com.github.benmanes.caffeine
Bundle-License: https://www.apache.org/licenses/LICENSE-2.0
Bundle-ManifestVersion: 2
Bundle-Name: com.github.ben-manes.caffeine
Bundle-SymbolicName: com.github.ben-manes.caffeine
Bundle-Version: 3.1.5
Created-By: 11.0.18 (Eclipse Adoptium)
Export-Package: com.github.benmanes.caffeine.cache;uses:="com.github.b
 enmanes.caffeine.cache.stats";version="3.1.5",com.github.benmanes.caf
 feine.cache.stats;uses:="com.github.benmanes.caffeine.cache";version=
 "3.1.5",com.github.benmanes.caffeine;version="3.1.5"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=11))"
Tool: Bnd-6.4.0.202211291949
ben-manes commented 1 year ago

From a quick search, ASM had this mistake and said it was also available in Class.getModule().getDescriptor().rawVersion() but I have not verified. Are there any other manifest attributes that you would recommend?

melloware commented 1 year ago

Nice well on another Open Source lib I work on this is what we have in there except I removed Export-Package because it was verbose to put here:

Manifest-Version: 1.0
Created-By: Apache Maven Bundle Plugin 5.1.8
Build-Jdk-Spec: 17
Specification-Title: PrimeFaces
Specification-Version: 13.0
Implementation-Title: PrimeFaces
Implementation-Version: 13.0.0-SNAPSHOT
Bnd-LastModified: 1678880661063
Bundle-Description: PrimeFaces is one of the most popular UI libraries i
 n Java EE Ecosystem and widely used by software companies, world renown
 ed brands, banks, financial institutions, insurance companies, universi
 ties and more.
Bundle-License: http://www.opensource.org/licenses/mit-license.php
Bundle-ManifestVersion: 2
Bundle-Name: PrimeFaces
Bundle-SymbolicName: org.primefaces
Bundle-Version: 13.0.0.SNAPSHOT
ben-manes commented 1 year ago

Thanks. It looks like we could add Implementation-Title, Build-Jdk-Spec, and Bundle-Description.

From this article, there is also packaging sealing. We don't use split packages so it might be safe to enable, if there was a good reason to.

For PrimeFaces, you might consider disabling Bnd-LastModified for reproducible builds (see config option). That is combined with Gradle's preserveFileTimestamps = false and reproducibleFileOrder = true options so that the archives are consistent.

melloware commented 1 year ago

Ahhh thanks for the tip! I will look at the Felix bundle settings!

ben-manes commented 1 year ago

Released in 3.1.6

melloware commented 1 year ago

Thank you!