You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2019/08/21 20:15:17 UTC

[sling-slingfeature-maven-plugin] 01/01: SLING-8647: Provide policies for configuration merging

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

pauls pushed a commit to branch issues/SLING-8647
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git

commit e27b9af408c2f6ab377289d60def5dbc955c7640
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Wed Aug 21 22:15:01 2019 +0200

    SLING-8647: Provide policies for configuration merging
---
 pom.xml                                                      |  2 +-
 .../java/org/apache/sling/feature/maven/mojos/Aggregate.java | 12 ++++++++++--
 .../sling/feature/maven/mojos/AggregateFeaturesMojo.java     |  2 ++
 .../sling/feature/maven/mojos/AggregateFeaturesMojoTest.java |  1 +
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 622f3da..45007a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,7 +159,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature</artifactId>
-            <version>1.0.6</version>
+            <version>1.0.7-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
diff --git a/src/main/java/org/apache/sling/feature/maven/mojos/Aggregate.java b/src/main/java/org/apache/sling/feature/maven/mojos/Aggregate.java
index dbdf75f..ac0bf92 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/Aggregate.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/Aggregate.java
@@ -16,14 +16,13 @@
  */
 package org.apache.sling.feature.maven.mojos;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
 import org.apache.sling.feature.ArtifactId;
 
-import edu.emory.mathcs.backport.java.util.Collections;
-
 public class Aggregate extends FeatureSelectionConfig {
 
     /**
@@ -65,6 +64,8 @@ public class Aggregate extends FeatureSelectionConfig {
 
     public List<String> artifactsOverrides;
 
+    public Map<String, String> configurationOverrides;
+
     public Map<String, String> variablesOverrides;
 
     public Map<String, String> frameworkPropertiesOverrides;
@@ -85,4 +86,11 @@ public class Aggregate extends FeatureSelectionConfig {
         }
         return artifactsOverrides.stream().map(r -> ArtifactId.parse(r)).collect(Collectors.toList());
     }
+
+    public Map<String, String> getConfigurationOverrideRules() {
+        if (configurationOverrides == null) {
+            return Collections.emptyMap();
+        }
+        return configurationOverrides;
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojo.java b/src/main/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojo.java
index bacc699..82c5d71 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojo.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojo.java
@@ -106,6 +106,8 @@ public class AggregateFeaturesMojo extends AbstractIncludingFeatureMojo {
                 builderContext.addArtifactsOverride(rule);
             }
 
+            builderContext.addConfigsOverrides(aggregate.getConfigurationOverrideRules());
+
             boolean wildcardSet = false;
             for (final Map.Entry<String, Properties> entry : handlerConfiguration.entrySet()) {
                 String key = entry.getKey();
diff --git a/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java b/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java
index 1c34127..16f7fdd 100644
--- a/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java
+++ b/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java
@@ -370,6 +370,7 @@ public class AggregateFeaturesMojoTest {
 
         AggregateFeaturesMojo af = new AggregateFeaturesMojo();
         fc1.classifier = "agg";
+        fc1.configurationOverrides = Collections.singletonMap("*", BuilderContext.CONFIG_MERGE_LATEST);
         af.aggregates = Arrays.asList(fc1);
         af.project = mockProj;
         af.projectHelper = new DefaultMavenProjectHelper();