You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2018/04/27 09:59:54 UTC

[sling-org-apache-sling-feature-launcher] 03/16: SLING-7512 Order features based on their dependencies.

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

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git

commit 373e578e57f6944446f37e043413bb79720d0262
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Fri Feb 23 13:42:28 2018 +0000

    SLING-7512 Order features based on their dependencies.
    
    Very initial implementation which contains the refactoring of
    Requirements and Capabilities to use the OSGi ones.
---
 pom.xml                                                     |  5 +++++
 .../sling/feature/launcher/impl/FeatureProcessor.java       | 13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6bf9943..8e1d828 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,6 +95,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.resolver</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature.support</artifactId>
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
diff --git a/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java b/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
index 16c244b..d4e70e2 100644
--- a/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
+++ b/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -29,6 +30,8 @@ import org.apache.sling.feature.Configuration;
 import org.apache.sling.feature.Extension;
 import org.apache.sling.feature.ExtensionType;
 import org.apache.sling.feature.launcher.impl.LauncherConfig.StartupMode;
+import org.apache.sling.feature.process.FeatureResolver;
+import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.ArtifactHandler;
 import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.FeatureUtil;
@@ -46,7 +49,7 @@ public class FeatureProcessor {
     public static Application createApplication(final LauncherConfig config,
             final ArtifactManager artifactManager)
     throws IOException {
-        final Application app;
+        Application app = null;
         if ( config.getApplicationFile() != null ) {
             String absoluteArg = config.getApplicationFile();
             if ( absoluteArg.indexOf(":") < 2 ) {
@@ -59,7 +62,13 @@ public class FeatureProcessor {
             }
 
         } else {
-           app = FeatureUtil.assembleApplication(null, artifactManager, FeatureUtil.getFeatureFiles(config.getHomeDirectory(), config.getFeatureFiles()).toArray(new String[0]));
+            try (FeatureResolver resolver = new FrameworkResolver(artifactManager, Collections.emptyMap())) {
+                app = FeatureUtil.assembleApplication(null, artifactManager, resolver,
+                       FeatureUtil.getFeatureFiles(config.getHomeDirectory(), config.getFeatureFiles()).toArray(new String[0]));
+            } catch (Exception ex) {
+                Main.LOG().error("Error while assembling application: {}", ex.getMessage(), ex);
+                System.exit(1);
+            }
         }
 
         // write application back

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.