You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by tj...@apache.org on 2021/02/12 19:22:43 UTC

[felix-atomos] branch master updated: Update to 21.0 native-image-maven-plugin for substrate lib example

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

tjwatson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-atomos.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ca7837  Update to 21.0 native-image-maven-plugin for substrate lib example
4ca7837 is described below

commit 4ca78374096ef372fab889d8803f993cc8d57586
Author: Thomas Watson <tj...@us.ibm.com>
AuthorDate: Fri Feb 12 13:22:11 2021 -0600

    Update to 21.0 native-image-maven-plugin for substrate lib example
    
    Small updates to readme files.
---
 atomos.examples/SUBSTRATE.md                          | 14 +++++++-------
 atomos.examples/atomos.examples.substrate.lib/pom.xml | 12 ++++++++++--
 atomos.examples/pom.xml                               |  4 ++--
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/atomos.examples/SUBSTRATE.md b/atomos.examples/SUBSTRATE.md
index f745ee6..edf8d91 100644
--- a/atomos.examples/SUBSTRATE.md
+++ b/atomos.examples/SUBSTRATE.md
@@ -1,16 +1,18 @@
 # Building Substrate Examples
 
-The example projects that build Graal Substrate native-images are not built as part of the main Atomos build because they require an installation of GraalVM CE 20.2.0 (Java 8 or Java 11 can be used) and the native-image tools for Substrate. The Java 11 version of Graal Substrate does not currently support full introspection at image runtime of the Java Platform Module System. Atomos Module support expects to have full introspection of the Java Platform Module System when running on Java  [...]
+The example projects that build Graal Substrate native-images are not built as part of the main Atomos build because they require an installation of GraalVM CE 21.0.0.2 (Java 8 or Java 11 can be used) and the native-image tools for Substrate. The Java 11 version of Graal Substrate does not currently support full introspection at image runtime of the Java Platform Module System. Atomos Module support expects to have full introspection of the Java Platform Module System when running on Jav [...]
 
 To build the native image examples you must install the native image support for Graal (see https://www.graalvm.org/docs/reference-manual/native-image/).  You need to run the `gu` command that comes with Graal VM:
 
 `gu install native-image`
 
-If you are using GraalVM CE 20.2.0 Java 11 then you can build all of Atomos, including the substrate examples, with the following single maven build using the `substrate` profile:
+If you are using GraalVM CE 21.0.0.2 Java 11 then you can build all of Atomos, including the substrate examples, with the following single maven build using the `substrate` profile:
 
 `./mvnw clean install -Pjava8 -Psubstrate -Pequinox`
 
-If using GraalVM CE 20.2.0 Java 8 then you must first use Java 11 for the main Atomos build using the Java 8 profile:
+There is currently an issue using GraalVM to build the jlink example image (see https://github.com/oracle/graal/issues/3090)
+that prevents running the complete build because the jlink example will fail.
+If using GraalVM CE 21.0.0.2 Java 8 then you must first use Java 11 for the main Atomos build using the Java 8 profile:
 
 `./mvnw clean install -Pjava8 -Pequinox`
 
@@ -18,10 +20,8 @@ To use the Felix Framework use `-Pfelix` instead of `-Pequinox`
 
 Note that `install` target must be used so that Atomos is installed into your local m2 repository. This still requires Java 11 to be used to build but the result allows the `atomos.framework` JAR to be used on Java 8. Next you must switch to a Java installation of Graal with the Substrate native-image tools installed and then run the maven builds for the substrate example projects:
 
-This will create a `target/atomos` executable in each substrate example project. If you launch `atomos` it will give you a gogo `g!` prompt to run gogo commands.  Also included in this example is a version of the Felix web console.  The web console can be access with http://localhost:8080/system/console/bundles and the id/password is admin/admin.
+For the [Atomos native-image lib folder example](atomos.examples.substrate.lib/README.md) a directory `target/atomos_lib/` is created.  This contains all the original bundle JARs that got compiled into the native image `atomos`.  In order to launch the native `atomos` you must be in the directory containing both `atomos` and the `atomos_lib/` folder.  This is a simple way for Atomos to discover the available bundles and load additional bundle entries at runtime.
 
-For the lib example a directory `target/atomos_lib/` is created.  This contains all the original bundle JARs that got compiled into the native image `atomos`.  In order to launch the native `atomos` you must be in the directory containing both `atomos` and the `atomos_lib/` folder.  This is a simple way for Atomos to discover the available bundles and load additional bundle entries at runtime.
-
-Alternatively a substrate image can be created that does not rely on the directory `target/atomos_lib/` to discover the bundles.  Instead the bundle entry resources can be placed in an `atomos/` folder which is placed on the classpath during native image compilation. The resources from the `atomos/` folder can then be included in the native image.  The `atomos/` folder has a file `bundles.index` that contains information for Atomos to discover the bundles and their entries that are inclu [...]
+Alternatively a substrate image can be created that does not rely on the directory `target/atomos_lib/` to discover the bundles.  Instead the bundle entry resources can be placed in an `atomos/` folder which is placed on the classpath during native image compilation. The resources from the `atomos/` folder can then be included in the native image.  The `atomos/` folder has a file `bundles.index` that contains information for Atomos to discover the bundles and their entries that are inclu [...]
 
 If substrate adds full introspection to the Java Platform Module System in the future it could allow Atomos to discover the modules within the image and load them as bundles.  If a proper module reader could be obtained and it contains the necessary resources from the original bundle JARs then it would eliminate the need for the `atomos_lib/` or `atomos/` resource folder for running a native image.
diff --git a/atomos.examples/atomos.examples.substrate.lib/pom.xml b/atomos.examples/atomos.examples.substrate.lib/pom.xml
index c11dd41..ca5e684 100644
--- a/atomos.examples/atomos.examples.substrate.lib/pom.xml
+++ b/atomos.examples/atomos.examples.substrate.lib/pom.xml
@@ -150,7 +150,7 @@
             <plugin>
                 <groupId>org.graalvm.nativeimage</groupId>
                 <artifactId>native-image-maven-plugin</artifactId>
-                <version>20.2.0</version>
+                <version>21.0.0</version>
                 <executions>
                     <execution>
                         <goals>
@@ -166,7 +166,15 @@
                         --no-server
                         --allow-incomplete-classpath
                         --no-fallback
-                        --initialize-at-build-time=org.eclipse.jetty.util.TypeUtil,org.eclipse.jetty.http.HttpTokens,org.eclipse.jetty.util.log.Log,org.eclipse.jetty.util.log.StdErrLog,org.eclipse.jetty.util.Uptime,org.eclipse.jetty.server.HttpOutput,org.apache.felix.atomos,javax.servlet,org.apache.felix.service.command.Converter
+                        --initialize-at-build-time=org.eclipse.jetty.util.TypeUtil
+                        --initialize-at-build-time=org.eclipse.jetty.http.HttpTokens
+                        --initialize-at-build-time=org.eclipse.jetty.util.log.Log
+                        --initialize-at-build-time=org.eclipse.jetty.util.log.StdErrLog
+                        --initialize-at-build-time=org.eclipse.jetty.util.Uptime
+                        --initialize-at-build-time=org.eclipse.jetty.server.HttpOutput
+                        --initialize-at-build-time=org.apache.felix.atomos
+                        --initialize-at-build-time=javax.servlet
+                        --initialize-at-build-time=org.apache.felix.service.command.Converter
                         -H:ReflectionConfigurationFiles=${project.basedir}/graal_class_config.json
                         -H:ResourceConfigurationFiles=${project.basedir}/graal_resource_config.json
                         -H:DynamicProxyConfigurationFiles=${project.basedir}/graal_proxy_config.json
diff --git a/atomos.examples/pom.xml b/atomos.examples/pom.xml
index 8354a52..4d6712c 100644
--- a/atomos.examples/pom.xml
+++ b/atomos.examples/pom.xml
@@ -17,8 +17,8 @@
     <modules>
         <module>atomos.examples.webconsole.bom</module>
         <module>atomos.examples.index</module>
-        <module>atomos.examples.jlink</module>
         <module>atomos.examples.springloader</module>
+        <module>atomos.examples.jlink</module>
     </modules>
     <profiles>
         <profile>
@@ -28,10 +28,10 @@
                 <module>atomos.examples.index</module>
                 <module>atomos.examples.jaxrs.bundle</module>
                 <module>atomos.examples.jaxrs</module>
-                <module>atomos.examples.jlink</module>
                 <module>atomos.examples.springloader</module>
                 <module>atomos.examples.substrate.lib</module>
                 <module>atomos.examples.substrate.maven</module>
+                <module>atomos.examples.jlink</module>
             </modules>
         </profile>
     </profiles>