You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/03/11 09:29:47 UTC

[sling-whiteboard] branch master updated: [cp2fm] classifiers always in classifiers, not in artifactId

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 505b58e  [cp2fm] classifiers always in classifiers, not in artifactId
505b58e is described below

commit 505b58eac9172b5ad736f2ba5e95d8c307aac415
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Mon Mar 11 10:29:40 2019 +0100

    [cp2fm] classifiers always in classifiers, not in artifactId
---
 .../sling/cp2fm/ContentPackage2FeatureModelConverter.java  | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/content-package-2-feature-model/src/main/java/org/apache/sling/cp2fm/ContentPackage2FeatureModelConverter.java b/content-package-2-feature-model/src/main/java/org/apache/sling/cp2fm/ContentPackage2FeatureModelConverter.java
index 31cdab7..7461550 100644
--- a/content-package-2-feature-model/src/main/java/org/apache/sling/cp2fm/ContentPackage2FeatureModelConverter.java
+++ b/content-package-2-feature-model/src/main/java/org/apache/sling/cp2fm/ContentPackage2FeatureModelConverter.java
@@ -126,9 +126,9 @@ public class ContentPackage2FeatureModelConverter {
         }
 
         return runModes.computeIfAbsent(runMode, k -> new Feature(new ArtifactId(targetFeature.getId().getGroupId(),
-                                                                                 targetFeature.getId().getArtifactId() + '-' + runMode,
+                                                                                 targetFeature.getId().getArtifactId(),
                                                                                  targetFeature.getId().getVersion(),
-                                                                                 targetFeature.getId().getClassifier(),
+                                                                                 targetFeature.getId().getClassifier() + '-' + runMode,
                                                                                  targetFeature.getId().getType())));
     }
 
@@ -253,7 +253,15 @@ public class ContentPackage2FeatureModelConverter {
     }
 
     private void seralize(Feature feature) throws Exception {
-        File targetFile = new File(outputDirectory, feature.getId().getArtifactId() + JSON_FILE_EXTENSION);
+        StringBuilder fileName = new StringBuilder().append(feature.getId().getArtifactId());
+
+        if (!FEATURE_CLASSIFIER.equals(feature.getId().getClassifier())) {
+            fileName.append(feature.getId().getClassifier().substring(FEATURE_CLASSIFIER.length()));
+        }
+
+        fileName.append(JSON_FILE_EXTENSION);
+
+        File targetFile = new File(outputDirectory, fileName.toString());
 
         logger.info("Conversion complete!", targetFile);
         logger.info("Writing resulting Feature File to '{}'...", targetFile);