You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:30:24 UTC

[sling-launchpad-comparator] branch master created (now 6199482)

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

rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-launchpad-comparator.git.


      at 6199482  SLING-7167 Adjust READMEs

This branch includes the following new commits:

     new 3468c5c  SLING-5099 - Create 'New and Noteworthy' page for Sling 8
     new 7ebaba7  SLING-5099 - Create 'New and Noteworthy' page for Sling 8
     new e8696de  LaunchpadComparer update for more recent Sling versions
     new 25fe3de  LaunchpadComparer: more robust SVN changelog parsing
     new 6199482  SLING-7167 Adjust READMEs

The 5 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.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-launchpad-comparator] 03/05: LaunchpadComparer update for more recent Sling versions

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e8696de3044fc92985f1c350e4d12b4e4c1da8e6
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Aug 14 12:06:10 2017 +0000

    LaunchpadComparer update for more recent Sling versions
    
    - use latest provisioning model
    - consider both versions as using the provisioning model
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1804983 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 23 +++++---------
 .../apache/sling/tooling/lc/LaunchpadComparer.java | 35 +++++++++-------------
 .../java/org/apache/sling/tooling/lc/Main.java     | 10 ++-----
 .../sling/tooling/lc/aether/ArtifactKey.java       |  6 ----
 .../apache/sling/tooling/lc/aether/Artifacts.java  |  1 -
 .../org/apache/sling/tooling/lc/jira/Issue.java    |  5 ++--
 6 files changed, 28 insertions(+), 52 deletions(-)

diff --git a/pom.xml b/pom.xml
index 528f4d1..6c4ee93 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,21 +89,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.provisioning.model</artifactId>
-            <version>1.3.0</version>
-        </dependency>
-
-        <!-- Launchpad plugin, used to read bundle lists -->
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>maven-launchpad-plugin</artifactId>
-            <version>2.3.2</version>
-        </dependency>
-
-        <!-- Force usable version of plexus-utils, needed by launchpad plugin -->
-        <dependency>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-utils</artifactId>
-            <version>3.0.15</version>
+            <version>1.8.2</version>
         </dependency>
 
         <!-- Retrieve changelog data from SVN -->
@@ -119,6 +105,13 @@
             <artifactId>gson</artifactId>
             <version>2.2.4</version>
         </dependency>
+        
+        <!-- Testing -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
 
diff --git a/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java b/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
index df4c931..43aae47 100644
--- a/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
+++ b/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
@@ -30,9 +30,6 @@ import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
 
-import org.apache.sling.maven.projectsupport.BundleListUtils;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
 import org.apache.sling.provisioning.model.Artifact;
 import org.apache.sling.provisioning.model.Model;
 import org.apache.sling.provisioning.model.ModelUtility;
@@ -71,23 +68,10 @@ public class LaunchpadComparer {
         File toFile = aether.download(Artifacts.launchpadCoordinates(secondVersion));
 
         // 2. parse artifact definitions
-        Model model;
-        try (BufferedReader reader = Files.newBufferedReader(toFile.toPath())) {
-            model = ModelUtility.getEffectiveModel(ModelReader.read(reader, null));
-        }
-        
-        Map<ArtifactKey, Artifact> to = model.getFeatures().stream()
-            .flatMap( f -> f.getRunModes().stream())
-            .flatMap( r -> r.getArtifactGroups().stream())
-            .flatMap( g -> StreamSupport.stream(g.spliterator(), false))
-            .collect(Collectors.toMap( a -> new ArtifactKey(a), Function.identity()));
+        Map<ArtifactKey, Artifact> from = readArtifactsFromModel(fromFile);
+        Map<ArtifactKey, Artifact> to = readArtifactsFromModel(toFile);
         
-        BundleList readBundleList = BundleListUtils.readBundleList(fromFile);
         
-        Map<ArtifactKey, Artifact> from = readBundleList.getStartLevels().stream()
-            .flatMap( sl -> sl.getBundles().stream() )
-            .collect(Collectors.toMap( b -> new ArtifactKey(b), LaunchpadComparer::newArtifact));
-
         // 3. generate added / removed / changed
         Set<Artifact> removed = Sets.difference(from.keySet(), to.keySet()).stream()
             .map( k -> from.get(k))
@@ -117,10 +101,19 @@ public class LaunchpadComparer {
             .forEach(LaunchpadComparer::outputFormatted);        
         
     }
-    
-    private static Artifact newArtifact(Bundle bundle) {
+
+    private Map<ArtifactKey, Artifact> readArtifactsFromModel(File toFile) throws IOException {
+        Model fromModel;
+        try (BufferedReader reader = Files.newBufferedReader(toFile.toPath())) {
+            fromModel = ModelUtility.getEffectiveModel(ModelReader.read(reader, null));
+        }
         
-        return new Artifact(bundle.getGroupId(), bundle.getArtifactId(), bundle.getVersion(), bundle.getClassifier(), bundle.getType());
+        Map<ArtifactKey, Artifact> to = fromModel.getFeatures().stream()
+            .flatMap( f -> f.getRunModes().stream())
+            .flatMap( r -> r.getArtifactGroups().stream())
+            .flatMap( g -> StreamSupport.stream(g.spliterator(), false))
+            .collect(Collectors.toMap( a -> new ArtifactKey(a), Function.identity()));
+        return to;
     }
     
     private static void outputFormatted(Artifact a) {
diff --git a/src/main/java/org/apache/sling/tooling/lc/Main.java b/src/main/java/org/apache/sling/tooling/lc/Main.java
index 91da961..1ff8632 100644
--- a/src/main/java/org/apache/sling/tooling/lc/Main.java
+++ b/src/main/java/org/apache/sling/tooling/lc/Main.java
@@ -20,17 +20,13 @@ public class Main {
 
     public static void main(String[] args) throws Exception {
         
-        // 0. read CLI arguments
-        String firstVersion = "7";
-        String secondVersion = "8";
+        String firstVersion = "8";
+        String secondVersion = "9";
         if ( args.length == 2) {
             firstVersion = args[0];
             secondVersion = args[1];
         }
         
-        LaunchpadComparer comparer = new LaunchpadComparer(firstVersion, secondVersion);
-        comparer.run();
-        
-
+        new LaunchpadComparer(firstVersion, secondVersion).run();
     }
 }
diff --git a/src/main/java/org/apache/sling/tooling/lc/aether/ArtifactKey.java b/src/main/java/org/apache/sling/tooling/lc/aether/ArtifactKey.java
index 112e10a..3f81a6f 100644
--- a/src/main/java/org/apache/sling/tooling/lc/aether/ArtifactKey.java
+++ b/src/main/java/org/apache/sling/tooling/lc/aether/ArtifactKey.java
@@ -18,7 +18,6 @@ package org.apache.sling.tooling.lc.aether;
 
 import java.util.Objects;
 
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
 import org.apache.sling.provisioning.model.Artifact;
 
 public class ArtifactKey implements Comparable<ArtifactKey> {
@@ -28,11 +27,6 @@ public class ArtifactKey implements Comparable<ArtifactKey> {
     private String classifier;
     private String type;
     
-    public ArtifactKey(Bundle bundle) {
-        
-        this(bundle.getGroupId(), bundle.getArtifactId(), bundle.getClassifier(), bundle.getType());
-    }
-
     public ArtifactKey(Artifact artifact) {
         
         this(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType());
diff --git a/src/main/java/org/apache/sling/tooling/lc/aether/Artifacts.java b/src/main/java/org/apache/sling/tooling/lc/aether/Artifacts.java
index 8bbed53..40c2009 100644
--- a/src/main/java/org/apache/sling/tooling/lc/aether/Artifacts.java
+++ b/src/main/java/org/apache/sling/tooling/lc/aether/Artifacts.java
@@ -33,7 +33,6 @@ public class Artifacts {
         
         int versionNumber = Integer.parseInt(versionMatcher.group(1));
 
-        
         // versions 6 and 7 used an XML bundle list
         if ( versionNumber < 8 ) {
             return "org.apache.sling:org.apache.sling.launchpad:xml:bundlelist:" + version;
diff --git a/src/main/java/org/apache/sling/tooling/lc/jira/Issue.java b/src/main/java/org/apache/sling/tooling/lc/jira/Issue.java
index 12e54b1..150a5e5 100644
--- a/src/main/java/org/apache/sling/tooling/lc/jira/Issue.java
+++ b/src/main/java/org/apache/sling/tooling/lc/jira/Issue.java
@@ -16,10 +16,10 @@
  */
 package org.apache.sling.tooling.lc.jira;
 
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import com.google.inject.internal.util.Objects;
 
 public class Issue implements Comparable<Issue> {
     
@@ -67,7 +67,8 @@ public class Issue implements Comparable<Issue> {
         String ourProject = ourMatcher.group(1);
         String theirProject = theirMatcher.group(1);
         
-        if ( !Objects.equal(ourProject, theirProject)) {
+        
+        if ( !Objects.equals(ourProject, theirProject)) {
             return ourProject.compareTo(theirProject);
         }
         

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-launchpad-comparator] 05/05: SLING-7167 Adjust READMEs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 61994826edc0219566b33c5885186162bf2c5d39
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Oct 3 11:22:36 2017 +0000

    SLING-7167 Adjust READMEs
    
    add missing README
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810992 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..63a87c2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Apache Sling Launchpad Comparator
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-launchpad-comparator] 02/05: SLING-5099 - Create 'New and Noteworthy' page for Sling 8

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7ebaba748f62bee7a6073b0492440e1347de1308
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Wed Oct 14 09:23:50 2015 +0000

    SLING-5099 - Create 'New and Noteworthy' page for Sling 8
    
    Enhance the launchpad-comparator to list fixed Jira issues for Sling
    artifacts with version changes.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1708567 13f79535-47bb-0310-9956-ffa450edef68
---
 .gitignore                                         |  1 +
 pom.xml                                            | 26 +++++-
 .../lc/{Main.java => LaunchpadComparer.java}       | 85 +++++++++++++++-----
 .../java/org/apache/sling/tooling/lc/Main.java     | 92 +---------------------
 .../sling/tooling/lc/{ => aether}/AetherSetup.java |  4 +-
 .../sling/tooling/lc/{ => aether}/ArtifactKey.java |  4 +-
 .../sling/tooling/lc/{ => aether}/Artifacts.java   |  4 +-
 .../tooling/lc/{ => aether}/VersionChange.java     |  4 +-
 .../lc/{VersionChange.java => jira/Fields.java}    | 28 +++----
 .../org/apache/sling/tooling/lc/jira/Issue.java    | 79 +++++++++++++++++++
 .../apache/sling/tooling/lc/jira/IssueFinder.java  | 79 +++++++++++++++++++
 .../lc/{VersionChange.java => jira/Response.java}  | 33 +++-----
 .../sling/tooling/lc/svn/SvnChangeLogFinder.java   | 62 +++++++++++++++
 .../org/apache/sling/tooling/lc/ArtifactsTest.java | 18 ++++-
 14 files changed, 360 insertions(+), 159 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..89540d8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/dependency-reduced-pom.xml
diff --git a/pom.xml b/pom.xml
index 2cc217e..528f4d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -106,6 +106,20 @@
             <version>3.0.15</version>
         </dependency>
 
+        <!-- Retrieve changelog data from SVN -->
+        <dependency>
+            <groupId>org.tmatesoft.svnkit</groupId>
+            <artifactId>svnkit</artifactId>
+            <version>1.8.11</version>
+        </dependency>
+
+        <!-- Parse Jira JSON responses -->
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.2.4</version>
+        </dependency>
+
     </dependencies>
 
     <build>
@@ -116,7 +130,8 @@
                 <version>2.4.1</version>
                 <configuration>
                     <transformers>
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                             <mainClass>org.apache.sling.tooling.lc.Main</mainClass>
                         </transformer>
                     </transformers>
@@ -130,6 +145,15 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>dependency-reduced-pom.xml</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git a/src/main/java/org/apache/sling/tooling/lc/Main.java b/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
similarity index 63%
copy from src/main/java/org/apache/sling/tooling/lc/Main.java
copy to src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
index 7b7837b..df4c931 100644
--- a/src/main/java/org/apache/sling/tooling/lc/Main.java
+++ b/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
@@ -18,11 +18,15 @@ package org.apache.sling.tooling.lc;
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.IOException;
 import java.nio.file.Files;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.function.Function;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
 
@@ -33,20 +37,29 @@ import org.apache.sling.provisioning.model.Artifact;
 import org.apache.sling.provisioning.model.Model;
 import org.apache.sling.provisioning.model.ModelUtility;
 import org.apache.sling.provisioning.model.io.ModelReader;
+import org.apache.sling.tooling.lc.aether.AetherSetup;
+import org.apache.sling.tooling.lc.aether.ArtifactKey;
+import org.apache.sling.tooling.lc.aether.Artifacts;
+import org.apache.sling.tooling.lc.aether.VersionChange;
+import org.apache.sling.tooling.lc.jira.IssueFinder;
+import org.apache.sling.tooling.lc.svn.SvnChangeLogFinder;
+import org.tmatesoft.svn.core.SVNException;
 
 import com.google.common.collect.Sets;
 
-public class Main {
+public class LaunchpadComparer {
+    
+    private static final Pattern JIRA_KEY_PATTERN = Pattern.compile("^(SLING-\\d+).*");
 
-    public static void main(String[] args) throws Exception {
-        
-        // 0. read CLI arguments
-        String firstVersion = "7";
-        String secondVersion = "8";
-        if ( args.length == 2) {
-            firstVersion = args[0];
-            secondVersion = args[1];
-        }
+    private final String firstVersion;
+    private final String secondVersion;
+
+    public LaunchpadComparer(String firstVersion, String secondVersion) {
+        this.firstVersion = firstVersion;
+        this.secondVersion = secondVersion;
+    }
+
+    public void run() throws Exception {
         
         System.out.format("Computing differences between Launchpad versions %s and %s...%n", 
                 firstVersion, secondVersion);
@@ -63,7 +76,6 @@ public class Main {
             model = ModelUtility.getEffectiveModel(ModelReader.read(reader, null));
         }
         
-        // TODO - versions are not interpolated
         Map<ArtifactKey, Artifact> to = model.getFeatures().stream()
             .flatMap( f -> f.getRunModes().stream())
             .flatMap( r -> r.getArtifactGroups().stream())
@@ -72,11 +84,11 @@ public class Main {
         
         BundleList readBundleList = BundleListUtils.readBundleList(fromFile);
         
-        // 3. generate added / removed / changed
         Map<ArtifactKey, Artifact> from = readBundleList.getStartLevels().stream()
             .flatMap( sl -> sl.getBundles().stream() )
-            .collect(Collectors.toMap( b -> new ArtifactKey(b), Main::newArtifact));
-        
+            .collect(Collectors.toMap( b -> new ArtifactKey(b), LaunchpadComparer::newArtifact));
+
+        // 3. generate added / removed / changed
         Set<Artifact> removed = Sets.difference(from.keySet(), to.keySet()).stream()
             .map( k -> from.get(k))
             .collect(Collectors.toSet());
@@ -94,17 +106,18 @@ public class Main {
         // 4. output changes
         
         System.out.println("Added ");
-        added.stream().sorted().forEach(Main::outputFormatted);
+        added.stream().sorted().forEach(LaunchpadComparer::outputFormatted);
         
         System.out.println("Removed ");
-        removed.stream().sorted().forEach(Main::outputFormatted);
+        removed.stream().sorted().forEach(LaunchpadComparer::outputFormatted);
         
         System.out.println("Changed");
         changed.entrySet().stream()
             .sorted( (a, b) -> a.getKey().compareTo(b.getKey()) )
-            .forEach(Main::outputFormatted);
+            .forEach(LaunchpadComparer::outputFormatted);        
+        
     }
-
+    
     private static Artifact newArtifact(Bundle bundle) {
         
         return new Artifact(bundle.getGroupId(), bundle.getArtifactId(), bundle.getVersion(), bundle.getClassifier(), bundle.getType());
@@ -118,7 +131,41 @@ public class Main {
 
     private static void outputFormatted(Map.Entry<ArtifactKey, VersionChange> e) {
         
-        System.out.format("    %-30s : %-55s : %s -> %s%n", e.getKey().getGroupId(), e.getKey().getArtifactId(), e.getValue().getFrom(), e.getValue().getTo());
+        ArtifactKey artifact = e.getKey();
+        VersionChange versionChange = e.getValue();
+        
+        System.out.format("    %-30s : %-55s : %s -> %s%n", artifact.getGroupId(), artifact.getArtifactId(), versionChange.getFrom(), versionChange.getTo());
+        
+        if ( !artifact.getGroupId().equals("org.apache.sling"))  {
+            return;
+        }
+        
+        SvnChangeLogFinder svn = new SvnChangeLogFinder();
         
+        String fromTag = artifact.getArtifactId()+"-"+versionChange.getFrom();
+        String toTag = artifact.getArtifactId()+"-"+ versionChange.getTo();
+        try {
+            List<String> issues = svn.getChanges(fromTag, toTag)
+                .stream()
+                .map(LaunchpadComparer::toJiraKey)
+                .filter( k -> k != null)
+                .collect(Collectors.toList());
+            
+            IssueFinder issueFinder = new IssueFinder();
+            issueFinder.findIssues(issues).
+                forEach( i -> System.out.format("        %-10s - %s%n", i.getKey(), i.getSummary()));
+            
+        } catch (SVNException | IOException e1) {
+            System.err.println("Failed retrieving changes : " + e1.getMessage());
+        }
     }
+    
+    private static String toJiraKey(String message) {
+        Matcher matcher = JIRA_KEY_PATTERN.matcher(message);
+        if ( !matcher.matches() ) {
+            return null;
+        }
+        
+        return matcher.group(1);
+    }    
 }
diff --git a/src/main/java/org/apache/sling/tooling/lc/Main.java b/src/main/java/org/apache/sling/tooling/lc/Main.java
index 7b7837b..91da961 100644
--- a/src/main/java/org/apache/sling/tooling/lc/Main.java
+++ b/src/main/java/org/apache/sling/tooling/lc/Main.java
@@ -16,26 +16,6 @@
  */
 package org.apache.sling.tooling.lc;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.nio.file.Files;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
-
-import org.apache.sling.maven.projectsupport.BundleListUtils;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
-import org.apache.sling.provisioning.model.Artifact;
-import org.apache.sling.provisioning.model.Model;
-import org.apache.sling.provisioning.model.ModelUtility;
-import org.apache.sling.provisioning.model.io.ModelReader;
-
-import com.google.common.collect.Sets;
-
 public class Main {
 
     public static void main(String[] args) throws Exception {
@@ -48,77 +28,9 @@ public class Main {
             secondVersion = args[1];
         }
         
-        System.out.format("Computing differences between Launchpad versions %s and %s...%n", 
-                firstVersion, secondVersion);
+        LaunchpadComparer comparer = new LaunchpadComparer(firstVersion, secondVersion);
+        comparer.run();
         
-        // 1. download artifacts
-        AetherSetup aether = new AetherSetup();
-
-        File fromFile = aether.download(Artifacts.launchpadCoordinates(firstVersion));
-        File toFile = aether.download(Artifacts.launchpadCoordinates(secondVersion));
 
-        // 2. parse artifact definitions
-        Model model;
-        try (BufferedReader reader = Files.newBufferedReader(toFile.toPath())) {
-            model = ModelUtility.getEffectiveModel(ModelReader.read(reader, null));
-        }
-        
-        // TODO - versions are not interpolated
-        Map<ArtifactKey, Artifact> to = model.getFeatures().stream()
-            .flatMap( f -> f.getRunModes().stream())
-            .flatMap( r -> r.getArtifactGroups().stream())
-            .flatMap( g -> StreamSupport.stream(g.spliterator(), false))
-            .collect(Collectors.toMap( a -> new ArtifactKey(a), Function.identity()));
-        
-        BundleList readBundleList = BundleListUtils.readBundleList(fromFile);
-        
-        // 3. generate added / removed / changed
-        Map<ArtifactKey, Artifact> from = readBundleList.getStartLevels().stream()
-            .flatMap( sl -> sl.getBundles().stream() )
-            .collect(Collectors.toMap( b -> new ArtifactKey(b), Main::newArtifact));
-        
-        Set<Artifact> removed = Sets.difference(from.keySet(), to.keySet()).stream()
-            .map( k -> from.get(k))
-            .collect(Collectors.toSet());
-
-        Set<Artifact> added = Sets.difference(to.keySet(), from.keySet()).stream()
-                .map( k -> to.get(k))
-                .collect(Collectors.toSet());
-
-        Map<ArtifactKey, VersionChange> changed = to.values().stream()
-                .filter( k -> !added.contains(k) && !removed.contains(k))
-                .map( k -> new ArtifactKey(k))
-                .filter( k -> !Objects.equals(to.get(k).getVersion(), from.get(k).getVersion()))
-                .collect(Collectors.toMap( Function.identity(), k -> new VersionChange(from.get(k).getVersion(), to.get(k).getVersion())));
-
-        // 4. output changes
-        
-        System.out.println("Added ");
-        added.stream().sorted().forEach(Main::outputFormatted);
-        
-        System.out.println("Removed ");
-        removed.stream().sorted().forEach(Main::outputFormatted);
-        
-        System.out.println("Changed");
-        changed.entrySet().stream()
-            .sorted( (a, b) -> a.getKey().compareTo(b.getKey()) )
-            .forEach(Main::outputFormatted);
-    }
-
-    private static Artifact newArtifact(Bundle bundle) {
-        
-        return new Artifact(bundle.getGroupId(), bundle.getArtifactId(), bundle.getVersion(), bundle.getClassifier(), bundle.getType());
-    }
-    
-    private static void outputFormatted(Artifact a) {
-        
-        System.out.format("    %-30s : %-55s : %s%n", a.getGroupId(), a.getArtifactId(), a.getVersion());
-        
-    }
-
-    private static void outputFormatted(Map.Entry<ArtifactKey, VersionChange> e) {
-        
-        System.out.format("    %-30s : %-55s : %s -> %s%n", e.getKey().getGroupId(), e.getKey().getArtifactId(), e.getValue().getFrom(), e.getValue().getTo());
-        
     }
 }
diff --git a/src/main/java/org/apache/sling/tooling/lc/AetherSetup.java b/src/main/java/org/apache/sling/tooling/lc/aether/AetherSetup.java
similarity index 97%
rename from src/main/java/org/apache/sling/tooling/lc/AetherSetup.java
rename to src/main/java/org/apache/sling/tooling/lc/aether/AetherSetup.java
index d529f3e..8d4679b 100644
--- a/src/main/java/org/apache/sling/tooling/lc/AetherSetup.java
+++ b/src/main/java/org/apache/sling/tooling/lc/aether/AetherSetup.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.tooling.lc;
+package org.apache.sling.tooling.lc.aether;
 
 import java.io.File;
 import java.util.Arrays;
@@ -36,7 +36,7 @@ import org.eclipse.aether.spi.connector.transport.TransporterFactory;
 import org.eclipse.aether.transport.file.FileTransporterFactory;
 import org.eclipse.aether.transport.http.HttpTransporterFactory;
 
-class AetherSetup {
+public class AetherSetup {
     
     private final List<RemoteRepository> repos = Arrays.asList(
         new RemoteRepository.Builder("central", "default", "http://central.maven.org/maven2/").build(),
diff --git a/src/main/java/org/apache/sling/tooling/lc/ArtifactKey.java b/src/main/java/org/apache/sling/tooling/lc/aether/ArtifactKey.java
similarity index 96%
rename from src/main/java/org/apache/sling/tooling/lc/ArtifactKey.java
rename to src/main/java/org/apache/sling/tooling/lc/aether/ArtifactKey.java
index 047a1d2..112e10a 100644
--- a/src/main/java/org/apache/sling/tooling/lc/ArtifactKey.java
+++ b/src/main/java/org/apache/sling/tooling/lc/aether/ArtifactKey.java
@@ -14,14 +14,14 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.tooling.lc;
+package org.apache.sling.tooling.lc.aether;
 
 import java.util.Objects;
 
 import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
 import org.apache.sling.provisioning.model.Artifact;
 
-class ArtifactKey implements Comparable<ArtifactKey> {
+public class ArtifactKey implements Comparable<ArtifactKey> {
     
     private String groupId;
     private String artifactId;
diff --git a/src/main/java/org/apache/sling/tooling/lc/Artifacts.java b/src/main/java/org/apache/sling/tooling/lc/aether/Artifacts.java
similarity index 96%
rename from src/main/java/org/apache/sling/tooling/lc/Artifacts.java
rename to src/main/java/org/apache/sling/tooling/lc/aether/Artifacts.java
index 0ffc42a..8bbed53 100644
--- a/src/main/java/org/apache/sling/tooling/lc/Artifacts.java
+++ b/src/main/java/org/apache/sling/tooling/lc/aether/Artifacts.java
@@ -14,12 +14,12 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.tooling.lc;
+package org.apache.sling.tooling.lc.aether;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-class Artifacts {
+public class Artifacts {
 
     private static final Pattern VERSION_NUMBER = Pattern.compile("^(\\d+)(-SNAPSHOT)?");
     
diff --git a/src/main/java/org/apache/sling/tooling/lc/VersionChange.java b/src/main/java/org/apache/sling/tooling/lc/aether/VersionChange.java
similarity index 94%
copy from src/main/java/org/apache/sling/tooling/lc/VersionChange.java
copy to src/main/java/org/apache/sling/tooling/lc/aether/VersionChange.java
index 7c69d0b..671ff2e 100644
--- a/src/main/java/org/apache/sling/tooling/lc/VersionChange.java
+++ b/src/main/java/org/apache/sling/tooling/lc/aether/VersionChange.java
@@ -14,9 +14,9 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.tooling.lc;
+package org.apache.sling.tooling.lc.aether;
 
-class VersionChange {
+public class VersionChange {
     
     private String from;
     private String to;
diff --git a/src/main/java/org/apache/sling/tooling/lc/VersionChange.java b/src/main/java/org/apache/sling/tooling/lc/jira/Fields.java
similarity index 66%
copy from src/main/java/org/apache/sling/tooling/lc/VersionChange.java
copy to src/main/java/org/apache/sling/tooling/lc/jira/Fields.java
index 7c69d0b..2215d06 100644
--- a/src/main/java/org/apache/sling/tooling/lc/VersionChange.java
+++ b/src/main/java/org/apache/sling/tooling/lc/jira/Fields.java
@@ -14,28 +14,18 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.tooling.lc;
+package org.apache.sling.tooling.lc.jira;
 
-class VersionChange {
+public class Fields {
     
-    private String from;
-    private String to;
-
-    public VersionChange(String from, String to) {
-        this.from = from;
-        this.to = to;
-    }
+    private final String summary;
     
-    public String getFrom() {
-        return from;
+    public Fields(String summary) {
+        this.summary = summary;
     }
-    
-    public String getTo() {
-        return to;
+
+    public String getSummary() {
+        return summary;
     }
     
-    @Override
-    public String toString() {
-        return "VersionChange [" +from + " -> " + to +"]";
-    }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/sling/tooling/lc/jira/Issue.java b/src/main/java/org/apache/sling/tooling/lc/jira/Issue.java
new file mode 100644
index 0000000..12e54b1
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/jira/Issue.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc.jira;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.google.inject.internal.util.Objects;
+
+public class Issue implements Comparable<Issue> {
+    
+    private static final Pattern KEY_PATTERN = Pattern.compile("^([A-Z]+)-(\\d+)$"); 
+
+    private final String key;
+    private final Fields fields;
+
+    public Issue(String key, Fields fields) {
+        this.key = key;
+        this.fields = fields;
+    }
+
+    public String getKey() {
+        return key;
+    }
+    
+    public Fields getFields() {
+        return fields;
+    }
+    
+    public String getSummary() {
+        return fields.getSummary();
+    }
+    
+    @Override
+    public String toString() {
+        return key + " - " + getSummary();
+    }
+
+    @Override
+    public int compareTo(Issue o) {
+        
+        Matcher ourMatcher = KEY_PATTERN.matcher(key);
+        Matcher theirMatcher = KEY_PATTERN.matcher(o.key);
+        
+        if ( !ourMatcher.matches()) {
+            throw new IllegalArgumentException("No match found for " + key);
+        }
+
+        if ( !theirMatcher.matches()) {
+            throw new IllegalArgumentException("No match found for " + o.key);
+        }
+        
+        String ourProject = ourMatcher.group(1);
+        String theirProject = theirMatcher.group(1);
+        
+        if ( !Objects.equal(ourProject, theirProject)) {
+            return ourProject.compareTo(theirProject);
+        }
+        
+        int ourId = Integer.parseInt(ourMatcher.group(2));
+        int theirId = Integer.parseInt(theirMatcher.group(2));
+
+        return Integer.valueOf(ourId).compareTo(theirId);
+    }
+}
diff --git a/src/main/java/org/apache/sling/tooling/lc/jira/IssueFinder.java b/src/main/java/org/apache/sling/tooling/lc/jira/IssueFinder.java
new file mode 100644
index 0000000..69005b9
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/jira/IssueFinder.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc.jira;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.HttpClientUtils;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import com.google.gson.Gson;
+
+public class IssueFinder {
+    
+    public static void main(String[] args) throws IOException {
+        
+        new IssueFinder().findIssues(Arrays.asList("SLING-1", "SLING-2"))
+            .stream()
+            .forEach(System.out::println);
+    }
+    
+    public List<Issue> findIssues(List<String> issueKeys) throws IOException{
+        
+        HttpClient client = new DefaultHttpClient();
+        
+        HttpGet get;
+        try {
+            URIBuilder builder = new URIBuilder("https://issues.apache.org/jira/rest/api/2/search")
+                    .addParameter("jql", "key in (" + String.join(",", issueKeys) + ")")
+                    .addParameter("fields", "key,summary");
+            
+            get = new HttpGet(builder.build());
+        } catch (URISyntaxException e) {
+            // never happens
+            throw new RuntimeException(e);
+        }
+        
+        HttpResponse response = client.execute(get);
+        try {
+            if ( response.getStatusLine().getStatusCode() != 200 ) { 
+                throw new IOException("Search call returned status " + response.getStatusLine().getStatusCode());
+            }
+            
+            try ( Reader reader = new InputStreamReader(response.getEntity().getContent(), "UTF-8") ) {
+                Response apiResponse = new Gson().fromJson(reader, Response.class);
+                List<Issue> issues = apiResponse.getIssues();
+                Collections.sort(issues);
+                return issues;
+                
+            }
+        } finally {
+            HttpClientUtils.closeQuietly(client);
+        }
+        
+    }
+}
diff --git a/src/main/java/org/apache/sling/tooling/lc/VersionChange.java b/src/main/java/org/apache/sling/tooling/lc/jira/Response.java
similarity index 64%
rename from src/main/java/org/apache/sling/tooling/lc/VersionChange.java
rename to src/main/java/org/apache/sling/tooling/lc/jira/Response.java
index 7c69d0b..e77407f 100644
--- a/src/main/java/org/apache/sling/tooling/lc/VersionChange.java
+++ b/src/main/java/org/apache/sling/tooling/lc/jira/Response.java
@@ -14,28 +14,19 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.tooling.lc;
+package org.apache.sling.tooling.lc.jira;
 
-class VersionChange {
-    
-    private String from;
-    private String to;
+import java.util.List;
 
-    public VersionChange(String from, String to) {
-        this.from = from;
-        this.to = to;
-    }
-    
-    public String getFrom() {
-        return from;
-    }
-    
-    public String getTo() {
-        return to;
+public class Response {
+
+    private final List<Issue> issues;
+
+    public Response(List<Issue> issues) {
+        this.issues = issues;
     }
-    
-    @Override
-    public String toString() {
-        return "VersionChange [" +from + " -> " + to +"]";
+
+    public List<Issue> getIssues() {
+        return issues;
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/sling/tooling/lc/svn/SvnChangeLogFinder.java b/src/main/java/org/apache/sling/tooling/lc/svn/SvnChangeLogFinder.java
new file mode 100644
index 0000000..dd1fc9c
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/svn/SvnChangeLogFinder.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc.svn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.io.SVNRepository;
+import org.tmatesoft.svn.core.wc.SVNClientManager;
+import org.tmatesoft.svn.core.wc.SVNRevision;
+
+public class SvnChangeLogFinder {
+    
+    private static final String SLING_SVN_REPO_BASE = "https://svn.apache.org/repos/asf/sling";
+    
+    public static void main(String[] args) throws SVNException {
+        
+        new SvnChangeLogFinder().getChanges("org.apache.sling.adapter-2.1.2", "org.apache.sling.adapter-2.1.6")
+            .stream().forEach(System.out::println);
+    }
+    
+    public List<String> getChanges(String first, String second) throws SVNException {
+        
+        SVNURL svnUrl = SVNURL.parseURIEncoded(SLING_SVN_REPO_BASE);
+        
+        List<String> changes = new ArrayList<>();
+        
+        SVNClientManager manager  = SVNClientManager.newInstance();
+        
+        SVNRepository repo = manager.getRepositoryPool().createRepository(svnUrl, true);
+        
+        SVNRevision from = SVNRevision.create(getRevision(first, repo));
+        SVNRevision to = SVNRevision.create(getRevision(second, repo));
+        
+        repo.log(new String[] { "tags/" + second } ,from.getNumber(), to.getNumber(), false, false, (e) -> changes.add(e.getMessage()));
+        
+        return changes;
+    }
+
+
+    private long getRevision(String tagName, SVNRepository repo) throws SVNException {
+        
+        return repo.info("tags/" + tagName, -1).getRevision();
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/tooling/lc/ArtifactsTest.java b/src/test/java/org/apache/sling/tooling/lc/ArtifactsTest.java
index 9d41298..8b3b396 100644
--- a/src/test/java/org/apache/sling/tooling/lc/ArtifactsTest.java
+++ b/src/test/java/org/apache/sling/tooling/lc/ArtifactsTest.java
@@ -1,6 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
 package org.apache.sling.tooling.lc;
 
-import static org.apache.sling.tooling.lc.Artifacts.launchpadCoordinates;
+import static org.apache.sling.tooling.lc.aether.Artifacts.launchpadCoordinates;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-launchpad-comparator] 01/05: SLING-5099 - Create 'New and Noteworthy' page for Sling 8

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3468c5c9ce34c15c6b830bdf54b1ca7ddb870216
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Oct 13 20:46:25 2015 +0000

    SLING-5099 - Create 'New and Noteworthy' page for Sling 8
    
    Added a tooling/release/launchpad-comparator helper module which
    presents differences between two launchpad versions.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1708509 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 142 +++++++++++++++++++++
 .../org/apache/sling/tooling/lc/AetherSetup.java   |  71 +++++++++++
 .../org/apache/sling/tooling/lc/ArtifactKey.java   |  99 ++++++++++++++
 .../org/apache/sling/tooling/lc/Artifacts.java     |  45 +++++++
 .../java/org/apache/sling/tooling/lc/Main.java     | 124 ++++++++++++++++++
 .../org/apache/sling/tooling/lc/VersionChange.java |  41 ++++++
 .../org/apache/sling/tooling/lc/ArtifactsTest.java |  35 +++++
 7 files changed, 557 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..2cc217e
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+    license agreements. See the NOTICE file distributed with this work for additional 
+    information regarding copyright ownership. The ASF licenses this file to 
+    you under the Apache License, Version 2.0 (the "License"); you may not use 
+    this file except in compliance with the License. You may obtain a copy of 
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>25</version>
+    </parent>
+    <groupId>org.apache.sling.tooling</groupId>
+    <artifactId>launchpad-comparator</artifactId>
+    <version>0.9.0-SNAPSHOT</version>
+    <name>Apache Sling Launchpad Comparator</name>
+    <description>Command line utility which helps with comparing the artifacts contained by two launchpad instances.</description>
+
+    <dependencies>
+
+        <!-- Aether dependencies start -->
+        <dependency>
+            <groupId>org.eclipse.aether</groupId>
+            <artifactId>aether-api</artifactId>
+            <version>${aetherVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.aether</groupId>
+            <artifactId>aether-util</artifactId>
+            <version>${aetherVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.aether</groupId>
+            <artifactId>aether-impl</artifactId>
+            <version>${aetherVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.aether</groupId>
+            <artifactId>aether-connector-basic</artifactId>
+            <version>${aetherVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.aether</groupId>
+            <artifactId>aether-transport-file</artifactId>
+            <version>${aetherVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.aether</groupId>
+            <artifactId>aether-transport-http</artifactId>
+            <version>${aetherVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.aether</groupId>
+            <artifactId>aether-transport-wagon</artifactId>
+            <version>${aetherVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-aether-provider</artifactId>
+            <version>${mavenVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.wagon</groupId>
+            <artifactId>wagon-ssh</artifactId>
+            <version>${wagonVersion}</version>
+        </dependency>
+        <!-- Aether dependencies start -->
+
+        <!-- Sl4fj -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <!-- Provisioning model -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.provisioning.model</artifactId>
+            <version>1.3.0</version>
+        </dependency>
+
+        <!-- Launchpad plugin, used to read bundle lists -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>maven-launchpad-plugin</artifactId>
+            <version>2.3.2</version>
+        </dependency>
+
+        <!-- Force usable version of plexus-utils, needed by launchpad plugin -->
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-utils</artifactId>
+            <version>3.0.15</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>2.4.1</version>
+                <configuration>
+                    <transformers>
+                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                            <mainClass>org.apache.sling.tooling.lc.Main</mainClass>
+                        </transformer>
+                    </transformers>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <properties>
+        <sling.java.version>8</sling.java.version>
+        <aetherVersion>1.0.0.v20140518</aetherVersion>
+        <mavenVersion>3.1.0</mavenVersion>
+        <wagonVersion>1.0</wagonVersion>
+    </properties>
+</project>
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/tooling/lc/AetherSetup.java b/src/main/java/org/apache/sling/tooling/lc/AetherSetup.java
new file mode 100644
index 0000000..d529f3e
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/AetherSetup.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
+import org.eclipse.aether.impl.DefaultServiceLocator;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.ArtifactResult;
+import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
+import org.eclipse.aether.spi.connector.transport.TransporterFactory;
+import org.eclipse.aether.transport.file.FileTransporterFactory;
+import org.eclipse.aether.transport.http.HttpTransporterFactory;
+
+class AetherSetup {
+    
+    private final List<RemoteRepository> repos = Arrays.asList(
+        new RemoteRepository.Builder("central", "default", "http://central.maven.org/maven2/").build(),
+        new RemoteRepository.Builder("apache", "default", "https://repository.apache.org/content/groups/snapshots/").build()
+    );
+    
+    private final RepositorySystem system;
+    private final DefaultRepositorySystemSession session;
+            
+    
+    public AetherSetup() {
+        
+        DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
+        locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
+        locator.addService(TransporterFactory.class, FileTransporterFactory.class);
+        locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
+
+        system = locator.getService(RepositorySystem.class);
+        
+        session = MavenRepositorySystemUtils.newSession();
+
+        LocalRepository localRepo = new LocalRepository("target/local-repo");
+        session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
+    }
+    
+
+    public File download(String coordinates) throws ArtifactResolutionException {
+        ArtifactResult fromResult = system.resolveArtifact(session, new ArtifactRequest(new DefaultArtifact(coordinates), repos, null));
+
+        return fromResult.getArtifact().getFile();
+    }
+}
diff --git a/src/main/java/org/apache/sling/tooling/lc/ArtifactKey.java b/src/main/java/org/apache/sling/tooling/lc/ArtifactKey.java
new file mode 100644
index 0000000..047a1d2
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/ArtifactKey.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc;
+
+import java.util.Objects;
+
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.apache.sling.provisioning.model.Artifact;
+
+class ArtifactKey implements Comparable<ArtifactKey> {
+    
+    private String groupId;
+    private String artifactId;
+    private String classifier;
+    private String type;
+    
+    public ArtifactKey(Bundle bundle) {
+        
+        this(bundle.getGroupId(), bundle.getArtifactId(), bundle.getClassifier(), bundle.getType());
+    }
+
+    public ArtifactKey(Artifact artifact) {
+        
+        this(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType());
+    }
+    
+    private ArtifactKey(String groupId, String artifactId, String classifier, String type) {
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.classifier = classifier != null ? classifier : "";
+        this.type = type;
+    }
+
+    @Override
+    public int hashCode() {
+        
+        return Objects.hash(artifactId, classifier, groupId, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        
+        if ( !(obj instanceof ArtifactKey) ) {
+            return false;
+        }
+        
+        ArtifactKey other = (ArtifactKey) obj;
+        
+        return Objects.equals(artifactId, other.artifactId)
+                && Objects.equals(groupId, other.groupId)
+                && Objects.equals(classifier, other.classifier)
+                && Objects.equals(type, other.type);
+    }
+    
+    public String getArtifactId() {
+        return artifactId;
+    }
+    
+    public String getGroupId() {
+        return groupId;
+    }
+    
+    public String getClassifier() {
+        return classifier;
+    }
+    
+    public String getType() {
+        return type;
+    }
+    
+    @Override
+    public String toString() {
+        
+        return "Artifact [groupId=" + groupId + ", artifactId=" + artifactId + ", classifier=" + classifier + ", type=" + type + "]";
+    }
+
+    @Override
+    public int compareTo(ArtifactKey o) {
+        
+        Artifact us = new Artifact(groupId, artifactId, "0.0.0", classifier, type);
+        Artifact them = new Artifact(o.groupId, o.artifactId, "0.0.0", o.classifier, o.type);
+        
+        return us.compareTo(them);
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/tooling/lc/Artifacts.java b/src/main/java/org/apache/sling/tooling/lc/Artifacts.java
new file mode 100644
index 0000000..0ffc42a
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/Artifacts.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+class Artifacts {
+
+    private static final Pattern VERSION_NUMBER = Pattern.compile("^(\\d+)(-SNAPSHOT)?");
+    
+    public static final String launchpadCoordinates(String version) {
+        
+        Matcher versionMatcher = VERSION_NUMBER.matcher(version);
+        
+        if ( !versionMatcher.matches()) {
+            throw new IllegalArgumentException("Invalid version " + version);
+        }
+        
+        int versionNumber = Integer.parseInt(versionMatcher.group(1));
+
+        
+        // versions 6 and 7 used an XML bundle list
+        if ( versionNumber < 8 ) {
+            return "org.apache.sling:org.apache.sling.launchpad:xml:bundlelist:" + version;
+        }
+        
+        // versions 8 and newer use the provisioning model
+        return "org.apache.sling:org.apache.sling.launchpad:txt:slingfeature:" + version;
+    }
+}
diff --git a/src/main/java/org/apache/sling/tooling/lc/Main.java b/src/main/java/org/apache/sling/tooling/lc/Main.java
new file mode 100644
index 0000000..7b7837b
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/Main.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.nio.file.Files;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import org.apache.sling.maven.projectsupport.BundleListUtils;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.provisioning.model.Artifact;
+import org.apache.sling.provisioning.model.Model;
+import org.apache.sling.provisioning.model.ModelUtility;
+import org.apache.sling.provisioning.model.io.ModelReader;
+
+import com.google.common.collect.Sets;
+
+public class Main {
+
+    public static void main(String[] args) throws Exception {
+        
+        // 0. read CLI arguments
+        String firstVersion = "7";
+        String secondVersion = "8";
+        if ( args.length == 2) {
+            firstVersion = args[0];
+            secondVersion = args[1];
+        }
+        
+        System.out.format("Computing differences between Launchpad versions %s and %s...%n", 
+                firstVersion, secondVersion);
+        
+        // 1. download artifacts
+        AetherSetup aether = new AetherSetup();
+
+        File fromFile = aether.download(Artifacts.launchpadCoordinates(firstVersion));
+        File toFile = aether.download(Artifacts.launchpadCoordinates(secondVersion));
+
+        // 2. parse artifact definitions
+        Model model;
+        try (BufferedReader reader = Files.newBufferedReader(toFile.toPath())) {
+            model = ModelUtility.getEffectiveModel(ModelReader.read(reader, null));
+        }
+        
+        // TODO - versions are not interpolated
+        Map<ArtifactKey, Artifact> to = model.getFeatures().stream()
+            .flatMap( f -> f.getRunModes().stream())
+            .flatMap( r -> r.getArtifactGroups().stream())
+            .flatMap( g -> StreamSupport.stream(g.spliterator(), false))
+            .collect(Collectors.toMap( a -> new ArtifactKey(a), Function.identity()));
+        
+        BundleList readBundleList = BundleListUtils.readBundleList(fromFile);
+        
+        // 3. generate added / removed / changed
+        Map<ArtifactKey, Artifact> from = readBundleList.getStartLevels().stream()
+            .flatMap( sl -> sl.getBundles().stream() )
+            .collect(Collectors.toMap( b -> new ArtifactKey(b), Main::newArtifact));
+        
+        Set<Artifact> removed = Sets.difference(from.keySet(), to.keySet()).stream()
+            .map( k -> from.get(k))
+            .collect(Collectors.toSet());
+
+        Set<Artifact> added = Sets.difference(to.keySet(), from.keySet()).stream()
+                .map( k -> to.get(k))
+                .collect(Collectors.toSet());
+
+        Map<ArtifactKey, VersionChange> changed = to.values().stream()
+                .filter( k -> !added.contains(k) && !removed.contains(k))
+                .map( k -> new ArtifactKey(k))
+                .filter( k -> !Objects.equals(to.get(k).getVersion(), from.get(k).getVersion()))
+                .collect(Collectors.toMap( Function.identity(), k -> new VersionChange(from.get(k).getVersion(), to.get(k).getVersion())));
+
+        // 4. output changes
+        
+        System.out.println("Added ");
+        added.stream().sorted().forEach(Main::outputFormatted);
+        
+        System.out.println("Removed ");
+        removed.stream().sorted().forEach(Main::outputFormatted);
+        
+        System.out.println("Changed");
+        changed.entrySet().stream()
+            .sorted( (a, b) -> a.getKey().compareTo(b.getKey()) )
+            .forEach(Main::outputFormatted);
+    }
+
+    private static Artifact newArtifact(Bundle bundle) {
+        
+        return new Artifact(bundle.getGroupId(), bundle.getArtifactId(), bundle.getVersion(), bundle.getClassifier(), bundle.getType());
+    }
+    
+    private static void outputFormatted(Artifact a) {
+        
+        System.out.format("    %-30s : %-55s : %s%n", a.getGroupId(), a.getArtifactId(), a.getVersion());
+        
+    }
+
+    private static void outputFormatted(Map.Entry<ArtifactKey, VersionChange> e) {
+        
+        System.out.format("    %-30s : %-55s : %s -> %s%n", e.getKey().getGroupId(), e.getKey().getArtifactId(), e.getValue().getFrom(), e.getValue().getTo());
+        
+    }
+}
diff --git a/src/main/java/org/apache/sling/tooling/lc/VersionChange.java b/src/main/java/org/apache/sling/tooling/lc/VersionChange.java
new file mode 100644
index 0000000..7c69d0b
--- /dev/null
+++ b/src/main/java/org/apache/sling/tooling/lc/VersionChange.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.tooling.lc;
+
+class VersionChange {
+    
+    private String from;
+    private String to;
+
+    public VersionChange(String from, String to) {
+        this.from = from;
+        this.to = to;
+    }
+    
+    public String getFrom() {
+        return from;
+    }
+    
+    public String getTo() {
+        return to;
+    }
+    
+    @Override
+    public String toString() {
+        return "VersionChange [" +from + " -> " + to +"]";
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/tooling/lc/ArtifactsTest.java b/src/test/java/org/apache/sling/tooling/lc/ArtifactsTest.java
new file mode 100644
index 0000000..9d41298
--- /dev/null
+++ b/src/test/java/org/apache/sling/tooling/lc/ArtifactsTest.java
@@ -0,0 +1,35 @@
+package org.apache.sling.tooling.lc;
+
+import static org.apache.sling.tooling.lc.Artifacts.launchpadCoordinates;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class ArtifactsTest {
+    
+    @Test
+    public void launchpadV7() {
+        
+        assertThat(launchpadCoordinates("7"), equalTo("org.apache.sling:org.apache.sling.launchpad:xml:bundlelist:7"));
+    }
+    
+    @Test
+    public void launchpadV7Snapshot() {
+        
+        assertThat(launchpadCoordinates("7-SNAPSHOT"), equalTo("org.apache.sling:org.apache.sling.launchpad:xml:bundlelist:7-SNAPSHOT"));
+    }
+
+    @Test
+    public void launchpadV8() {
+        
+        assertThat(launchpadCoordinates("8"), equalTo("org.apache.sling:org.apache.sling.launchpad:txt:slingfeature:8"));
+    }
+    
+    @Test
+    public void launchpadV8Snapshot() {
+        
+        assertThat(launchpadCoordinates("8-SNAPSHOT"), equalTo("org.apache.sling:org.apache.sling.launchpad:txt:slingfeature:8-SNAPSHOT"));
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-launchpad-comparator] 04/05: LaunchpadComparer: more robust SVN changelog parsing

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 25fe3dee95b2afef83784523e89216ac736d286c
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Aug 14 13:44:08 2017 +0000

    LaunchpadComparer: more robust SVN changelog parsing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1804996 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java b/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
index 43aae47..c7ab92d 100644
--- a/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
+++ b/src/main/java/org/apache/sling/tooling/lc/LaunchpadComparer.java
@@ -140,6 +140,7 @@ public class LaunchpadComparer {
         try {
             List<String> issues = svn.getChanges(fromTag, toTag)
                 .stream()
+                .map( m -> m.split(System.lineSeparator())[0])
                 .map(LaunchpadComparer::toJiraKey)
                 .filter( k -> k != null)
                 .collect(Collectors.toList());

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.