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/06/15 08:56:48 UTC
[sling-slingfeature-maven-plugin] branch feature_diff updated
(ca54947 -> 8ff761c)
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a change to branch feature_diff
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git.
from ca54947 SLING-8468 - [slingfeature-m-p] donate a new MOJO which is able to scan and detect differences between different versions of the same Feature model
add 9763af1 Add some documentation for the <artifactsOverride> tag
add be07376 SLING-8472 : Provide an option to create a reference file with all attached features
add daf5fe1 SLING-8421: Allow artifact providers that work with URLs instead of Files
add 89dcadd Merge with Master
add 8ed8354 Merge pull request #30 from apache/issues/SLING-8421
add a34388d [maven-release-plugin] prepare release slingfeature-maven-plugin-1.0.4
add 00b2690 [maven-release-plugin] prepare for next development iteration
new 2e95d73 Merge branch 'master' into feature_diff
new 8ff761c SLING-8468 - [slingfeature-m-p] donate a new MOJO which is able to scan and detect differences between different versions of the same Feature model
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
README.md | 28 ++++++++++++
pom.xml | 8 ++--
.../apache/sling/feature/maven/Preprocessor.java | 20 +++++++--
.../feature/maven/mojos/AggregateFeaturesMojo.java | 18 ++++++--
.../feature/maven/mojos/AnalyseFeaturesMojo.java | 14 +++++-
.../sling/feature/maven/mojos/ApisJarMojo.java | 42 +++++++++++++----
.../feature/maven/mojos/AttachFeaturesMojo.java | 52 ++++++++++++++++++++--
.../feature/maven/mojos/FeaturesDiffMojo.java | 39 ++++++++++------
.../maven/mojos/AttachFeaturesMojoTest.java | 2 +-
9 files changed, 184 insertions(+), 39 deletions(-)
[sling-slingfeature-maven-plugin] 01/02: Merge branch 'master' into
feature_diff
Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch feature_diff
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git
commit 2e95d7317fa276c35b2dac9b5a40d624575ba318
Merge: ca54947 00b2690
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Sat Jun 15 09:58:44 2019 +0200
Merge branch 'master' into feature_diff
README.md | 28 ++++++++++++
pom.xml | 8 ++--
.../apache/sling/feature/maven/Preprocessor.java | 20 +++++++--
.../feature/maven/mojos/AggregateFeaturesMojo.java | 18 ++++++--
.../feature/maven/mojos/AnalyseFeaturesMojo.java | 14 +++++-
.../sling/feature/maven/mojos/ApisJarMojo.java | 42 +++++++++++++----
.../feature/maven/mojos/AttachFeaturesMojo.java | 52 ++++++++++++++++++++--
.../maven/mojos/AttachFeaturesMojoTest.java | 2 +-
8 files changed, 158 insertions(+), 26 deletions(-)
diff --cc pom.xml
index 0e30d91,d923ef5..90fe27c
--- a/pom.xml
+++ b/pom.xml
@@@ -169,27 -169,9 +169,27 @@@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.feature.analyser</artifactId>
- <version>1.0.2</version>
+ <version>1.0.4</version>
</dependency>
<dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.feature.apiregions.model</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.feature.diff</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <!--
+ | JSON patch
+ -->
+ <dependency>
+ <groupId>com.flipkart.zjsonpatch</groupId>
+ <artifactId>zjsonpatch</artifactId>
+ <version>0.4.8</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
[sling-slingfeature-maven-plugin] 02/02: SLING-8468 -
[slingfeature-m-p] donate a new MOJO which is able to scan and detect
differences between different versions of the same Feature model
Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch feature_diff
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git
commit 8ff761ce40ad1220a6b642434b1f3e0b2188dc21
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Sat Jun 15 10:56:42 2019 +0200
SLING-8468 - [slingfeature-m-p] donate a new MOJO which is able to scan
and detect differences between different versions of the same Feature
model
updated diff tool APIs
Feature output is now a Feature with a Prototype and new settings
---
.../feature/maven/mojos/FeaturesDiffMojo.java | 39 ++++++++++++++--------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/apache/sling/feature/maven/mojos/FeaturesDiffMojo.java b/src/main/java/org/apache/sling/feature/maven/mojos/FeaturesDiffMojo.java
index cc76ccb..600ad52 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/FeaturesDiffMojo.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/FeaturesDiffMojo.java
@@ -16,9 +16,12 @@
*/
package org.apache.sling.feature.maven.mojos;
+import static org.apache.sling.feature.diff.FeatureDiff.compareFeatures;
+import static org.apache.sling.feature.io.json.FeatureJSONWriter.write;
+
import java.io.File;
-import java.io.FileOutputStream;
import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
@@ -42,9 +45,9 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.sling.feature.ArtifactId;
import org.apache.sling.feature.Feature;
-import org.apache.sling.feature.diff.FeatureDiff;
-import org.apache.sling.feature.diff.io.json.FeatureDiffJSONSerializer;
+import org.apache.sling.feature.diff.DefaultDiffRequest;
import org.apache.sling.feature.io.json.FeatureJSONReader;
/**
@@ -107,19 +110,29 @@ public final class FeaturesDiffMojo extends AbstractIncludingFeatureMojo {
getLog().info("Comparing current " + current + " to previous " + previous);
- FeatureDiff featureDiff = FeatureDiff.compareFeatures(previous, current);
-
- if (featureDiff.isEmpty()) {
- getLog().info("There are no differences between current " + current + " and previous " + previous + " models");
- return;
- }
-
- File outputDiffFile = new File(mainOutputDir, current.getId().getClassifier() + ".diff.json");
+ StringBuilder classifier = new StringBuilder()
+ .append(previous.getId().getVersion())
+ .append("-to-")
+ .append(current.getId().getVersion())
+ .append('-')
+ .append(current.getId().getClassifier())
+ .append("-upgrade");
+
+ Feature featureDiff = compareFeatures(new DefaultDiffRequest()
+ .setPrevious(previous)
+ .setCurrent(current)
+ .setResultId(new ArtifactId(current.getId().getGroupId(),
+ current.getId().getArtifactId(),
+ current.getId().getVersion(),
+ classifier.toString(),
+ current.getId().getType())));
+
+ File outputDiffFile = new File(mainOutputDir, classifier.append(".json").toString());
getLog().info("Rendering differences to file " + outputDiffFile);
- try (FileOutputStream output = new FileOutputStream(outputDiffFile)) {
- FeatureDiffJSONSerializer.serializeFeatureDiff(featureDiff, output);
+ try (FileWriter writer = new FileWriter(outputDiffFile)) {
+ write(writer, featureDiff);
} catch (IOException e) {
throw new MojoExecutionException("An error occurred while serializing Feature diff to " + outputDiffFile, e);
}