continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r351508 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/execution/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/main/java/org/apache/maven/continuum/execution/ c...
Date Thu, 01 Dec 2005 22:33:19 GMT
Author: evenisse
Date: Thu Dec  1 14:33:05 2005
New Revision: 351508

URL: http://svn.apache.org/viewcvs?rev=351508&view=rev
Log:
PR: CONTINUUM-491

Allow to define a path to a pom in build definitions instead of always take pom.xml in working
directory

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java
Thu Dec  1 14:33:05 2005
@@ -32,6 +32,6 @@
     ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition,
File buildOutput )
         throws ContinuumBuildExecutorException;
 
-    void updateProjectFromCheckOut( File workingDirectory, Project project )
+    void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition
buildDefinition )
         throws ContinuumBuildExecutorException;
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Thu Dec  1 14:33:05 2005
@@ -108,9 +108,6 @@
 
         build.setTrigger( trigger );
 
-        // TODO: select actualy build def
-        List buildDefinitions = project.getBuildDefinitions();
-
         BuildDefinition buildDefinition = store.getBuildDefinition( getBuildDefinitionId(
context ) );
 
         build.setScmResult( scmResult );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
Thu Dec  1 14:33:05 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorException;
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
+import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
@@ -50,13 +51,15 @@
 
         getLogger().info( "Updating project '" + project.getName() + "' from checkout." );
 
+        BuildDefinition buildDefinition = store.getBuildDefinition( getBuildDefinitionId(
context ) );
+
         // ----------------------------------------------------------------------
         // Make a new descriptor
         // ----------------------------------------------------------------------
 
         ContinuumBuildExecutor builder = buildExecutorManager.getBuildExecutor( project.getExecutorId()
);
 
-        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project
), project );
+        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project
), project, buildDefinition );
 
         // ----------------------------------------------------------------------
         // Store the new descriptor

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
Thu Dec  1 14:33:05 2005
@@ -131,7 +131,7 @@
 
         String actualExecutable;
 
-        File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
+        File workingDirectory = getWorkingDirectory( project );
 
         if ( !resolveExecutable )
         {
@@ -201,4 +201,8 @@
         }
     }
 
+    public File getWorkingDirectory( Project project )
+    {
+        return workingDirectoryService.getWorkingDirectory( project );
+    }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java
Thu Dec  1 14:33:05 2005
@@ -70,7 +70,7 @@
         return executeShellCommand( project, executable, arguments, buildOutput );
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project p )
+    public void updateProjectFromCheckOut( File workingDirectory, Project p, BuildDefinition
buildDefinition )
         throws ContinuumBuildExecutorException
     {
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
Thu Dec  1 14:33:05 2005
@@ -63,18 +63,42 @@
 //        String executable = project.getExecutable();
         String executable = "maven";
 
-        String arguments = StringUtils.clean( buildDefinition.getArguments() ) + " " +
+        String arguments = "";
+
+        String buildFile = StringUtils.clean( buildDefinition.getBuildFile() );
+
+        if ( !StringUtils.isEmpty( buildFile ) && !"project.xml".equals( buildFile
) )
+        {
+            arguments = "-p " + buildFile + " ";
+        }
+
+        arguments += StringUtils.clean( buildDefinition.getArguments() ) + " " +
             StringUtils.clean( buildDefinition.getGoals() );
 
         return executeShellCommand( project, executable, arguments, buildOutput );
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project project )
+    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition
buildDefinition )
         throws ContinuumBuildExecutorException
     {
-        File projectXmlFile = new File( workingDirectory, "project.xml" );
+        File projectXmlFile = null;
+
+        if ( buildDefinition != null )
+        {
+            String buildFile = StringUtils.clean( buildDefinition.getBuildFile() );
+
+            if ( !StringUtils.isEmpty( buildFile ) )
+            {
+                projectXmlFile = new File( workingDirectory, buildFile );
+            }
+        }
+
+        if ( projectXmlFile == null )
+        {
+            projectXmlFile = new File( workingDirectory, "project.xml" );
+        }
 
-        if ( !projectXmlFile.isFile() )
+        if ( !projectXmlFile.exists() )
         {
             throw new ContinuumBuildExecutorException( "Could not find Maven project descriptor."
);
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
Thu Dec  1 14:33:05 2005
@@ -71,16 +71,45 @@
 //        String executable = project.getExecutable();
         String executable = "mvn";
 
-        String arguments = StringUtils.clean( buildDefinition.getArguments() ) + " " +
+        String arguments = "";
+
+        String buildFile = StringUtils.clean( buildDefinition.getBuildFile() );
+
+        if ( !StringUtils.isEmpty( buildFile ) && !"pom.xml".equals( buildFile )
)
+        {
+            arguments = "-f " + buildFile + " ";
+        }
+
+        arguments += StringUtils.clean( buildDefinition.getArguments() ) + " " +
             StringUtils.clean( buildDefinition.getGoals() );
 
         return executeShellCommand( project, executable, arguments, buildOutput );
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project project )
+    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition
buildDefinition )
         throws ContinuumBuildExecutorException
     {
-        File f = new File( workingDirectory, "pom.xml" );
+        File f = null;
+
+        if ( buildDefinition != null )
+        {
+            String buildFile = StringUtils.clean( buildDefinition.getBuildFile() );
+
+            if ( !StringUtils.isEmpty( buildFile ) )
+            {
+                f = new File( workingDirectory, buildFile );
+            }
+        }
+
+        if ( f == null )
+        {
+            f = new File( workingDirectory, "pom.xml" );
+        }
+
+        if ( !f.exists() )
+        {
+            throw new ContinuumBuildExecutorException( "Could not find Maven project descriptor."
);
+        }
 
         try
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java
Thu Dec  1 14:33:05 2005
@@ -64,7 +64,7 @@
         return executeShellCommand( project, executable, buildDefinition.getArguments(),
buildOutput );
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project project )
+    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition
buildDefinition )
         throws ContinuumBuildExecutorException
     {
     }

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java?rev=351508&r1=351507&r2=351508&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java
Thu Dec  1 14:33:05 2005
@@ -91,7 +91,7 @@
         //
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project );
+        executor.updateProjectFromCheckOut( checkOut, project, null );
 
         // ----------------------------------------------------------------------
         //



Mime
View raw message