continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r477360 - in /maven/continuum/trunk/continuum-core/src: main/java/org/apache/maven/continuum/execution/maven/m2/ main/java/org/apache/maven/continuum/project/builder/maven/ test/java/org/apache/maven/continuum/project/builder/maven/ test/re...
Date Mon, 20 Nov 2006 21:59:16 GMT
Author: evenisse
Date: Mon Nov 20 13:59:15 2006
New Revision: 477360

URL: http://svn.apache.org/viewvc?view=rev&rev=477360
Log:
[CONTINUUM-529] Don't use maven for scm url resolution. Support now modules with module name
!= artifactId without scm tag in this module.

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
    maven/continuum/trunk/continuum-core/src/test/resources/projects/continuum/continuum-xmlrpc/pom.xml

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?view=diff&rev=477360&r1=477359&r2=477360
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
Mon Nov 20 13:59:15 2006
@@ -151,14 +151,22 @@
         // SCM Url
         // ----------------------------------------------------------------------
 
-        String scmUrl = getScmUrl( mavenProject );
+        // TODO: Remove this: scm url shouldn't be null there
+        if ( StringUtils.isEmpty( continuumProject.getScmUrl() ) )
+        {
+            String scmUrl = getScmUrl( mavenProject );
 
-        continuumProject.setScmUrl( scmUrl );
+            continuumProject.setScmUrl( scmUrl );
 
-        if ( !"HEAD".equals( mavenProject.getScm().getTag() ) )
-        {
-            continuumProject.setScmTag( mavenProject.getScm().getTag() );
+            if ( !"HEAD".equals( mavenProject.getScm().getTag() ) )
+            {
+                continuumProject.setScmTag( mavenProject.getScm().getTag() );
+            }
         }
+
+        // ----------------------------------------------------------------------
+        // Version
+        // ----------------------------------------------------------------------
 
         continuumProject.setVersion( getVersion( mavenProject ) );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?view=diff&rev=477360&r1=477359&r2=477360
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
Mon Nov 20 13:59:15 2006
@@ -88,7 +88,7 @@
 
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
 
-        readModules( url, result, true, username, password );
+        readModules( url, result, true, username, password, null );
 
         return result;
     }
@@ -98,7 +98,7 @@
     // ----------------------------------------------------------------------
 
     private void readModules( URL url, ContinuumProjectBuildingResult result, boolean groupPom,
String username,
-                              String password )
+                              String password, String scmUrl )
     {
         MavenProject mavenProject;
 
@@ -214,6 +214,22 @@
                 return;
             }
 
+            // Rewrite scmurl from the one found in added project due to a bug in scm url
resolution
+            // for projects that doesn't have module name != artifactId
+            if ( StringUtils.isNotEmpty( scmUrl))
+            {
+                continuumProject.setScmUrl( scmUrl);
+            }
+            else
+            {
+                scmUrl = continuumProject.getScmUrl();
+            }
+
+            if ( !"HEAD".equals( mavenProject.getScm().getTag() ) )
+            {
+                continuumProject.setScmTag( mavenProject.getScm().getTag() );
+            }
+
             result.addProject( continuumProject, MavenTwoBuildExecutor.ID );
         }
 
@@ -255,7 +271,7 @@
                 continue;
             }
 
-            readModules( moduleUrl, result, false, username, password );
+            readModules( moduleUrl, result, false, username, password, scmUrl+"/"+module
);
         }
     }
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?view=diff&rev=477360&r1=477359&r2=477360
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
Mon Nov 20 13:59:15 2006
@@ -25,13 +25,13 @@
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
+import java.net.URL;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.HashMap;
-import java.net.URL;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -43,8 +43,8 @@
     public void testGetEmailAddressWhenTypeIsSetToEmail()
         throws Exception
     {
-        ContinuumProjectBuilder projectBuilder = (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE,
-                                                                                   MavenTwoContinuumProjectBuilder.ID
);
+        ContinuumProjectBuilder projectBuilder =
+            (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID
);
 
         File pom = getTestFile( "src/test/repository/maven-builder-helper-1.xml" );
 
@@ -58,7 +58,7 @@
 
         assertEquals( 1, result.getProjects().size() );
 
-        ProjectGroup pg = (ProjectGroup)result.getProjectGroups().get(0);
+        ProjectGroup pg = (ProjectGroup) result.getProjectGroups().get( 0 );
 
         assertNotNull( pg );
 
@@ -76,8 +76,8 @@
     public void testGetEmailAddressWhenTypeIsntSet()
         throws Exception
     {
-        ContinuumProjectBuilder projectBuilder = (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE,
-                                                                                   MavenTwoContinuumProjectBuilder.ID
);
+        ContinuumProjectBuilder projectBuilder =
+            (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID
);
 
         File pom = getTestFile( "src/test/repository/maven-builder-helper-2.xml" );
 
@@ -91,7 +91,7 @@
 
         assertEquals( 1, result.getProjects().size() );
 
-        ProjectGroup pg = (ProjectGroup)result.getProjectGroups().get(0);
+        ProjectGroup pg = (ProjectGroup) result.getProjectGroups().get( 0 );
 
         assertNotNull( pg );
 
@@ -109,8 +109,8 @@
     public void testGetScmUrlWithParams()
         throws Exception
     {
-        ContinuumProjectBuilder projectBuilder = (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE,
-                                                                                   MavenTwoContinuumProjectBuilder.ID
);
+        ContinuumProjectBuilder projectBuilder =
+            (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID
);
 
         File pom = getTestFile( "src/test/repository/maven-builder-helper-3.xml" );
 
@@ -124,7 +124,7 @@
 
         assertEquals( 1, result.getProjects().size() );
 
-        ProjectGroup pg = (ProjectGroup)result.getProjectGroups().get(0);
+        ProjectGroup pg = (ProjectGroup) result.getProjectGroups().get( 0 );
 
         assertNotNull( pg );
 
@@ -140,9 +140,9 @@
 
         String username = System.getProperty( "user.name" );
 
-        String scmUrl = "scm:cvs:ext:${user.name}@company.org:/home/company/cvs:project/foo"
;
+        String scmUrl = "scm:cvs:ext:${user.name}@company.org:/home/company/cvs:project/foo";
 
-        Project project = (Project)result.getProjects().get(0);
+        Project project = (Project) result.getProjects().get( 0 );
 
         scmUrl = StringUtils.replace( scmUrl, "${user.name}", username );
 
@@ -152,8 +152,8 @@
     public void testCreateProjectsWithModules()
         throws Exception
     {
-        ContinuumProjectBuilder projectBuilder = (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE,
-                                                                                   MavenTwoContinuumProjectBuilder.ID
);
+        ContinuumProjectBuilder projectBuilder =
+            (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID
);
 
         URL url = getClass().getClassLoader().getResource( "projects/continuum/pom.xml" );
 
@@ -225,8 +225,11 @@
         assertMavenTwoProject( "Continuum Core", projects );
         assertMavenTwoProject( "Continuum Model", projects );
         assertMavenTwoProject( "Continuum Plexus Application", projects );
-        assertMavenTwoProject( "Continuum Web", projects );
-        assertMavenTwoProject( "Continuum XMLRPC Interface", projects );
+        assertScmUrl( "Continuum Web", projects,
+                      "scm:svn:http://svn.apache.org/repos/asf/maven/continuum/tags/continuum-1.0.3/continuum-web"
);
+        //directoryName != artifactId for this project
+        assertScmUrl( "Continuum XMLRPC Interface", projects,
+                      "scm:svn:http://svn.apache.org/repos/asf/maven/continuum/tags/continuum-1.0.3/continuum-xmlrpc"
);
         assertMavenTwoProject( "Continuum Notifiers", projects );
         assertMavenTwoProject( "Continuum IRC Notifier", projects );
         assertMavenTwoProject( "Continuum Jabber Notifier", projects );
@@ -238,14 +241,13 @@
                       ( (Project) projects.get( "Continuum Jabber Notifier" ) ).getParent().getArtifactId()
);
 
         assertDependency( "Continuum Model", "Continuum Web", projects );
-
     }
 
     public void testCreateProjectWithoutModules()
         throws Exception
     {
-        ContinuumProjectBuilder projectBuilder = (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE,
-                                                                                   MavenTwoContinuumProjectBuilder.ID
);
+        ContinuumProjectBuilder projectBuilder =
+            (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID
);
 
         URL url = getClass().getClassLoader().getResource( "projects/continuum/continuum-core/pom.xml"
);
 
@@ -306,9 +308,8 @@
         {
             ProjectDependency pd = (ProjectDependency) i.next();
 
-            if ( pd.getArtifactId().equals( dependency.getArtifactId() )
-                && pd.getGroupId().equals( dependency.getGroupId() )
-                && pd.getVersion().equals( dependency.getVersion() ) )
+            if ( pd.getArtifactId().equals( dependency.getArtifactId() ) &&
+                pd.getGroupId().equals( dependency.getGroupId() ) && pd.getVersion().equals(
dependency.getVersion() ) )
             {
                 return;
             }
@@ -321,9 +322,14 @@
     //
     // ----------------------------------------------------------------------
 
+    private Project getProject( String name, Map projects )
+    {
+        return (Project) projects.get( name );
+    }
+
     private void assertMavenTwoProject( String name, Map projects )
     {
-        Project project = (Project) projects.get( name );
+        Project project = getProject( name, projects );
 
         assertNotNull( project );
 
@@ -332,5 +338,14 @@
         String scmUrl = "scm:svn:http://svn.apache.org/repos/asf/maven/continuum/";
 
         assertTrue( project.getScmUrl().startsWith( scmUrl ) );
+    }
+
+    private void assertScmUrl( String name, Map projects, String scmUrl )
+    {
+        assertMavenTwoProject( name, projects );
+
+        Project project = getProject( name, projects );
+
+        assertEquals( scmUrl, project.getScmUrl() );
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/test/resources/projects/continuum/continuum-xmlrpc/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/resources/projects/continuum/continuum-xmlrpc/pom.xml?view=diff&rev=477360&r1=477359&r2=477360
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/projects/continuum/continuum-xmlrpc/pom.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/projects/continuum/continuum-xmlrpc/pom.xml
Mon Nov 20 13:59:15 2006
@@ -5,7 +5,7 @@
     <artifactId>continuum-parent</artifactId>
     <version>1.0.3</version>
   </parent>
-  <artifactId>continuum-xmlrpc</artifactId>
+  <artifactId>continuum-xmlrpc-server</artifactId>
   <name>Continuum XMLRPC Interface</name>
   <dependencies>
     <dependency>



Mime
View raw message