continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From epunza...@apache.org
Subject svn commit: r441352 - in /maven/continuum/branches/release-integration/continuum: continuum-api/src/main/java/org/apache/maven/continuum/release/ continuum-release/src/main/java/org/apache/maven/continuum/release/ continuum-release/src/main/java/org/ap...
Date Fri, 08 Sep 2006 02:36:25 GMT
Author: epunzalan
Date: Thu Sep  7 19:36:24 2006
New Revision: 441352

URL: http://svn.apache.org/viewvc?view=rev&rev=441352
Log:
PR: CONTINUUM-727

adding prepare release pages and action classes

Added:
    maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java
  (contents, props changed)
      - copied, changed from r440656, maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java
    maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PerformReleaseAction.java
  (with props)
    maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PrepareReleaseAction.java
  (with props)
    maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
  (with props)
    maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/prepareRelease.jsp
  (with props)
    maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/releaseProject.jsp
  (with props)
Removed:
    maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java
Modified:
    maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
    maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
    maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
    maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp

Modified: maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java?view=diff&rev=441352&r1=441351&r2=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
Thu Sep  7 19:36:24 2006
@@ -39,7 +39,7 @@
      * @param releaseProperties
      * @throws ContinuumReleaseException
      */
-    void prepare( Project project, Properties releaseProperties )
+    void prepare( Project project, Properties releaseProperties, Map releaseVersions, Map
developmentVersions )
         throws ContinuumReleaseException;
 
     /**

Modified: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java?view=diff&rev=441352&r1=441351&r2=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
Thu Sep  7 19:36:24 2006
@@ -54,12 +54,12 @@
      */
     private Map preparedReleases;
 
-    public void prepare( Project project, Properties releaseProperties )
+    public void prepare( Project project, Properties releaseProperties, Map relVersions,
Map devVersions )
         throws ContinuumReleaseException
     {
         String releaseId = project.getGroupId() + ":" + project.getArtifactId();
 
-        ReleaseDescriptor descriptor = getReleaseDescriptor( project, releaseProperties );
+        ReleaseDescriptor descriptor = getReleaseDescriptor( project, releaseProperties,
relVersions, devVersions );
 
         try
         {
@@ -132,7 +132,8 @@
         this.preparedReleases = preparedReleases;
     }
 
-    private ReleaseDescriptor getReleaseDescriptor( Project project, Properties releaseProperties
)
+    private ReleaseDescriptor getReleaseDescriptor( Project project, Properties releaseProperties,
+                                                    Map relVersions, Map devVersions )
     {
         ReleaseDescriptor descriptor = new ReleaseDescriptor();
 
@@ -145,6 +146,8 @@
         //required properties
         descriptor.setScmReleaseLabel( releaseProperties.getProperty( "tag" ) );
         descriptor.setScmTagBase( releaseProperties.getProperty( "tagBase" ) );
+        descriptor.setReleaseVersions( relVersions );
+        descriptor.setDevelopmentVersions( devVersions );
 
         //forced properties
         descriptor.setInteractive( false );

Modified: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java?view=diff&rev=441352&r1=441351&r2=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutor.java
Thu Sep  7 19:36:24 2006
@@ -39,7 +39,7 @@
 
             ReleaseDescriptor descriptor = prepareTask.getDescriptor();
 
-            releasePluginManager.prepare( descriptor, getSettings(), getReactorProjects(
descriptor ) );
+            releasePluginManager.prepare( descriptor, getSettings(), getReactorProjects(
descriptor ), false, false );
 
             continuumReleaseManager.getPreparedReleases().put( prepareTask.getReleaseId(),
descriptor );
         }

Copied: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java
(from r440656, maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java)
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java?view=diff&rev=441352&p1=maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java&r1=440656&p2=maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java&r2=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java
Thu Sep  7 19:36:24 2006
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.continuum.release.tasks.PrepareReleaseProjectTask;
+import org.apache.maven.continuum.release.tasks.PerformReleaseProjectTask;
 import org.apache.maven.plugins.release.config.ReleaseDescriptor;
 import org.apache.maven.scm.manager.NoSuchScmProviderException;
 import org.apache.maven.scm.manager.ScmManager;
@@ -24,6 +25,7 @@
 import org.apache.maven.scm.repository.ScmRepositoryException;
 import org.apache.maven.scm.ScmFileSet;
 import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 
@@ -32,48 +34,118 @@
 /**
  * @author Edwin Punzalan
  */
-public class PrepareReleaseTaskExecutorTest
+public class ReleaseTaskExecutorTest
     extends PlexusTestCase
 {
     private ScmManager scmManager;
 
-    private TaskExecutor taskExec;
+    private TaskExecutor prepareExec;
+
+    private TaskExecutor performExec;
 
     protected void setUp()
         throws Exception
     {
         super.setUp();
 
-        scmManager = (ScmManager) lookup( "org.apache.maven.scm.manager.ScmManager" );
+        if ( scmManager == null )
+        {
+            scmManager = (ScmManager) lookup( "org.apache.maven.scm.manager.ScmManager" );
+        }
+
+        if ( prepareExec == null )
+        {
+            prepareExec = (TaskExecutor) lookup( ReleaseTaskExecutor.ROLE, "prepare-release"
);
+        }
+
+        if ( performExec == null )
+        {
+            performExec = (TaskExecutor) lookup( ReleaseTaskExecutor.ROLE, "perform-release"
);
+        }
+    }
+
+    public void testReleaseSimpleProject()
+        throws Exception
+    {
+        String scmPath = new File( getBasedir(), "target/test-classes/scm-src" ).getAbsolutePath().replace(
'\\', '/' );
+        File workDir = new File( getBasedir(), "target/test-classes/work-dir" );
+        FileUtils.deleteDirectory( workDir );
+        File testDir = new File( getBasedir(), "target/test-classes/test-dir" );
+        FileUtils.deleteDirectory( testDir );
+
+        ReleaseDescriptor descriptor = new ReleaseDescriptor();
+        descriptor.setInteractive( false );
+        descriptor.setScmSourceUrl( "scm:svn:file://localhost/" + scmPath + "/trunk" );
+        descriptor.setWorkingDirectory( workDir.getAbsolutePath() );
+
+        ScmRepository repository = getScmRepositorty( descriptor.getScmSourceUrl() );
+        ScmFileSet fileSet = new ScmFileSet( workDir );
+        scmManager.getProviderByRepository( repository ).checkOut( repository, fileSet, null
);
 
-        taskExec = (TaskExecutor) lookup( ReleaseTaskExecutor.ROLE, "prepare-release" );
+        String pom = FileUtils.fileRead( new File( workDir, "pom.xml" ) );
+        assertTrue( "Test dev version", pom.indexOf( "<version>1.0-SNAPSHOT</version>"
) > 0 );
+
+        prepareExec.executeTask( getPrepareTask( "testRelease", descriptor ) );
+
+        pom = FileUtils.fileRead( new File( workDir, "pom.xml" ) );
+        assertTrue( "Test version increment", pom.indexOf( "<version>1.1-SNAPSHOT</version>"
) > 0 );
+
+        repository = getScmRepositorty( "scm:svn:file://localhost/" + scmPath + "/tags/test-artifact-1.0"
);
+        fileSet = new ScmFileSet( testDir );
+        scmManager.getProviderByRepository( repository ).checkOut( repository, fileSet, null
);
+
+        pom = FileUtils.fileRead( new File( testDir, "pom.xml" ) );
+        assertTrue( "Test released version", pom.indexOf( "<version>1.0</version>"
) > 0 );
     }
 
-    public void testRelease()
+    public void testReleaseSimpleProjectWithNextVersion()
         throws Exception
     {
-        File testProjectDir = new File( getBasedir(), "target/test-classes/scm-src/trunk"
);
+        String scmPath = new File( getBasedir(), "target/test-classes/scm-src" ).getAbsolutePath().replace(
'\\', '/' );
         File workDir = new File( getBasedir(), "target/test-classes/work-dir" );
-        workDir.mkdirs();
+        FileUtils.deleteDirectory( workDir );
+        File testDir = new File( getBasedir(), "target/test-classes/test-dir" );
+        FileUtils.deleteDirectory( testDir );
 
         ReleaseDescriptor descriptor = new ReleaseDescriptor();
         descriptor.setInteractive( false );
-        descriptor.setScmSourceUrl( "scm:svn:file://localhost/" +
-            testProjectDir.getAbsolutePath().replace( '\\', '/' ) );
+        descriptor.setScmSourceUrl( "scm:svn:file://localhost/" + scmPath + "/trunk" );
         descriptor.setWorkingDirectory( workDir.getAbsolutePath() );
+        descriptor.mapReleaseVersion( "test-group:test-artifact", "2.0" );
+        descriptor.mapDevelopmentVersion( "test-group:test-artifact", "2.1-SNAPSHOT" );
 
         ScmRepository repository = getScmRepositorty( descriptor.getScmSourceUrl() );
         ScmFileSet fileSet = new ScmFileSet( workDir );
         scmManager.getProviderByRepository( repository ).checkOut( repository, fileSet, null
);
 
-        taskExec.executeTask( getPrepareTask( "testRelease", descriptor ) );
+        String pom = FileUtils.fileRead( new File( workDir, "pom.xml" ) );
+        assertTrue( "Test dev version", pom.indexOf( "<version>1.1-SNAPSHOT</version>"
) > 0 );
+
+        prepareExec.executeTask( getPrepareTask( "testRelease", descriptor ) );
+
+        pom = FileUtils.fileRead( new File( workDir, "pom.xml" ) );
+        assertTrue( "Test version increment", pom.indexOf( "<version>2.1-SNAPSHOT</version>"
) > 0 );
+
+        repository = getScmRepositorty( "scm:svn:file://localhost/" + scmPath + "/tags/test-artifact-2.0"
);
+        fileSet = new ScmFileSet( testDir );
+        scmManager.getProviderByRepository( repository ).checkOut( repository, fileSet, null
);
+
+        pom = FileUtils.fileRead( new File( testDir, "pom.xml" ) );
+        assertTrue( "Test released version", pom.indexOf( "<version>2.0</version>"
) > 0 );
+
+        performExec.executeTask( getPerformTask( "testRelease", descriptor, new File( getBasedir(),
"target/test-classes/build-dir" ) ) );
     }
 
-    protected Task getPrepareTask( String releaseId, ReleaseDescriptor descriptor )
+    private Task getPrepareTask( String releaseId, ReleaseDescriptor descriptor )
     {
         Task task = new PrepareReleaseProjectTask( releaseId, descriptor );
 
+        return task;
+    }
 
+    private Task getPerformTask( String releaseId, ReleaseDescriptor descriptor, File buildDir
)
+    {
+        Task task = new PerformReleaseProjectTask( releaseId, descriptor, buildDir, "package",
true );
 
         return task;
     }

Propchange: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PerformReleaseAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PerformReleaseAction.java?view=auto&rev=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PerformReleaseAction.java
(added)
+++ maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PerformReleaseAction.java
Thu Sep  7 19:36:24 2006
@@ -0,0 +1,48 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * Copyright 2005 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.
+ */
+
+import org.apache.maven.continuum.release.ContinuumReleaseManager;
+
+import java.io.File;
+
+/**
+ * @author Edwin Punzalan
+ *
+ * @plexus.component
+ *   role="com.opensymphony.xwork.Action"
+ *   role-hint="performRelease"
+ */
+public class PerformReleaseAction
+    extends ContinuumActionSupport
+{
+    private String releaseId;
+
+    private String goals;
+
+    private boolean useReleaseProfile;
+
+    public String execute()
+        throws Exception
+    {
+        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+
+        releaseManager.perform( releaseId, File.createTempFile( "", "" ), goals, useReleaseProfile
);
+
+        return SUCCESS;
+    }
+}

Propchange: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PerformReleaseAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PrepareReleaseAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PrepareReleaseAction.java?view=auto&rev=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PrepareReleaseAction.java
(added)
+++ maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PrepareReleaseAction.java
Thu Sep  7 19:36:24 2006
@@ -0,0 +1,179 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.release.ContinuumReleaseManager;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * @author Edwin Punzalan
+ *
+ * @plexus.component
+ *   role="com.opensymphony.xwork.Action"
+ *   role-hint="prepareRelease"
+ */
+public class PrepareReleaseAction
+    extends ContinuumActionSupport
+{
+    private int projectId;
+
+    private String scmUsername;
+
+    private String scmPassword;
+
+    private String scmTag;
+
+    private String scmTagBase;
+
+    private List projectKeys;
+
+    private List devVersions;
+
+    private List relVersions;
+
+    public String execute()
+        throws Exception
+    {
+        Project project = getContinuum().getProject( projectId );
+
+        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+
+        releaseManager.prepare( project, getReleaseProperties(), getRelVersionMap(), getDevVersionMap()
);
+
+        return SUCCESS;
+    }
+
+    private Map getDevVersionMap()
+    {
+        return getVersionMap( projectKeys, devVersions );
+    }
+
+    private Map getRelVersionMap()
+    {
+        return getVersionMap( projectKeys, relVersions );
+    }
+
+    private Map getVersionMap( List keys, List versions )
+    {
+        Map versionMap = new HashMap();
+
+        for ( int idx = 0; idx < keys.size(); idx++ )
+        {
+            String key = keys.get( idx ).toString();
+            String version = versions.get( idx ).toString();
+
+            versionMap.put( key, version );
+        }
+
+        return versionMap;
+    }
+
+    private Properties getReleaseProperties()
+    {
+        Properties p = new Properties();
+
+        p.setProperty( "tag", scmTag );
+        p.setProperty( "tagBase", scmTagBase );
+
+        return p;
+    }
+
+    public List getProjectKeys()
+    {
+        return projectKeys;
+    }
+
+    public void setProjectKeys( List projectKeys )
+    {
+        this.projectKeys = projectKeys;
+    }
+
+    public List getDevVersions()
+    {
+        return devVersions;
+    }
+
+    public void setDevVersions( List devVersions )
+    {
+        this.devVersions = devVersions;
+    }
+
+    public List getRelVersions()
+    {
+        return relVersions;
+    }
+
+    public void setRelVersions( List relVersions )
+    {
+        this.relVersions = relVersions;
+    }
+
+    public int getProjectId()
+    {
+        return projectId;
+    }
+
+    public void setProjectId( int projectId )
+    {
+        this.projectId = projectId;
+    }
+
+    public String getScmUsername()
+    {
+        return scmUsername;
+    }
+
+    public void setScmUsername( String scmUsername )
+    {
+        this.scmUsername = scmUsername;
+    }
+
+    public String getScmPassword()
+    {
+        return scmPassword;
+    }
+
+    public void setScmPassword( String scmPassword )
+    {
+        this.scmPassword = scmPassword;
+    }
+
+    public String getScmTag()
+    {
+        return scmTag;
+    }
+
+    public void setScmTag( String scmTag )
+    {
+        this.scmTag = scmTag;
+    }
+
+    public String getScmTagBase()
+    {
+        return scmTagBase;
+    }
+
+    public void setScmTagBase( String scmTagBase )
+    {
+        this.scmTagBase = scmTagBase;
+    }
+}

Propchange: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/PrepareReleaseAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java?view=auto&rev=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
(added)
+++ maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
Thu Sep  7 19:36:24 2006
@@ -0,0 +1,255 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.release.ContinuumReleaseManager;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.plugins.release.config.ReleaseDescriptor;
+import org.apache.maven.plugins.release.versions.DefaultVersionInfo;
+import org.apache.maven.plugins.release.versions.VersionInfo;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Edwin Punzalan
+ *
+ * @plexus.component
+ *   role="com.opensymphony.xwork.Action"
+ *   role-hint="releaseProject"
+ */
+public class ReleaseProjectAction
+    extends ContinuumActionSupport
+{
+    private int projectId;
+
+    private String preparedReleaseName;
+
+    private String goal;
+
+    private Project project;
+
+    private String scmUsername;
+
+    private String scmPassword;
+
+    private String scmTag;
+
+    private String scmTagBase;
+
+    private List projects = new ArrayList();
+
+    public String promptReleaseGoal()
+        throws Exception
+    {
+        project = getContinuum().getProjectWithAllDetails( projectId );
+
+        String releaseId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId()
);
+
+        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+
+        Map preparedReleases = releaseManager.getPreparedReleases();
+        if ( preparedReleases.containsKey( releaseId ) )
+        {
+            ReleaseDescriptor descriptor = (ReleaseDescriptor) preparedReleases.get( releaseId
);
+
+            preparedReleaseName = descriptor.getName();
+        }
+
+        return "prompt";
+    }
+
+    public String execute()
+        throws Exception
+    {
+        if ( "prepare".equals( goal ) )
+        {
+            return doPrepare();
+        }
+        else if ( "perform".equals( goal ) )
+        {
+            return doPerform();
+        }
+        else
+        {
+            return "prompt";
+        }
+    }
+
+    public String doPrepare()
+        throws Exception
+    {
+        project = getContinuum().getProject( projectId );
+        scmUsername = project.getScmUsername();
+        scmPassword = project.getScmPassword();
+        scmTag = project.getScmTag();
+        scmTagBase = "";
+
+        processProject( project.getWorkingDirectory(), "pom.xml" );
+
+        return "prepareRelease";
+    }
+
+    public String doPerform()
+        throws Exception
+    {
+        return "performRelease";
+    }
+
+    private void processProject( String workingDirectory, String pomFilename )
+        throws Exception
+    {
+        MavenXpp3Reader pomReader = new MavenXpp3Reader();
+        Model model = pomReader.read( new FileReader( new File( workingDirectory, pomFilename
) ) );
+
+        if ( model.getGroupId() == null )
+        {
+            model.setGroupId( model.getParent().getGroupId() );
+        }
+
+        if ( model.getVersion() == null )
+        {
+            model.setVersion( model.getParent().getVersion() );
+        }
+
+        setProperties( model );
+
+        for( Iterator modules = model.getModules().iterator(); modules.hasNext(); )
+        {
+            processProject( workingDirectory + "/" + modules.next().toString(), "pom.xml"
);
+        }
+    }
+
+    private void setProperties( Model model )
+        throws Exception
+    {
+        Map params = new HashMap();
+
+        params.put( "key", model.getGroupId() + ":" + model.getArtifactId() );
+
+        if ( model.getName() == null )
+        {
+            model.setName( model.getArtifactId() );
+        }
+        params.put( "name", model.getName() );
+
+        VersionInfo version = new DefaultVersionInfo( project.getVersion() );
+
+        params.put( "release", version.getReleaseVersionString() );
+        params.put( "dev", version.getNextVersion().getSnapshotVersionString() );
+
+        projects.add( params );
+    }
+
+    public int getProjectId()
+    {
+        return projectId;
+    }
+
+    public void setProjectId( int projectId )
+    {
+        this.projectId = projectId;
+    }
+
+    public String getPreparedReleaseName()
+    {
+        return preparedReleaseName;
+    }
+
+    public void setPreparedReleaseName( String preparedReleaseName )
+    {
+        this.preparedReleaseName = preparedReleaseName;
+    }
+
+    public String getGoal()
+    {
+        return goal;
+    }
+
+    public void setGoal( String goal )
+    {
+        this.goal = goal;
+    }
+
+    public Project getProject()
+    {
+        return project;
+    }
+
+    public void setProject( Project project )
+    {
+        this.project = project;
+    }
+
+    public List getProjects()
+    {
+        return projects;
+    }
+
+    public void setProjects( List projects )
+    {
+        this.projects = projects;
+    }
+
+    public String getScmUsername()
+    {
+        return scmUsername;
+    }
+
+    public void setScmUsername( String scmUsername )
+    {
+        this.scmUsername = scmUsername;
+    }
+
+    public String getScmPassword()
+    {
+        return scmPassword;
+    }
+
+    public void setScmPassword( String scmPassword )
+    {
+        this.scmPassword = scmPassword;
+    }
+
+    public String getScmTag()
+    {
+        return scmTag;
+    }
+
+    public void setScmTag( String scmTag )
+    {
+        this.scmTag = scmTag;
+    }
+
+    public String getScmTagBase()
+    {
+        return scmTagBase;
+    }
+
+    public void setScmTagBase( String scmTagBase )
+    {
+        this.scmTagBase = scmTagBase;
+    }
+}

Propchange: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/resources/xwork.xml?view=diff&rev=441352&r1=441351&r2=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/resources/xwork.xml
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/resources/xwork.xml
Thu Sep  7 19:36:24 2006
@@ -297,12 +297,18 @@
     <!--
     - continuum release
     -->
+    <action name="releaseProject" class="releaseProject">
+      <result name="prompt">releaseProject.jsp</result>
+      <result name="prepareRelease">prepareRelease.jsp</result>
+      <result name="performRelease">performRelease.jsp</result>
+    </action>
+
     <action name="prepareRelease" class="prepareRelease">
-      <result name="success">prepareRelease.jsp</result>
+      <result name="success">prepareReleaseProgress.jsp</result>
     </action>
 
     <action name="performRelease" class="performRelease">
-      <result name="success">performRelease.jsp</result>
+      <result name="success">performReleaseProgress.jsp</result>
     </action>
 
   </package>

Modified: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp?view=diff&rev=441352&r1=441351&r2=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp
Thu Sep  7 19:36:24 2006
@@ -55,6 +55,23 @@
           </c:otherwise>
         </c:choose>
       </ec:column>
+      <ec:column property="releaseAction" title="&nbsp;" width="1%" sortable="false">
+        <c:choose>
+          <c:when test="${pageScope.project.state == 2}">
+            <ww:url id="releaseProjectUrl" action="releaseProject!promptReleaseGoal.action"
namespace="/">
+              <ww:param name="projectId" value="${project.id}"/>
+            </ww:url>
+            <ww:a href="%{releaseProjectUrl}">
+              <img src="<ww:url value='/images/releaseproject.gif'/>" alt="Release
Project" title="Release Project"
+                border="0"/>
+            </ww:a>
+          </c:when>
+          <c:otherwise>
+            <img src="<ww:url value='/images/releaseproject_failed.gif'/>" alt="Releasse
Project"
+              title="Release Project" border="0"/>
+          </c:otherwise>
+        </c:choose>
+      </ec:column>
       <ec:column property="deleteAction" title="&nbsp;" width="1%" sortable="false">
         <c:choose>
           <c:when

Added: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/prepareRelease.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/prepareRelease.jsp?view=auto&rev=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/prepareRelease.jsp
(added)
+++ maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/prepareRelease.jsp
Thu Sep  7 19:36:24 2006
@@ -0,0 +1,71 @@
+<%@ taglib uri="/webwork" prefix="ww" %>
+<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib uri="continuum" prefix="c1" %>
+<html>
+  <ww:i18n name="localization.Continuum">
+    <head>
+        <title><ww:text name="releaseProject.page.title"/></title>
+    </head>
+    <body>
+      <h2>Prepare Project Release</h2>
+      <ww:form action="prepareRelease" method="post">
+        <h3>Common Release Parameters</h3>
+        <input type="hidden" name="projectId" value="<ww:property value="projectId"/>"/>
+        <div class="axial">
+          <table border="1" cellspacing="2" cellpadding="3" width="100%">
+            <tr>
+              <th>SCM Username</th>
+              <td>
+                <input type="text" name="scmUsername" value="<ww:property value="scmUsername"/>"
size="100">
+              </td>
+            </tr>
+            <tr>
+              <th>SCM Password</th>
+              <td>
+                <input type="text" name="scmPassword" value="<ww:property value="scmPassword"/>"
size="100">
+              </td>
+            </tr>
+            <tr>
+              <th>SCM Tag</th>
+              <td>
+                <input type="text" name="scmTag" value="<ww:property value="scmTag"/>"
size="100">
+              </td>
+            </tr>
+            <tr>
+              <th>SCM Tag Base</th>
+              <td>
+                <input type="text" name="scmTagBase" value="<ww:property value="scmTagBase"/>"
size="100">
+              </td>
+            </tr>
+           </table>
+        </div>
+
+        <ww:iterator value="projects">
+          <h3><ww:property value="name"/></h3>
+          <input type="hidden" name="projectKeys" value="<ww:property value="key"/>">
+          <div class="axial">
+          <table border="1" cellspacing="2" cellpadding="3" width="100%">
+            <tr>
+              <th>Release Version*</th>
+              <td>
+                <input type=text name="relVersions"
+                       value="<ww:property value="release"/>" size="100">
+              </td>
+            </tr>
+            <tr>
+              <th>Next Development Version*</th>
+              <td>
+                <input type=text name="devVersions"
+                       value="<ww:property value="dev"/>" size="100">
+              </td>
+            </tr>
+           </table>
+           </div>
+        </ww:iterator>
+
+        <ww:submit/>
+      </ww:form>
+    </body>
+  </ww:i18n>
+</html>

Propchange: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/prepareRelease.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/releaseProject.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/releaseProject.jsp?view=auto&rev=441352
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/releaseProject.jsp
(added)
+++ maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/releaseProject.jsp
Thu Sep  7 19:36:24 2006
@@ -0,0 +1,34 @@
+<%@ taglib uri="/webwork" prefix="ww" %>
+<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib uri="continuum" prefix="c1" %>
+<html>
+  <ww:i18n name="localization.Continuum">
+    <head>
+        <title><ww:text name="releaseProject.page.title"/></title>
+    </head>
+    <body>
+      <h3>Continuum Release</h3>
+      <ww:form action="releaseProject" method="post">
+        <p>
+          <input name="goal" type="radio" value="prepare" checked/>Prepare project
for release
+          <br/>
+          <input name="goal" type="radio" value="perform"/>Perform project release
+          <br/>
+          &nbsp;&nbsp;&nbsp;
+          <select name="performScript">
+            <ww:if test="preparedReleaseName != null">
+              <option selected value="<ww:property value="preparedReleaseName"/>">
+                <ww:property value="preparedReleaseName"/>
+              </option>
+            </ww:if>
+            <option value="">Provide release descriptor</option>
+          </select>
+          <br/>
+        </p>
+        <input name="projectId" type="hidden" value="<ww:property value="projectId"/>"/>
+        <ww:submit value="Submit"/>
+      </ww:form>
+    </body>
+  </ww:i18n>
+</html>

Propchange: maven/continuum/branches/release-integration/continuum/continuum-webapp/src/main/webapp/releaseProject.jsp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message