You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2021/02/02 23:20:04 UTC
[felix-dev] branch master updated: FELIX-6287: Support running the
framework and the main on the module path
This is an automated email from the ASF dual-hosted git repository.
pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new bc66937 FELIX-6287: Support running the framework and the main on the module path
bc66937 is described below
commit bc669376c0a1a26fa8ef60854a7b458ceba2e22b
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Wed Feb 3 00:19:52 2021 +0100
FELIX-6287: Support running the framework and the main on the module path
---
framework/pom.xml | 54 +++++++++++++++
.../java/org/apache/felix/framework/util/Util.java | 18 +++--
main/pom.xml | 80 ++++++++++++++++++----
3 files changed, 134 insertions(+), 18 deletions(-)
diff --git a/framework/pom.xml b/framework/pom.xml
index f987bac..0b2499b 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -42,6 +42,60 @@
<build>
<plugins>
<plugin>
+ <groupId>org.moditect</groupId>
+ <artifactId>moditect-maven-plugin</artifactId>
+ <version>1.0.0.RC1</version>
+ <executions>
+ <execution>
+ <id>add-module-infos</id>
+ <phase>package</phase>
+ <goals>
+ <goal>add-module-info</goal>
+ </goals>
+ <configuration>
+ <module>
+ <moduleInfoSource>
+ open module org.apache.felix.framework {
+ requires jdk.unsupported;
+
+ exports org.apache.felix.framework.ext;
+ exports org.osgi.dto;
+ exports org.osgi.framework;
+ exports org.osgi.framework.connect;
+ exports org.osgi.framework.dto;
+ exports org.osgi.framework.hooks.bundle;
+ exports org.osgi.framework.hooks.resolver;
+ exports org.osgi.framework.hooks.service;
+ exports org.osgi.framework.hooks.weaving;
+ exports org.osgi.framework.launch;
+ exports org.osgi.framework.namespace;
+ exports org.osgi.framework.startlevel;
+ exports org.osgi.framework.startlevel.dto;
+ exports org.osgi.framework.wiring;
+ exports org.osgi.framework.wiring.dto;
+ exports org.osgi.resource;
+ exports org.osgi.resource.dto;
+ exports org.osgi.service.condition;
+ exports org.osgi.service.packageadmin;
+ exports org.osgi.service.resolver;
+ exports org.osgi.service.startlevel;
+ exports org.osgi.service.url;
+ exports org.osgi.util.tracker;
+ provides org.osgi.framework.launch.FrameworkFactory with
+ org.apache.felix.framework.FrameworkFactory;
+ provides org.osgi.framework.connect.ConnectFrameworkFactory with
+ org.apache.felix.framework.FrameworkFactory;
+
+ uses org.apache.felix.framework.ext.ClassPathExtenderFactory;
+ uses org.osgi.framework.connect.FrameworkUtilHelper;
+ }
+ </moduleInfoSource>
+ </module>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
diff --git a/framework/src/main/java/org/apache/felix/framework/util/Util.java b/framework/src/main/java/org/apache/felix/framework/util/Util.java
index b8618bb..ee25452 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/Util.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/Util.java
@@ -185,8 +185,9 @@ public class Util
Class<?> c_Exports = Felix.class.getClassLoader().loadClass("java.lang.module.ModuleDescriptor$Exports");
Method m_getLayer = c_Module.getMethod("getLayer");
Method m_getModule = Class.class.getMethod("getModule");
- Method m_canRead = c_Module.getMethod("canRead", c_Module);
Method m_getName = c_Module.getMethod("getName");
+ Method isAutomatic = c_Descriptor.getMethod("isAutomatic");
+ Method packagesMethod = c_Descriptor.getMethod("packages");
Object self = m_getModule.invoke(Felix.class);
Object moduleLayer = m_getLayer.invoke(self);
@@ -198,7 +199,7 @@ public class Util
for (Object module : ((Iterable) c_ModuleLayer.getMethod("modules").invoke(moduleLayer)))
{
- if ((Boolean) m_canRead.invoke(self, module))
+ if (!self.equals(module))
{
String name = (String) m_getName.invoke(module);
@@ -206,13 +207,20 @@ public class Util
Object descriptor = c_Module.getMethod("getDescriptor").invoke(module);
- for (Object export :((Set) c_Descriptor.getMethod("exports").invoke(descriptor)))
+ if (!((Boolean) isAutomatic.invoke(descriptor)))
{
- if (((Set) c_Exports.getMethod("targets").invoke(export)).isEmpty())
+ for (Object export : ((Set) c_Descriptor.getMethod("exports").invoke(descriptor)))
{
- pkgs.add((String) c_Exports.getMethod("source").invoke(export));
+ if (((Set) c_Exports.getMethod("targets").invoke(export)).isEmpty())
+ {
+ pkgs.add((String) c_Exports.getMethod("source").invoke(export));
+ }
}
}
+ else
+ {
+ pkgs.addAll((Set<String>) packagesMethod.invoke(descriptor));
+ }
result.put(name, pkgs);
}
}
diff --git a/main/pom.xml b/main/pom.xml
index 9cc2536..e3d4e71 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.apache.felix</groupId>
<artifactId>felix-parent</artifactId>
- <version>5</version>
+ <version>6</version>
<relativePath>../pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -43,6 +43,7 @@
</dependencies>
<properties>
<log.level>4</log.level>
+ <felix.java.version>8</felix.java.version>
<dollar>$</dollar>
<gogo.runtime.version>1.1.4</gogo.runtime.version>
<gogo.jline.shell.version>1.1.8</gogo.jline.shell.version>
@@ -63,18 +64,71 @@
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
- <target>1.5</target>
- <source>1.5</source>
+ <skip>true</skip>
</configuration>
- </plugin>
+ </plugin>
+ <plugin>
+ <groupId>org.moditect</groupId>
+ <artifactId>moditect-maven-plugin</artifactId>
+ <version>1.0.0.RC1</version>
+ <executions>
+ <execution>
+ <id>add-module-infos</id>
+ <phase>package</phase>
+ <goals>
+ <goal>add-module-info</goal>
+ </goals>
+ <configuration>
+ <module>
+ <moduleInfoSource>
+ open module org.apache.felix.main {
+ requires jdk.unsupported;
+
+ exports org.apache.felix.framework.ext;
+ exports org.osgi.dto;
+ exports org.osgi.framework;
+ exports org.osgi.framework.connect;
+ exports org.osgi.framework.dto;
+ exports org.osgi.framework.hooks.bundle;
+ exports org.osgi.framework.hooks.resolver;
+ exports org.osgi.framework.hooks.service;
+ exports org.osgi.framework.hooks.weaving;
+ exports org.osgi.framework.launch;
+ exports org.osgi.framework.namespace;
+ exports org.osgi.framework.startlevel;
+ exports org.osgi.framework.startlevel.dto;
+ exports org.osgi.framework.wiring;
+ exports org.osgi.framework.wiring.dto;
+ exports org.osgi.resource;
+ exports org.osgi.resource.dto;
+ exports org.osgi.service.condition;
+ exports org.osgi.service.packageadmin;
+ exports org.osgi.service.resolver;
+ exports org.osgi.service.startlevel;
+ exports org.osgi.service.url;
+ exports org.osgi.util.tracker;
+ provides org.osgi.framework.launch.FrameworkFactory with
+ org.apache.felix.framework.FrameworkFactory;
+ provides org.osgi.framework.connect.ConnectFrameworkFactory with
+ org.apache.felix.framework.FrameworkFactory;
+ uses org.apache.felix.framework.ext.ClassPathExtenderFactory;
+ uses org.osgi.framework.connect.FrameworkUtilHelper;
+ }
+ </moduleInfoSource>
+ <mainClass>org.apache.felix.main.Main</mainClass>
+ </module>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>2.5.0</version>
+ <version>5.1.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -84,7 +138,7 @@
<Bundle-Name>Apache Felix</Bundle-Name>
<Bundle-Description>OSGi R6 framework.</Bundle-Description>
<Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
- <Embed-Dependency>*;artifactId=org.apache.felix.framework;inline=true</Embed-Dependency>
+ <Embed-Dependency>*;artifactId=org.apache.felix.framework;inline=default.properties|org/**|META-INF/services/**</Embed-Dependency>
<Private-Package>org.apache.felix.main.*</Private-Package>
<Export-Package>!org.osgi.service.log, !org.osgi.service.obr, org.osgi.*</Export-Package>
<Import-Package>!*</Import-Package>
@@ -190,11 +244,11 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <failOnError>false</failOnError>
- </configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <failOnError>false</failOnError>
+ </configuration>
</plugin>
</plugins>
<resources>