sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [sling-org-apache-sling-feature-applicationbuilder] 04/21: SLING-7512 Order features based on their dependencies.
Date Fri, 27 Apr 2018 09:57:20 GMT
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-applicationbuilder.git

commit f77bb7faf0ca5892db498ad7986a2e1367360198
Author: David Bosschaert <bosschae@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                                               | 13 +++++++++++++
 .../sling/feature/applicationbuilder/impl/Main.java   | 19 ++++++++++++-------
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index c30dc54..a61c49f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.resolver</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature.support</artifactId>
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>
@@ -118,6 +124,13 @@
             <version>0.1.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.configurator</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+                
       <!-- Testing -->
         <dependency>
         	<groupId>junit</groupId>
diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 9964a3e..db733cb 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -19,6 +19,7 @@ package org.apache.sling.feature.applicationbuilder.impl;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.Collections;
 import java.util.stream.Stream;
 
 import org.apache.commons.cli.CommandLine;
@@ -29,6 +30,8 @@ import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.process.FeatureResolver;
+import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.FeatureUtil;
@@ -118,6 +121,10 @@ public class Main {
         return null;
     }
 
+    private static FeatureResolver getFeatureResolver(ArtifactManager am) {
+        return new FrameworkResolver(am, Collections.emptyMap());
+    }
+
     public static void main(final String[] args) {
         // setup logging
         System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info");
@@ -132,11 +139,6 @@ public class Main {
 
         parseArgs(args);
 
-        final ArtifactManagerConfig amConfig = new ArtifactManagerConfig();
-        if ( repoUrls != null ) {
-            amConfig.setRepositoryUrls(repoUrls.split(","));
-        }
-
         final ArtifactManager am = getArtifactManager();
 
 
@@ -160,12 +162,15 @@ public class Main {
             System.exit(1);
         }
 
-        try {
-            writeApplication(buildApplication(FeatureUtil.assembleApplication(null, am, files)),
output == null ? "application.json" : output);
+        try (FeatureResolver fr = getFeatureResolver(am)) {
+            writeApplication(buildApplication(FeatureUtil.assembleApplication(null, am, fr,
files)), output == null ? "application.json" : output);
 
         } catch ( final IOException ioe) {
             LOGGER.error("Unable to read feature/application files " + ioe.getMessage(),
ioe);
             System.exit(1);
+        } catch ( final Exception e) {
+            LOGGER.error("Problem generating application", e);
+            System.exit(1);
         }
     }
 

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

Mime
View raw message