This is an automated email from the ASF dual-hosted git repository.

pkarwasz pushed a commit to branch fix/rebase-on-log4j-api-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 030e2da0783c804f72b44d18bbd134d26f159c57
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Mon Mar 25 23:40:47 2024 +0100

    Fix OSGi configuration
---
 log4j-1.2-api/pom.xml                              |  6 +++--
 log4j-core/pom.xml                                 |  5 ++++
 .../log4j/core/impl/internal/Activator.java        | 30 ++++++++++++++++++++++
 log4j-plugins/pom.xml                              |  5 +++-
 .../logging/log4j/plugins/util/package-info.java   |  5 ++++
 5 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml
index 57855caba9..ae283d8a4c 100644
--- a/log4j-1.2-api/pom.xml
+++ b/log4j-1.2-api/pom.xml
@@ -40,8 +40,10 @@
       org.jspecify.annotations.*;resolution:=optional,
       <!-- JMX support -->
       com.sun.jdmk.comm;resolution:=optional,
-      <!-- Log4j Core is optional -->
-      org.apache.logging.log4j.core.*;resolution:=optional
+      <!-- Log4j Core, Kit and Plugins are optional -->
+      org.apache.logging.log4j.core.*;resolution:=optional,
+      org.apache.logging.log4j.kit.*;resolution:=optional,
+      org.apache.logging.log4j.plugins.*;resolution:=optional
     </bnd-extra-package-options>
     <Fragment-Host>org.apache.logging.log4j.core</Fragment-Host>
     <!-- we have an `bnd.bnd` file to override the parent's defaults -->
diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml
index ef38f7dc9d..78dd629020 100644
--- a/log4j-core/pom.xml
+++ b/log4j-core/pom.xml
@@ -65,6 +65,11 @@
     </bnd-extra-module-options>
   </properties>
   <dependencies>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.framework</artifactId>
+      <scope>provided</scope>
+    </dependency>
     <!-- Naturally, all implementations require the log4j-api JAR -->
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/internal/Activator.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/internal/Activator.java
new file mode 100644
index 0000000000..2d12905ce3
--- /dev/null
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/internal/Activator.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.core.impl.internal;
+
+import org.apache.logging.log4j.core.impl.Log4jProvider;
+import org.apache.logging.log4j.util.ProviderActivator;
+import org.osgi.annotation.bundle.Header;
+import org.osgi.framework.Constants;
+
+@Header(name = Constants.BUNDLE_ACTIVATOR, value = "${@class}")
+@Header(name = Constants.BUNDLE_ACTIVATIONPOLICY, value = 
Constants.ACTIVATION_LAZY)
+public class Activator extends ProviderActivator {
+    public Activator() {
+        super(new Log4jProvider());
+    }
+}
diff --git a/log4j-plugins/pom.xml b/log4j-plugins/pom.xml
index 5c6e0d27ec..4dcadb0841 100644
--- a/log4j-plugins/pom.xml
+++ b/log4j-plugins/pom.xml
@@ -28,12 +28,15 @@
   <packaging>jar</packaging>
   <name>Apache Log4j Plugins</name>
   <description>Log4j Plugin Support</description>
+
   <properties>
     <bnd-extra-package-options>
       <!-- External optional dependencies -->
-      com.google.errorprone.annotations.concurrent;resolution:=optional
+      com.google.errorprone.annotations.concurrent;resolution:=optional,
+      org.jspecify.annotations.*;resolution:=optional
     </bnd-extra-package-options>
   </properties>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
diff --git 
a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/package-info.java
 
b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/package-info.java
index ac3540396d..78debad651 100644
--- 
a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/package-info.java
+++ 
b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/package-info.java
@@ -14,4 +14,9 @@
  * See the license for the specific language governing permissions and
  * limitations under the license.
  */
+@Export
+@Version("3.0.0")
 package org.apache.logging.log4j.plugins.util;
+
+import org.osgi.annotation.bundle.Export;
+import org.osgi.annotation.versioning.Version;

Reply via email to