qos-ch / slf4j

Simple Logging Facade for Java
http://www.slf4j.org
MIT License
2.35k stars 990 forks source link

Fully automate OSGi metadata creation and implement minor fixes #327

Closed HannesWell closed 1 year ago

HannesWell commented 1 year ago

This is a follow up PR to https://github.com/qos-ch/slf4j/pull/324 to only use the maven-bundle-plugin to generate all OSGi metadata into slf4j's Manifest.MF files. This unifies the resulting MANIFEST.MFs that are currently partly generated and partly statically defined and fixes the following aspects:

Some of the fixed issues were introduced with https://github.com/qos-ch/slf4j/pull/324 (mainly the changed BSN), some existed before.

I'm currently unsure if it is sufficient to have Import-Package version ranges for the slf4j packages that only contain the minor version (like version="[2.0,3)") or if it should be better also include the current service/micro version in the lower bound (like version="[2.0.7,3)". That latter one is what this PR is currently doing, but the former would be simpler because it is what BND-tools (which the maven-bundle-plugin uses under the hood) is doing by default. However my first impuls would be that a library should never (self-)import a lower version of itself.

@stbischof and @timothyjward you made some OSGi related enhancements of SLF4J in the recent past and are maybe also interested in this change.

@ceki do I have to create a extra ticket for this?

HannesWell commented 1 year ago

Additionally I did a comparison of the Manifest headers in the new artifacts against the SLF4J-2.0.5 release using a little self-written Java-program. The following are the results (the headers Created-By,Originally-Created-By,Build-Jdk-Spec,Tool,Implementation-Version, Bundle-Version are ignored to keep the diffs smaller):

slf4j-api

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-api\target\slf4j-api-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.spi;version="[2.0.7,3)"
    Baseline: org.slf4j.spi;version="2.0.5"
  Export-Package
    Local   : org.slf4j.event;version="2.0.7";uses:="org.slf4j,org.slf4j.helpers"
              org.slf4j.helpers;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.spi"
              org.slf4j.spi;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers"
              org.slf4j;version="2.0.7";uses:="org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: org.slf4j.event;version="2.0.5"
              org.slf4j.helpers;version="2.0.5"
              org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Require-Capability
    Local   : osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
    Baseline: 
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-simple

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-simple\target\slf4j-simple-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/2.0.5/slf4j-simple-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.event;version="2.0.5"
              org.slf4j.helpers;version="2.0.5"
              org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.slf4j.simple;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: org.slf4j.simple;version="2.0.5"
  Require-Capability
    Local   : osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
    Baseline: 
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
Entries missing in local jar
  Require-Bundle: slf4j.api
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-nop

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-nop\target\slf4j-nop-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-nop/2.0.5/slf4j-nop-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.event;version="2.0.5"
              org.slf4j.helpers;version="2.0.5"
              org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.slf4j.nop;version="2.0.7";uses:="org.slf4j,org.slf4j.spi"
    Baseline: org.slf4j.nop;version="2.0.5"
  Require-Capability
    Local   : osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
    Baseline: 
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-jdk14

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-jdk14\target\slf4j-jdk14-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-jdk14/2.0.5/slf4j-jdk14-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.event;version="2.0.5"
              org.slf4j.helpers;version="2.0.5"
              org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.slf4j.jul;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: org.slf4j.jul;version="2.0.5"
  Require-Capability
    Local   : osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
    Baseline: 
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-jdk-platform-logging

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-jdk-platform-logging\target\slf4j-jdk-platform-logging-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-jdk-platform-logging/2.0.5/slf4j-jdk-platform-logging-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.slf4j.jdk.platform.logging;version="2.0.7"
    Baseline: slf4j.jdk.platform.logging;version="2.0.5"
Entries missing in baseline jar
  Bundle-DocURL: https://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=9))"
Entries missing in local jar
  Require-Bundle: slf4j.api
  Bundle-RequiredExecutionEnvironment: JavaSE-9

slf4j-reload4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-reload4j\target\slf4j-reload4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-reload4j/2.0.5/slf4j-reload4j-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.apache.log4j;version="[1.2,2)"
              org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.apache.log4j
              org.slf4j.event;version="2.0.5"
              org.slf4j.helpers;version="2.0.5"
              org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.slf4j.reload4j;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: org.slf4j.reload4j;version="2.0.5"
  Require-Capability
    Local   : osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
    Baseline: 
Entries missing in baseline jar
  Bundle-DocURL: http://reload4j.qos.ch
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-ext

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-ext\target\slf4j-ext-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-ext/2.0.5/slf4j-ext-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.helpers;version="2.0.5"
              org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.slf4j.cal10n;version="2.0.7";uses:="ch.qos.cal10n,org.slf4j,org.slf4j.ext"
              org.slf4j.ext;version="2.0.7";uses:="org.slf4j"
              org.slf4j.profiler;version="2.0.7";uses:="org.slf4j"
    Baseline: org.slf4j.cal10n;version="2.0.5"
              org.slf4j.ext;version="2.0.5"
              org.slf4j.profiler;version="2.0.5"
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

jcl-over-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\jcl-over-slf4j\target\jcl-over-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/jcl-over-slf4j/2.0.5/jcl-over-slf4j-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.apache.commons.logging.impl;version="1.2";uses:="org.apache.commons.logging,org.slf4j,org.slf4j.spi"
    Baseline: org.apache.commons.logging.impl;version="1.2"
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: https://www.apache.org/licenses/LICENSE-2.0.txt
  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

log4j-over-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\log4j-over-slf4j\target\log4j-over-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/log4j-over-slf4j/2.0.5/log4j-over-slf4j-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.spi;version="[1.6.0,3)"
              org.slf4j;version="[1.6.0,3)"
    Baseline: org.slf4j.helpers;version="1.6.0"
              org.slf4j.spi;version="1.6.0"
              org.slf4j;version="1.6.0"
  Export-Package
    Local   : org.apache.log4j.spi;version="1.2.22";uses:="org.apache.log4j"
              org.apache.log4j.xml;version="1.2.22";uses:="org.apache.log4j.spi"
              org.apache.log4j;version="1.2.22";uses:="org.apache.log4j.spi,org.slf4j"
    Baseline: org.apache.log4j.spi;version="1.2.22"
              org.apache.log4j.xml;version="1.2.22"
              org.apache.log4j;version="1.2.22"
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

jul-to-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\jul-to-slf4j\target\jul-to-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/jul-to-slf4j/2.0.5/jul-to-slf4j-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Import-Package
    Local   : org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.spi;version="2.0.5"
              org.slf4j;version="2.0.5"
  Export-Package
    Local   : org.slf4j.bridge;version="2.0.7";uses:="org.slf4j,org.slf4j.spi"
    Baseline: org.slf4j.bridge;version="2.0.5";uses:="org.slf4j,org.slf4j.spi"
Entries missing in baseline jar
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
  Implementation-Title: jul-to-slf4j
  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

osgi-over-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\osgi-over-slf4j\target\osgi-over-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/osgi-over-slf4j/2.0.5/osgi-over-slf4j-2.0.5.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : osgi-over-slf4j
    Baseline: OSGi LogService implemented over SLF4J
  Import-Package
    Local   : org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j;version="2.0.5"
Entries missing in baseline jar
  Automatic-Module-Name: org.slf4j.osgi-over-slf4j
  Bundle-DocURL: http://www.slf4j.org
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
  Bundle-Vendor: SLF4J.ORG
  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-migrator

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-migrator\target\slf4j-migrator-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-migrator/2.0.5/slf4j-migrator-2.0.5.jar!/META-INF/MANIFEST.MF'
Entries missing in baseline jar
  Main-Class: org.slf4j.migrator.Main
Entries missing in local jar
  Bundle-Description: SLF4J Migrator
  Multi-Release: true
  X-Compile-Source-JDK: 8
  X-Compile-Target-JDK: 8
HannesWell commented 1 year ago

And the same baseline comparison against the SLF4J-2.0.6 release (again ignoring Created-By,Originally-Created-By,Build-Jdk-Spec,Tool,Implementation-Version, Bundle-Version headers):

slf4j-api

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-api\target\slf4j-api-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.6/slf4j-api-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : slf4j-api
    Baseline: SLF4J API Module
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.spi;version="[2.0.7,3)"
    Baseline: org.slf4j.event;version="[2.0,3)"
              org.slf4j.helpers;version="[2.0,3)"
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.event;version="2.0.7";uses:="org.slf4j,org.slf4j.helpers"
              org.slf4j.helpers;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.spi"
              org.slf4j.spi;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers"
              org.slf4j;version="2.0.7";uses:="org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: META-INF.versions.9;version="2.0.6"
              org.slf4j.event;version="2.0.6";uses:="org.slf4j,org.slf4j.helpers"
              org.slf4j.helpers;version="2.0.6";uses:="org.slf4j,org.slf4j.event,org.slf4j.spi"
              org.slf4j.spi;version="2.0.6";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers"
              org.slf4j;version="2.0.6";uses:="org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
  Bundle-SymbolicName
    Local   : slf4j.api
    Baseline: org.slf4j.api
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-simple

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-simple\target\slf4j-simple-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/2.0.6/slf4j-simple-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : slf4j-simple
    Baseline: SLF4J Simple Binding
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.event;version="[2.0,3)"
              org.slf4j.helpers;version="[2.0,3)"
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.simple;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: META-INF.versions.9;version="2.0.6"
              org.slf4j.simple;version="2.0.6";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
  Bundle-SymbolicName
    Local   : slf4j.simple
    Baseline: org.slf4j.simple
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8
  Require-Bundle: slf4j.api

slf4j-nop

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-nop\target\slf4j-nop-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-nop/2.0.6/slf4j-nop-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : slf4j-nop
    Baseline: SLF4J NOP Binding
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.helpers;version="[2.0,3)"
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.nop;version="2.0.7";uses:="org.slf4j,org.slf4j.spi"
    Baseline: META-INF.versions.9;version="2.0.6"
              org.slf4j.nop;version="2.0.6";uses:="org.slf4j,org.slf4j.spi"
  Bundle-SymbolicName
    Local   : slf4j.nop
    Baseline: org.slf4j.nop
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-jdk14

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-jdk14\target\slf4j-jdk14-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-jdk14/2.0.6/slf4j-jdk14-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : slf4j-jdk14
    Baseline: SLF4J JDK14 Binding
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.event;version="[2.0,3)"
              org.slf4j.helpers;version="[2.0,3)"
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.jul;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: META-INF.versions.9;version="2.0.6"
              org.slf4j.jul;version="2.0.6";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
  Bundle-SymbolicName
    Local   : slf4j.jdk14
    Baseline: org.slf4j.jdk14
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-jdk-platform-logging

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-jdk-platform-logging\target\slf4j-jdk-platform-logging-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-jdk-platform-logging/2.0.6/slf4j-jdk-platform-logging-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : slf4j-jdk-platform-logging
    Baseline: SLF4J JDK Platform Logging Integration
  Bundle-DocURL
    Local   : https://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.event;version="[2.0,3)"
              org.slf4j.helpers;version="[2.0,3)"
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.jdk.platform.logging;version="2.0.7"
    Baseline: org.slf4j.jdk.platform.logging;version="2.0.6"
  Bundle-SymbolicName
    Local   : slf4j.jdk.platform.logging
    Baseline: org.slf4j.jdk-platform-logging
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-9
  Require-Bundle: slf4j.api

slf4j-reload4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-reload4j\target\slf4j-reload4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-reload4j/2.0.6/slf4j-reload4j-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : slf4j-reload4j
    Baseline: SLF4J Reload4j Binding
  Bundle-DocURL
    Local   : http://reload4j.qos.ch
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.event;version="[2.0.7,3)"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.apache.log4j.spi;version="[1.2,2)"
              org.slf4j.event;version="[2.0,3)"
              org.slf4j.helpers;version="[2.0,3)"
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.reload4j;version="2.0.7";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
    Baseline: org.slf4j.reload4j;version="2.0.6";uses:="org.slf4j,org.slf4j.event,org.slf4j.helpers,org.slf4j.spi"
  Bundle-SymbolicName
    Local   : slf4j.reload4j
    Baseline: org.slf4j.reload4j
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-ext

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-ext\target\slf4j-ext-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-ext/2.0.6/slf4j-ext-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : slf4j-ext
    Baseline: SLF4J Extensions Module
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : ch.qos.cal10n;version="0.8.1";resolution:="optional"
              org.slf4j.helpers;version="[2.0.7,3)"
              org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: ch.qos.cal10n;resolution:="optional"
              javassist.bytecode;resolution:="optional"
              javassist;resolution:="optional"
              org.slf4j.ext;version="[2.0,3)"
              org.slf4j.helpers;version="[2.0,3)"
              org.slf4j.instrumentation
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.cal10n;version="2.0.7";uses:="ch.qos.cal10n,org.slf4j,org.slf4j.ext"
              org.slf4j.ext;version="2.0.7";uses:="org.slf4j"
              org.slf4j.profiler;version="2.0.7";uses:="org.slf4j"
    Baseline: org.slf4j.agent;version="2.0.6"
              org.slf4j.cal10n;version="2.0.6";uses:="ch.qos.cal10n,org.slf4j,org.slf4j.ext"
              org.slf4j.ext;version="2.0.6";uses:="org.slf4j"
              org.slf4j.instrumentation;version="2.0.6";uses:="javassist"
              org.slf4j.profiler;version="2.0.6";uses:="org.slf4j"
              org.slf4j;version="2.0.6"
  Bundle-SymbolicName
    Local   : slf4j.ext
    Baseline: org.slf4j.ext
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

jcl-over-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\jcl-over-slf4j\target\jcl-over-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/jcl-over-slf4j/2.0.6/jcl-over-slf4j-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : jcl-over-slf4j
    Baseline: JCL 1.2 implemented over SLF4J
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.apache.commons.logging.impl;version="1.2";uses:="org.apache.commons.logging,org.slf4j,org.slf4j.spi"
    Baseline: META-INF.versions.9;version="2.0.6"
  Bundle-SymbolicName
    Local   : jcl.over.slf4j
    Baseline: org.slf4j.jcl-over-slf4j
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

log4j-over-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\log4j-over-slf4j\target\log4j-over-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/log4j-over-slf4j/2.0.6/log4j-over-slf4j-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : log4j-over-slf4j
    Baseline: Log4j Implemented Over SLF4J
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.spi;version="[1.6.0,3)"
              org.slf4j;version="[1.6.0,3)"
    Baseline: javax.xml.parsers
              org.apache.log4j.helpers;version="[1.2,2)"
              org.apache.log4j.spi;version="[1.2,2)"
              org.apache.log4j;version="[1.2,2)"
              org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
              org.w3c.dom
  Export-Package
    Local   : org.apache.log4j.xml;version="1.2.22";uses:="org.apache.log4j.spi"
    Baseline: META-INF.versions.9;version="2.0.6"
              org.apache.log4j.xml;version="1.2.22";uses:="javax.xml.parsers,org.apache.log4j.spi,org.w3c.dom"
  Bundle-SymbolicName
    Local   : log4j.over.slf4j
    Baseline: org.slf4j.log4j-over-slf4j
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

jul-to-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\jul-to-slf4j\target\jul-to-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/jul-to-slf4j/2.0.6/jul-to-slf4j-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : jul-to-slf4j
    Baseline: JUL to SLF4J bridge
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j.spi;version="[2.0.7,3)"
              org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j.spi;version="[2.0,3)"
              org.slf4j;version="[2.0,3)"
  Export-Package
    Local   : org.slf4j.bridge;version="2.0.7";uses:="org.slf4j,org.slf4j.spi"
    Baseline: org.slf4j.bridge;version="2.0.6";uses:="org.slf4j,org.slf4j.spi"
  Bundle-SymbolicName
    Local   : jul.to.slf4j
    Baseline: org.slf4j.jul-to-slf4j
Entries missing in baseline jar
  Implementation-Title: jul-to-slf4j
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

osgi-over-slf4j

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\osgi-over-slf4j\target\osgi-over-slf4j-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/osgi-over-slf4j/2.0.6/osgi-over-slf4j-2.0.6.jar!/META-INF/MANIFEST.MF'
Common Headers with different values
  Bundle-Name
    Local   : osgi-over-slf4j
    Baseline: OSGi LogService implemented over SLF4J
  Bundle-DocURL
    Local   : http://www.slf4j.org
    Baseline: http://www.qos.ch
  Bundle-Vendor
    Local   : SLF4J.ORG
    Baseline: QOS.ch
  Import-Package
    Local   : org.slf4j;version="[2.0.7,3)"
    Baseline: org.slf4j;version="[2.0,3)"
Entries missing in baseline jar
  Automatic-Module-Name: org.slf4j.osgi-over-slf4j
Entries missing in local jar
  Bundle-RequiredExecutionEnvironment: JavaSE-1.8

slf4j-migrator

Load local Manifest from jar 'C:\dev\git\qos-ch.slf4j\slf4j-migrator\target\slf4j-migrator-2.0.7-SNAPSHOT.jar'
Load baseline Manifest from jar 'jar:https://repo1.maven.org/maven2/org/slf4j/slf4j-migrator/2.0.6/slf4j-migrator-2.0.6.jar!/META-INF/MANIFEST.MF'
Entries missing in baseline jar
  Main-Class: org.slf4j.migrator.Main
Entries missing in local jar
  Bundle-Description: SLF4J Migrator
  Bundle-DocURL: http://www.qos.ch
  Bundle-License: http://www.opensource.org/licenses/mit-license.php
  Bundle-ManifestVersion: 2
  Bundle-Name: SLF4J Migrator
  Bundle-SymbolicName: org.slf4j.migrator
  Bundle-Vendor: QOS.ch
  Export-Package: org.slf4j.migrator;uses:="org.slf4j.migrator.line";version="2.0.6",org.slf4j.migrator.line;version="2.0.6",org.slf4j.migrator.helper;uses:="javax.swing";version="2.0.6"
  Import-Package: javax.swing,org.slf4j.migrator.helper,org.slf4j.migrator.line
  Multi-Release: true
  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
  X-Compile-Source-JDK: 8
  X-Compile-Target-JDK: 8
stbischof commented 1 year ago

I highly recommend to NOT use felix maven bundle plugin.

The bnd maven Plugin gives much better support. And Felix just uses bnd.

I also started a pr that uses bnd.this is closed. But the project seems to like management ot the osgi metadata by hand.

HannesWell commented 1 year ago

I highly recommend to NOT use felix maven bundle plugin.

The bnd maven Plugin gives much better support. And Felix just uses bnd.

Yes I would like to do that (and even suggested to use the bnd-maven-plugin in the initially mentioned PR), but the bnd-maven-plugin fails to process the multi-release jars for Java-9 that contain a separated modules-info: https://github.com/bndtools/bnd/issues/5346#issuecomment-1352307604

laeubi commented 1 year ago

The bnd maven Plugin gives much better support.

To be honest every-time I asked for "support" at BND it ended in disaster complaining that BND is doing all fine and it is just the projects fault not being "enlightened" enough by the glory of BND ... so I can absolutely understand if projects like to use plugins with "less support" that simply work and solve real world development issues.

but the bnd-maven-plugin fails to process the multi-release jars for Java-9 that contain a separated modules-info

I even created PRs with fully working code to fix this specific issue:

but they are delayed for probably NIH or whatever... but I think my idea of MR-JAR support can be applied to Felix as well (even though it would be a bit more to fiddle around to overcome the current limitations of the bnd-Jar implementation) that works as follows:

  1. Create the bnd-jar for project and dependencies
  2. Scan for the versions folder to get all versions of project+dependencies
  3. copy each bnd-jar for each version and strip/replace the versioned items including a default jar
  4. compute each manifest, strip the extranous ones from the versioned manifest and insert these into the original bnd-jar

as this is all just a few loops over in-memorry representation that's quite fast and then Felix could process MR-jars even more comfortable.

stbischof commented 1 year ago

As pointed out in the discussion, it would be usefully to really use bnd and baselining to NOT BREAK the API again. https://github.com/bndtools/bnd/pull/5477

HannesWell commented 1 year ago

I managed to make the bnd-maven-plugin working, the fixupmessages instruction did the trick. @stbischof thanks for that hint (via private chat). Now that the tooling works, can we now please focus on the outcome. :)

I'm currently unsure if it is sufficient to have Import-Package version ranges for the slf4j packages that only contain the minor version (like version="[2.0,3)") or if it should be better also include the current service/micro version in the lower bound (like version="[2.0.7,3)". That latter one is what this PR is currently doing, but the former would be simpler because it is what BND-tools (which the maven-bundle-plugin uses under the hood) is doing by default. However my first impuls would be that a library should never (self-)import a lower version of itself.

Im torn about that point. @laeubi, @stbischof what's your opinion about that?

@ceki from https://github.com/qos-ch/slf4j/pull/320#issuecomment-1294801783 I assume that you would probably prefer to not use the bnd-annotations to let the bnd-maven-plugin generate the service-mediator capabilities in the Manifest. In my opinion they significantly simply the maintenance of the metadata and since these are build-time dependencies don't add any burden to clients/providers of slf4j. But in case you insist to not use them I applied them in a second commit, that can be reverted easily in that case. But you can also see from that how the metadata maintenance is simplified. :)

laeubi commented 1 year ago

I managed to make the bnd-maven-plugin working, the fixupmessages instruction did the trick.

This actually just hides the issue than "fix" it see:

what's your opinion about that?

No idea, actually BND should generate this automatically as far as I know, so I would just reuse that.

HannesWell commented 1 year ago

I managed to make the bnd-maven-plugin working, the fixupmessages instruction did the trick.

This actually just hides the issue than "fix" it see:

That's right. But since BND (should) not do anything in this regard that let workarund lets the build suceed.

what's your opinion about that?

No idea, actually BND should generate this automatically as far as I know, so I would just reuse that.

By default BND creats imports that only specify Major and minor Version bounds, which leaves room for smaller service Versions. But I would Say a Lob should not self-Import potentially older versions.

laeubi commented 1 year ago

But I would Say a Lob should not self-Import potentially older versions.

Why? the contract is that is is compatible for providers, otherwise an import of API would not make much sense if it can only replace the exact version.

laeubi commented 1 year ago

That's right. But since BND (should) not do anything in this regard that let workarund lets the build suceed.

I might be confused by as you wrote:

Add Automatic-Module headers for those artifacts that don't have a module-info.java

so I assumed you want to generate those module-info with BND as well...

HannesWell commented 1 year ago

But I would Say a Lob should not self-Import potentially older versions.

Why? the contract is that is is compatible for providers, otherwise an import of API would not make much sense if it can only replace the exact version.

I was thinking about the case where a client explicitly imports org.slf4j;version="[2.0.5,3)" (for whatever reason). Now slf4j-api 2.0.5 exports that package in version 2.0.5 and imports it with version="[2.0,3)". Therefore it could theoretically happen, if eg. slf4j-api 2.0.1 is present that slf4j-api-2.0.5 is wired to the package in version 2.0.1 and the therefore the client is using that as well.

But I think in that case the client should either ensure that only the intended version is present in the TP or that at least there are no other (version) restrictions that prevent the OSGi resolver from wiring to the latest version possible. Therefore I just stick with the defaults now.

That's right. But since BND (should) not do anything in this regard that let workarund lets the build suceed.

I might be confused by as you wrote:

Add Automatic-Module headers for those artifacts that don't have a module-info.java

so I assumed you want to generate those module-info with BND as well...

No that was not my goal. But if @ceki is interested and BND supports multi-release jars, that's IMHO something to consider.

ceki commented 1 year ago

@HannesWell Given new SLF4J packages are added infrequently, automation of OSGi metadata creation is not a priority at this time. Adding a new dependency on "biz.aQute.bnd.annotation" will not fly. As such I am closing this PR without merging.

ceki commented 1 year ago

@HannesWell Notwithstanding the above, thank you very much for this PR.

HannesWell commented 1 year ago

@HannesWell Given new SLF4J packages are added infrequently, automation of OSGi metadata creation is not a priority at this time. Adding a new dependency on "biz.aQute.bnd.annotation" will not fly. As such I am closing this PR without merging.

From https://github.com/qos-ch/slf4j/pull/320 (which I noticed after creating this PR) I already expected your dislike of using the bnd-annotations in slf4j and therefore updated this PR and extracted the usage of said annotations in a separate commit of this PR. Please re-open this PR, so I can update it and remove that last commit and still land the the other changes in metadata that come with it. Currently the OSGi metadata are broken mainly because the Bundle-SymbolicName changed since the last release (due to #324) but some slf4j artifacts Require the old bundle name.

This is the full list of enhancements that come with this PR from my initial comment:

You may also want to consider #328 before this one, which contains the very first commit of this PR that only contains the formatting changes.

stbischof commented 1 year ago

@ceki is that an architectural or financial issue?

automation of OSGi metadata creation is not a priority at this time.

ceki commented 1 year ago

@stbischof Here is a fuller quote:

Given new SLF4J packages are added infrequently, automation of OSGi metadata creation is not a priority at this time.

I don't see the need to fix something which is (at a cursory look) not broken.

stbischof commented 1 year ago

The main benefit for us here is to improve osgi metadata with an automatic build and to secure it with a baseline.

Bnd annotations not required.

And we may are able to sponsor this.

HannesWell commented 1 year ago

@stbischof Here is a fuller quote:

Given new SLF4J packages are added infrequently, automation of OSGi metadata creation is not a priority at this time.

I don't see the need to fix something which is (at a cursory look) not broken.

It is currently broken as described in my last comment. Some things were broken recently (the Bundle-SymbolicName), some are broken for a longer time (the Main-Class-entry for the migrator). And as also said it is no problem to revert the annotations part, but the manifests should be fixed.

Therefore I asked you to reopen this PR to discuss how to make this change fine for you. :)

ceki commented 1 year ago

@HannesWell Can you please open a new minimal PR and propose changes to just one module, say slf4j-api.

HannesWell commented 1 year ago

@HannesWell Can you please open a new PR and propose changes to just one module, say slf4j-api.

Sure I can create a new PR and strip the changes of this one down to the required minimum. But I think it requires more changes to apply it only to sl4j-api module instead of all, especially since almost all modules are affected by in some way. But I will make a first proposal and we can discuss how to land it.

HannesWell commented 1 year ago

Created https://github.com/qos-ch/slf4j/pull/330.