You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2020/03/02 22:01:12 UTC

[GitHub] [sling-slingfeature-maven-plugin] schaefa commented on a change in pull request #49: Replacement PR for #41 with a clean set of changes

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_r386677176
 
 

 ##########
 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:
   Got it working. Removed the method and updated the IT tests and documentation.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services