continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r168187 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2 /maven/continuum/trunk/continuum-model/src/main/resources
Date Wed, 04 May 2005 20:42:32 GMT
Author: trygvis
Date: Wed May  4 13:42:31 2005
New Revision: 168187

URL: http://svn.apache.org/viewcvs?rev=168187&view=rev
Log:
o Separating the shell builder from the maven 2 builder.
o Making the Maven 2 builder return proper MavenTwoBuildResult objects.

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/DefaultMavenBuilderHelper.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/MavenShellBuilder.java
    maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/DefaultMavenBuilderHelper.java?rev=168187&r1=168186&r2=168187&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/DefaultMavenBuilderHelper.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/DefaultMavenBuilderHelper.java
Wed May  4 13:42:31 2005
@@ -28,6 +28,7 @@
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.MavenTwoProject;
 import org.apache.maven.model.CiManagement;
 import org.apache.maven.model.Notifier;
 import org.apache.maven.model.Repository;
@@ -74,7 +75,7 @@
         // We need to roll the project data into a file so that we can use it
         // ----------------------------------------------------------------------
 
-        ContinuumProject project = new ContinuumProject();
+        MavenTwoProject project = new MavenTwoProject();
 
         try
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/MavenShellBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/MavenShellBuilder.java?rev=168187&r1=168186&r2=168187&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/MavenShellBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/maven/m2/MavenShellBuilder.java
Wed May  4 13:42:31 2005
@@ -18,10 +18,13 @@
 
 import java.io.File;
 import java.net.URL;
-import java.util.Arrays;
 
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.builder.shell.ShellBuilder;
+import org.apache.maven.continuum.builder.AbstractContinuumBuilder;
+import org.apache.maven.continuum.builder.ContinuumBuilder;
+import org.apache.maven.continuum.builder.shell.ExecutionResult;
+import org.apache.maven.continuum.builder.shell.ShellCommandHelper;
+import org.apache.maven.continuum.project.ContinuumBuildResult;
 import org.apache.maven.continuum.project.ContinuumProject;
 
 /**
@@ -29,13 +32,17 @@
  * @version $Id: MavenShellBuilder.java,v 1.2 2005/04/07 23:27:39 trygvis Exp $
  */
 public class MavenShellBuilder
-    extends ShellBuilder
+    extends AbstractContinuumBuilder
+    implements ContinuumBuilder
 {
     public final static String CONFIGURATION_GOALS = "goals";
 
     public final static String ID = "maven2";
 
     /** @requirement */
+    private ShellCommandHelper shellCommandHelper;
+
+    /** @requirement */
     private MavenBuilderHelper builderHelper;
 
     /** @configuration */
@@ -48,31 +55,51 @@
     // ContinuumBuilder Implementation
     // ----------------------------------------------------------------------
 
-    public ContinuumProject createProjectFromMetadata( URL metadata )
+    public ContinuumBuildResult build( ContinuumProject project )
         throws ContinuumException
     {
-        return builderHelper.createProjectFromMetadata( metadata );
-    }
+        File workingDirectory = new File( project.getWorkingDirectory() );
 
-    public void updateProjectFromCheckOut( File workingDirectory, ContinuumProject project
)
-        throws ContinuumException
-    {
-        builderHelper.updateProjectFromMetadata( workingDirectory, project );
-    }
+        ExecutionResult executionResult;
 
-    // ----------------------------------------------------------------------
-    // ShellBuilder Implementation
-    // ----------------------------------------------------------------------
+        String[] arguments = getArguments( project );
+
+        try
+        {
+            executionResult = shellCommandHelper.executeShellCommand( workingDirectory,
+                                                                      executable,
+                                                                      arguments );
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "Error while executing shell command.", e );
+        }
+
+        boolean success = executionResult.getExitCode() == 0;
 
-    protected boolean prependWorkingDirectoryIfMissing()
+        MavenTwoBuildResult result = new MavenTwoBuildResult();
+
+        result.setSuccess( success );
+
+        result.setStandardOutput( executionResult.getStandardOutput() );
+
+        result.setStandardError( executionResult.getStandardError() );
+
+        result.setExitCode( executionResult.getExitCode() );
+
+        return result;
+    }
+
+    public ContinuumProject createProjectFromMetadata( URL metadata )
+        throws ContinuumException
     {
-        return false;
+        return builderHelper.createProjectFromMetadata( metadata );
     }
 
-    protected String getExecutable( ContinuumProject project )
+    public void updateProjectFromCheckOut( File workingDirectory, ContinuumProject project
)
         throws ContinuumException
     {
-        return executable;
+        builderHelper.updateProjectFromMetadata( workingDirectory, project );
     }
 
     protected String[] getArguments( ContinuumProject project )
@@ -87,8 +114,6 @@
         System.arraycopy( a, 0, arguments, 0, a.length );
 
         System.arraycopy( goals, 0, arguments, a.length, goals.length );
-
-        System.err.println( "arguments: " + Arrays.asList( arguments ) );
 
         return arguments;
     }

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=168187&r1=168186&r2=168187&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Wed May  4 13:42:31
2005
@@ -15,7 +15,7 @@
    |
    |-->
   <classes>
-    <class rootElement="true" stash.storable="true">
+    <class rootElement="true" stash.storable="true"><!--  java.abstract="true" -->
       <name>ContinuumProject</name>
       <version>1.0.0</version>
       <fields>
@@ -247,10 +247,8 @@
     |
     | BuilderBuildResult
     |
-    | This class should be abstract.
-    |
     | -->
-    <class stash.storable="true">
+    <class stash.storable="true"> <!-- java.abstract="true"-->
       <name>ContinuumBuildResult</name>
       <version>1.0.0</version>
       <fields>
@@ -321,9 +319,9 @@
         </field>
       </fields>
     </class>
-<!--
+
     <class>
-      <name>Maven2BuildResult</name>
+      <name>MavenTwoBuildResult</name>
       <packageName>org.apache.maven.continuum.builder.maven.m2</packageName>
       <superClass>ContinuumBuildResult</superClass>
       <version>1.0.0</version>
@@ -345,7 +343,7 @@
         </field>
       </fields>
     </class>
--->
+
     <class>
       <name>AntBuildResult</name>
       <packageName>org.apache.maven.continuum.builder.ant</packageName>
@@ -375,7 +373,7 @@
      | Scm Result
      |
      |-->
-    <class><!-- abstract -->
+    <class java.abstract="true">
       <name>ScmResult</name>
       <packageName>org.apache.maven.continuum.scm</packageName>
       <version>1.0.0</version>



Mime
View raw message