From continuum-commits-return-2018-apmail-maven-continuum-commits-archive=maven.apache.org@maven.apache.org Mon Sep 04 09:32:20 2006 Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 74462 invoked from network); 4 Sep 2006 09:32:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Sep 2006 09:32:19 -0000 Received: (qmail 65540 invoked by uid 500); 4 Sep 2006 09:32:19 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 65508 invoked by uid 500); 4 Sep 2006 09:32:19 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 65495 invoked by uid 99); 4 Sep 2006 09:32:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Sep 2006 02:32:19 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Sep 2006 02:32:18 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 2E6AB1A981A; Mon, 4 Sep 2006 02:31:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r439994 - in /maven/continuum/branches/release-integration/continuum/continuum-release/src: main/java/org/apache/maven/continuum/release/executors/ test/java/org/apache/maven/continuum/release/ test/java/org/apache/maven/continuum/release/e... Date: Mon, 04 Sep 2006 09:31:57 -0000 To: continuum-commits@maven.apache.org From: epunzalan@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20060904093158.2E6AB1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: epunzalan Date: Mon Sep 4 02:31:56 2006 New Revision: 439994 URL: http://svn.apache.org/viewvc?view=rev&rev=439994 Log: PR: CONTINUUM-727 adding missing classes Added: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java (with props) maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutor.java (with props) maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/ maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java (with props) maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.xml (with props) Added: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java?view=auto&rev=439994 ============================================================================== --- maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java (added) +++ maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java Mon Sep 4 02:31:56 2006 @@ -0,0 +1,198 @@ +package org.apache.maven.continuum.release.executors; + +/* + * 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.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.DefaultArtifactRepository; +import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; +import org.apache.maven.continuum.release.ContinuumReleaseException; +import org.apache.maven.continuum.release.ContinuumReleaseManager; +import org.apache.maven.plugins.release.ReleaseManager; +import org.apache.maven.plugins.release.config.ReleaseDescriptor; +import org.apache.maven.profiles.DefaultProfileManager; +import org.apache.maven.profiles.ProfileManager; +import org.apache.maven.project.DuplicateProjectException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectBuilder; +import org.apache.maven.project.ProjectBuildingException; +import org.apache.maven.project.ProjectSorter; +import org.apache.maven.settings.MavenSettingsBuilder; +import org.apache.maven.settings.Settings; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.taskqueue.execution.TaskExecutor; +import org.codehaus.plexus.context.Context; +import org.codehaus.plexus.context.ContextException; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; +import org.codehaus.plexus.util.dag.CycleDetectedException; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * @author Edwin Punzalan + */ +public abstract class AbstractReleaseTaskExecutor + implements ReleaseTaskExecutor, TaskExecutor, Contextualizable +{ + /** + * @plexus.requirement + */ + protected ContinuumReleaseManager continuumReleaseManager; + + /** + * @plexus.requirement + */ + protected ReleaseManager releasePluginManager; + + /** + * @plexus.requirement + */ + private MavenProjectBuilder projectBuilder; + + /** + * @plexus.requirement + */ + private MavenSettingsBuilder settingsBuilder; + + /** + * @plexus.configuration + */ + private String localRepository; + + private ProfileManager profileManager; + + private PlexusContainer container; + + private Settings settings; + + protected List getReactorProjects( ReleaseDescriptor descriptor ) + throws ContinuumReleaseException + { + Settings settings = getSettings(); + + List reactorProjects = new ArrayList(); + + MavenProject project; + try + { + project = projectBuilder.build( getProjectDescriptorFile( descriptor ), + getLocalRepository(), getProfileManager( settings ) ); + + reactorProjects.add( project ); + } + catch ( ProjectBuildingException e ) + { + throw new ContinuumReleaseException( "Failed to build project.", e ); + } + + for( Iterator modules = project.getModules().iterator(); modules.hasNext(); ) + { + String moduleDir = modules.next().toString(); + + File pomFile = new File( project.getBasedir(), moduleDir + "/pom.xml" ); + + try + { + MavenProject reactorProject = projectBuilder.build( pomFile, getLocalRepository(), + getProfileManager( settings ) ); + + reactorProjects.add( reactorProject ); + } + catch ( ProjectBuildingException e ) + { + throw new ContinuumReleaseException( "Failed to build project.", e ); + } + } + + try + { + reactorProjects = new ProjectSorter( reactorProjects ).getSortedProjects(); + } + catch ( CycleDetectedException e ) + { + throw new ContinuumReleaseException( "Failed to sort projects.", e ); + } + catch ( DuplicateProjectException e ) + { + throw new ContinuumReleaseException( "Failed to sort projects.", e ); + } + + return reactorProjects; + } + + protected Settings getSettings() + throws ContinuumReleaseException + { + if ( settings == null ) + { + try + { + settings = settingsBuilder.buildSettings(); + } + catch ( IOException e ) + { + throw new ContinuumReleaseException( "Failed to get Maven Settings.", e ); + } + catch ( XmlPullParserException e ) + { + throw new ContinuumReleaseException( "Failed to get Maven Settings.", e ); + } + } + + return settings; + } + + private File getProjectDescriptorFile( ReleaseDescriptor descriptor ) + { + String parentPath = descriptor.getWorkingDirectory(); + + String pomFilename = descriptor.getPomFileName(); + if ( pomFilename == null ) + { + pomFilename = "pom.xml"; + } + + return new File( parentPath, pomFilename ); + } + + private ArtifactRepository getLocalRepository() + { + return new DefaultArtifactRepository( "local-repository", "file://" + localRepository, + new DefaultRepositoryLayout() ); + } + + private ProfileManager getProfileManager( Settings settings ) + { + if ( profileManager == null ) + { + profileManager = new DefaultProfileManager( container, settings ); + } + + return profileManager; + } + + public void contextualize( Context context ) + throws ContextException + { + container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY ); + } +} Propchange: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/AbstractReleaseTaskExecutor.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutor.java URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutor.java?view=auto&rev=439994 ============================================================================== --- maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutor.java (added) +++ maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutor.java Mon Sep 4 02:31:56 2006 @@ -0,0 +1,25 @@ +package org.apache.maven.continuum.release.executors; + +/* + * 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 Edwin Punzalan + */ +public interface ReleaseTaskExecutor +{ + String ROLE = ReleaseTaskExecutor.class.getName(); +} Propchange: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutor.java ------------------------------------------------------------------------------ svn:eol-style = native Added: 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/PrepareReleaseTaskExecutorTest.java?view=auto&rev=439994 ============================================================================== --- maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java (added) +++ maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java Mon Sep 4 02:31:56 2006 @@ -0,0 +1,55 @@ +package org.apache.maven.continuum.release.executors; + +/* + * 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.release.tasks.PrepareReleaseProjectTask; +import org.apache.maven.plugins.release.config.ReleaseDescriptor; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.taskqueue.Task; +import org.codehaus.plexus.taskqueue.execution.TaskExecutor; + +/** + * @author Edwin Punzalan + */ +public class PrepareReleaseTaskExecutorTest + extends PlexusTestCase +{ + private TaskExecutor taskExec; + + protected void setUp() + throws Exception + { + super.setUp(); + + taskExec = (TaskExecutor) lookup( ReleaseTaskExecutor.ROLE, "prepare-release" ); + } + + public void testRelease() + throws Exception + { + ReleaseDescriptor descriptor = new ReleaseDescriptor(); + + taskExec.executeTask( getPrepareTask( "testRelease", descriptor ) ); + } + + protected Task getPrepareTask( String releaseId, ReleaseDescriptor descriptor ) + { + Task task = new PrepareReleaseProjectTask( releaseId, descriptor ); + + return task; + } +} Propchange: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.xml URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.xml?view=auto&rev=439994 ============================================================================== --- maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.xml (added) +++ maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.xml Mon Sep 4 02:31:56 2006 @@ -0,0 +1,24 @@ + + + org.apache.maven.continuum.release.executors.ReleaseTaskExecutor + prepare-release + org.apache.maven.continuum.release.executors.PrepareReleaseTaskExecutor + + + org.apache.maven.continuum.release.ContinuumReleaseManager + + + org.apache.maven.plugins.release.ReleaseManager + + + org.apache.maven.project.MavenProjectBuilder + + + org.apache.maven.settings.MavenSettingsBuilder + + + + ${plexus.home}/local-repository + + + \ No newline at end of file Propchange: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.xml ------------------------------------------------------------------------------ svn:eol-style = native