continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r699458 - in /continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/a...
Date Fri, 26 Sep 2008 19:28:21 GMT
Author: olamy
Date: Fri Sep 26 12:28:21 2008
New Revision: 699458

URL: http://svn.apache.org/viewvc?rev=699458&view=rev
Log:
merge -r 699165:699203 from 1.2.x branch
[CONTINUUM-1889] [CONTINUUM-1874] [CONTINUUM-1838] [CONTINUUM-1815] 
Please merge each commit thanks
 


Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildDefinitionAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
    continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=699458&r1=699457&r2=699458&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Fri Sep 26 12:28:21 2008
@@ -356,7 +356,8 @@
             // now we will load all BuildResult with an Id bigger or equals than the oldBuildResult
one
             if ( oldBuildResult != null )
             {
-                context.setOldScmResult( getOldScmResults( projectId, oldBuildResult.getBuildNumber(),
oldBuildResult.getEndTime() ) );
+                context.setOldScmResult(
+                    getOldScmResults( projectId, oldBuildResult.getBuildNumber(), oldBuildResult.getEndTime()
) );
             }
         }
         catch ( ContinuumStoreException e )
@@ -478,6 +479,11 @@
         throws TaskExecutionException
     {
         BuildDefinition buildDefinition = context.getBuildDefinition();
+        if ( buildDefinition.isBuildFresh() )
+        {
+            getLogger().info( "FreshBuild configured, building" );
+            return true;
+        }
         if ( buildDefinition.isAlwaysBuild() )
         {
             getLogger().info( "AlwaysBuild configured, building" );
@@ -799,7 +805,7 @@
                             if ( changeSet.getDate() < fromDate )
                             {
                                 continue;
-                            }                            
+                            }
                             if ( !res.getChanges().contains( changeSet ) )
                             {
                                 res.addChange( changeSet );

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=699458&r1=699457&r2=699458&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
Fri Sep 26 12:28:21 2008
@@ -30,7 +30,12 @@
 import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
 import java.util.Calendar;
+import java.util.List;
 
 public class DefaultBuildControllerTest
     extends AbstractContinuumTest
@@ -75,6 +80,7 @@
         buildResult2.setState( ContinuumProjectState.OK );
         buildResult2.setBuildDefinition( bd1 );
         buildResultDao.addBuildResult( project1, buildResult2 );
+        createPomFile( getProjectDao().getProjectWithAllDetails( projectId1 ) );
 
         Project project2 = createProject( "project2" );
         ProjectDependency dep1 = new ProjectDependency();
@@ -92,7 +98,8 @@
         project2.setState( ContinuumProjectState.OK );
         projectId2 = addProject( project2 ).getId();
         buildDefinitionId2 = buildDefinitionDao.getDefaultBuildDefinition( projectId2 ).getId();
-
+        createPomFile( getProjectDao().getProjectWithAllDetails( projectId2 ) );
+        
         controller = (DefaultBuildController) lookup( BuildController.ROLE );
     }
 
@@ -176,4 +183,72 @@
         assertEquals( 1, context.getModifiedDependencies().size() );
         assertTrue( controller.shouldBuild( context ) );
     }
+
+    private File getWorkingDirectory()
+        throws Exception
+    {
+        File workingDirectory = getTestFile( "target/working-directory" );
+        
+        if ( !workingDirectory.exists() )
+        {
+            workingDirectory.mkdir();
+        }
+        
+        return workingDirectory;
+    }
+    
+    private File getWorkingDirectory( Project project )
+        throws Exception
+    {
+        File projectDir = new File( getWorkingDirectory(), Integer.toString( project.getId()
) );
+
+        if ( !projectDir.exists() )
+        {
+            projectDir.mkdirs();
+            System.out.println( "projectdirectory created" + projectDir.getAbsolutePath()
);
+        }
+
+        return projectDir;
+    }
+    
+    private void createPomFile( Project project )
+        throws Exception
+    {
+        File pomFile = new File( getWorkingDirectory( project ), "pom.xml" );
+        
+        BufferedWriter out = new BufferedWriter( new FileWriter( pomFile ) );
+        out.write( "<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/maven-v4_0_0.xsd\">\n"
);
+        out.write( "<modelVersion>4.0.0</modelVersion>\n" );
+        out.write( "<groupId>" + project.getGroupId() + "</groupId>\n" );
+        out.write( "<artifactId>" + project.getArtifactId() + "</artifactId>\n"
);
+        out.write( "<version>" + project.getVersion() + "</version>\n" );
+        out.write( "<scm>\n" );
+        out.write( "<connection>" + "scm:local|" + getWorkingDirectory().getAbsolutePath()
+ 
+                   "|" + project.getId() + "</connection>\n" );
+        out.write( "</scm>" );
+
+        if ( project.getDependencies().size() > 0 )
+        {
+            out.write( "<dependencies>\n" );
+
+            List<ProjectDependency> dependencies = project.getDependencies();
+
+            for ( ProjectDependency dependency : dependencies )
+            {
+                out.write( "<dependency>\n" );
+                out.write( "<groupId>" + dependency.getGroupId() + "</groupId>\n"
);
+                out.write( "<artifactId>" + dependency.getArtifactId() + "</artifactId>\n"
);
+                out.write( "<version>" + dependency.getVersion() + "</version>\n"
);
+                out.write( "</dependency>\n" );
+            }
+            out.write( "</dependencies>\n" );
+        }
+
+        out.write( "</project>" );
+        out.close();
+        
+        System.out.println( "pom file created" );
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildDefinitionAction.java?rev=699458&r1=699457&r2=699458&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildDefinitionAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildDefinitionAction.java
Fri Sep 26 12:28:21 2008
@@ -19,16 +19,16 @@
  * under the License.
  */
 
-import java.util.LinkedList;
-import java.util.List;
-
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.web.model.BuildDefinitionSummary;
 
+import java.util.LinkedList;
+import java.util.List;
+
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
- * @since 16 sept. 07
  * @version $Id$
+ * @since 16 sept. 07
  */
 public abstract class AbstractBuildDefinitionAction
     extends ContinuumActionSupport
@@ -53,7 +53,7 @@
         }
         bds.setDescription( buildDefinition.getDescription() );
         bds.setType( buildDefinition.getType() );
-        bds.setAlwaysBuild( buildDefinition.isAlwaysBuild() );
+        bds.setAlwaysBuild( buildDefinition.isBuildFresh() || buildDefinition.isAlwaysBuild()
);
         return bds;
     }
 

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=699458&r1=699457&r2=699458&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Fri Sep 26 12:28:21 2008
@@ -466,7 +466,7 @@
             ProjectGroup newProjectGroup =
                 getContinuum().getProjectGroupWithProjects( new Integer( id[0] ).intValue()
);
 
-            if ( newProjectGroup.getId() != projectGroup.getId() )
+            if ( newProjectGroup.getId() != projectGroup.getId() && isAuthorized(
newProjectGroup.getName() ) )
             {
                 getLogger().info(
                     "Moving project " + project.getName() + " to project group " + newProjectGroup.getName()
);

Modified: continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java
URL: http://svn.apache.org/viewvc/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java?rev=699458&r1=699457&r2=699458&view=diff
==============================================================================
--- continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java
(original)
+++ continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java
Fri Sep 26 12:28:21 2008
@@ -34,6 +34,14 @@
     extends AbstractContinuumMojo
 {
     /**
+     * POM file name.
+     *
+     * @parameter expression="${pomFilename}" default-value="pom.xml"
+     * @required
+     */
+    private String pomFilename;
+
+    /**
      * POM Url.
      *
      * @parameter expression="${projectUrl}" default-value="${project.scm.url}"
@@ -54,7 +62,16 @@
         AddingResult addingResult = null;
         try
         {
+            if ( !projectUrl.endsWith( pomFilename ) )
+            {
+                if ( !projectUrl.endsWith( "/" ) )
+                {
+                    projectUrl += "/";
+                }
+                projectUrl += pomFilename;
+            }
 
+            getLog().info( "Adding M2 project from " + projectUrl );
             if ( projectGroupId != null && projectGroupId.length() > 0 )
             {
                 addingResult = getClient().addMavenTwoProject( projectUrl, Integer.parseInt(
projectGroupId ) );
@@ -68,6 +85,8 @@
                 getLog().error( "fail to add mavenTwo project " + addingResult.getErrorsAsString()
);
                 throw new MojoExecutionException( "fail to add mavenTwo project " + addingResult.getErrorsAsString()
);
             }
+            //TODO: print projects/project groups added
+            //addingResult.getProjects();
         }
         catch ( MojoExecutionException e )
         {



Mime
View raw message