schaefa commented on a change in pull request #49: Replacement PR for #41 with 
a clean set of changes
URL: 
https://github.com/apache/sling-slingfeature-maven-plugin/pull/49#discussion_r382880574
 
 

 ##########
 File path: 
src/main/java/org/apache/sling/feature/maven/mojos/IncludeArtifactMojo.java
 ##########
 @@ -119,4 +186,61 @@ private void includeArtifact(final Feature f, final 
String extensionName, final
         }
         container.add(art);
     }
+
+    private void installFMDescriptor(File file, Feature feature) {
+        Collection<org.apache.maven.artifact.Artifact> artifacts = 
Collections.synchronizedCollection(new ArrayList<>());
+        if(file.exists() && file.canRead()) {
+            getLog().debug("FM File to be installed: " + 
file.getAbsolutePath());
+            // Need to create a new Artifact Handler for the different 
extension and an Artifact to not
+            // change the module artifact
+            DefaultArtifactHandler fmArtifactHandler = new 
DefaultArtifactHandler("slingosgifeature");
+            ArtifactId artifactId = feature.getId();
+            DefaultArtifact fmArtifact = new DefaultArtifact(
+                artifactId.getGroupId(), artifactId.getArtifactId(), 
artifactId.getVersion(),
+                null, "slingosgifeature", artifactId.getClassifier(), 
fmArtifactHandler
+            );
+            fmArtifact.setFile(file);
+            artifacts.add(fmArtifact);
+            project.addAttachedArtifact(fmArtifact);
+        } else {
+            getLog().error("Could not find FM Descriptor File: " + file);
+        }
+    }
+
+    private void addDependencies(Feature feature) {
+        // Add Dependencies if configured so
+        for(String includeDependencyScope: includeDependenciesWithScope) {
+            List<Dependency> dependencies = project.getDependencies();
+            getLog().info("Project Dependencies: " + dependencies);
+            for(Dependency dependency: dependencies) {
+                if(includeDependencyScope.equals(dependency.getScope())) {
+                    getLog().info("Include Artifact: " + dependencies);
+                    ArtifactId id = new ArtifactId(
+                        dependency.getGroupId(), dependency.getArtifactId(), 
dependency.getVersion(), dependency.getClassifier(), dependency.getType()
+                    );
+                    Artifact artifact = new Artifact(id);
+                    if(bundlesStartOrder >= 0) {
+                        artifact.setStartOrder(bundlesStartOrder);
+                    }
+                    feature.getBundles().add(artifact);
+                }
+            }
+        }
+    }
+
+    private void includeFeatures(Map<String, Feature> selection, Feature 
feature) {
 
 Review comment:
   I could not make this work - at least not in the way with include-artifact 
and then aggregate because aggregate would not include the generated FM.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to