continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcconn...@apache.org
Subject svn commit: r469331 - in /maven/continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/main/resources/META-INF/plexus/ continuum-...
Date Tue, 31 Oct 2006 01:10:16 GMT
Author: jmcconnell
Date: Mon Oct 30 17:10:15 2006
New Revision: 469331

URL: http://svn.apache.org/viewvc?view=rev&rev=469331
Log:
continuum-553 build definitions now have the build fresh option, when this is toggled then
when the build triggers it removed the contents of the working directory and checks out from
source control every build, this is off by default

Added:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
  (with props)
Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
    maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?view=diff&rev=469331&r1=469330&r2=469331
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Mon Oct 30 17:10:15 2006
@@ -90,6 +90,13 @@
 
         try
         {
+            // check if build definition requires smoking the existing checkout and rechecking
out project
+            if ( context.getBuildDefinition().isBuildFresh())
+            {
+                getLogger().info( "Purging exiting working copy" );
+                cleanWorkingDirectory( context );
+            }
+
             // ----------------------------------------------------------------------
             // TODO: Centralize the error handling from the SCM related actions.
             // ContinuumScmResult should return a ContinuumScmResult from all
@@ -317,6 +324,12 @@
         actionContext.put( AbstractContinuumAction.KEY_FIRST_RUN, Boolean.valueOf( context.getOldBuildResult()
== null ) );
 
         return context;
+    }
+
+    private void cleanWorkingDirectory( BuildContext buildContext )
+        throws TaskExecutionException
+    {
+        performAction( "clean-working-directory", buildContext );
     }
 
     private void updateWorkingDirectory( BuildContext buildContext )

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java?view=diff&rev=469331&r1=469330&r2=469331
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
Mon Oct 30 17:10:15 2006
@@ -27,9 +27,6 @@
  * @author Jesse McConnell <jmcconnell@apache.org>
  * @version $Id$
  *
- * @plexus.component
- *   role="org.codehaus.plexus.action.Action"
- *   role-hint="add-build-definition-to-project"
  */
 public class AddBuildDefinitionToProjectAction
     extends AbstractBuildDefinitionContinuumAction

Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java?view=auto&rev=469331
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
Mon Oct 30 17:10:15 2006
@@ -0,0 +1,59 @@
+package org.apache.maven.continuum.core.action;
+
+import org.apache.maven.continuum.utils.WorkingDirectoryService;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.model.project.Project;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.util.Map;
+import java.io.File;
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * @author Jesse McConnell <jmcconnell@apache.org>
+ * @version $Id:$
+ *
+ * @plexus.component
+ *   role="org.codehaus.plexus.action.Action"
+ *   role-hint="clean-working-directory"
+ */
+public class CleanWorkingDirectoryAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement 
+     */
+    private WorkingDirectoryService workingDirectoryService;
+
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
+    public void execute( Map context )
+        throws Exception
+    {
+        Project project = store.getProject( getProjectId( context ) );
+
+        File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
+
+        if ( workingDirectory.exists() )
+        {
+            FileUtils.cleanDirectory( workingDirectory );
+        }
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=469331&r1=469330&r2=469331
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
Mon Oct 30 17:10:15 2006
@@ -642,6 +642,19 @@
     </component>
     <component>
       <role>org.codehaus.plexus.action.Action</role>
+      <role-hint>clean-working-directory</role-hint>
+      <implementation>org.apache.maven.continuum.core.action.CleanWorkingDirectoryAction</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.continuum.utils.WorkingDirectoryService</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.codehaus.plexus.action.Action</role>
       <role-hint>create-projects-from-metadata</role-hint>
       <implementation>org.apache.maven.continuum.core.action.CreateProjectsFromMetadata</implementation>
       <requirements>

Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml?view=diff&rev=469331&r1=469330&r2=469331
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml Mon Oct 30 17:10:15 2006
@@ -746,6 +746,15 @@
           <type>String</type>
         </field>
         <field>
+          <name>buildFresh</name>
+          <version>1.0.0.+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+          <description>
+            true if the build is to be smoked and checked back out from the scm each build
+          </description>
+        </field>
+        <field>
           <name>schedule</name>
           <version>1.0.0+</version>
           <association stash.part="true" jpox.dependent="false">

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java?view=diff&rev=469331&r1=469330&r2=469331
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
Mon Oct 30 17:10:15 2006
@@ -59,6 +59,8 @@
 
     private String buildFile;
 
+    private boolean buildFresh;
+
     private Map schedules;
 
     private Map profiles;
@@ -118,6 +120,7 @@
             goals = buildDefinition.getGoals();
             arguments = buildDefinition.getArguments();
             buildFile = buildDefinition.getBuildFile();
+            buildFresh = buildDefinition.isBuildFresh();
             scheduleId = buildDefinition.getSchedule().getId();
             defaultBuildDefinition = buildDefinition.isDefaultForProject();
         }
@@ -227,6 +230,7 @@
         buildDefinition.setGoals( goals );
         buildDefinition.setArguments( arguments );
         buildDefinition.setBuildFile( buildFile );
+        buildDefinition.setBuildFresh( buildFresh );
         buildDefinition.setDefaultForProject( defaultBuildDefinition );
         buildDefinition.setSchedule( schedule );
 
@@ -331,6 +335,16 @@
     public void setBuildFile( String buildFile )
     {
         this.buildFile = buildFile;
+    }
+
+    public boolean isBuildFresh()
+    {
+        return buildFresh;
+    }
+
+    public void setBuildFresh( boolean buildFresh )
+    {
+        this.buildFresh = buildFresh;
     }
 
     public Map getSchedules()

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp?view=diff&rev=469331&r1=469330&r2=469331
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp
Mon Oct 30 17:10:15 2006
@@ -51,6 +51,7 @@
                 </ww:else>
 
                 <ww:textfield label="%{getText('buildDefinition.arguments.label')}" name="arguments"/>
+                <ww:checkbox label="Build Fresh" name="buildFresh" value="buildFresh"
fieldValue="true"/>
                 <ww:checkbox label="%{getText('buildDefinition.defaultForProject.label')}"
 name="defaultBuildDefinition" value="defaultBuildDefinition" fieldValue="true"/>
                 <ww:select label="%{getText('buildDefinition.schedule.label')}" name="scheduleId"
list="schedules"/>
               </tbody>



Mime
View raw message