Author: brett
Date: Sun Jun 19 20:17:43 2005
New Revision: 191380

URL: http://svn.apache.org/viewcvs?rev=191380&view=rev
Log:
PR: MNG-471
add lifecycle mapping model

Added:
    maven/components/trunk/maven-plugin-descriptor/src/main/mdo/
    maven/components/trunk/maven-plugin-descriptor/src/main/mdo/lifecycle.mdo
    maven/components/trunk/maven-plugin-descriptor/src/test/
    maven/components/trunk/maven-plugin-descriptor/src/test/java/
    maven/components/trunk/maven-plugin-descriptor/src/test/java/org/
    maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/
    
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/
    
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/
    
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/
    
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
   (with props)
    maven/components/trunk/maven-plugin-descriptor/src/test/resources/
    
maven/components/trunk/maven-plugin-descriptor/src/test/resources/lifecycle.xml 
  (with props)
Modified:
    maven/components/trunk/maven-plugin-descriptor/pom.xml

Modified: maven/components/trunk/maven-plugin-descriptor/pom.xml
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/pom.xml?rev=191380&r1=191379&r2=191380&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/pom.xml (original)
+++ maven/components/trunk/maven-plugin-descriptor/pom.xml Sun Jun 19 20:17:43 
2005
@@ -19,4 +19,26 @@
       <version>1.0-alpha-4-SNAPSHOT</version>
     </dependency>
   </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <version>1.0-alpha-3-SNAPSHOT</version>
+        <configuration>
+          <model>src/main/mdo/lifecycle.mdo</model>
+          <version>1.0.0</version>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>java</goal>
+              <goal>xpp3-reader</goal>
+              <goal>xpp3-writer</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Added: maven/components/trunk/maven-plugin-descriptor/src/main/mdo/lifecycle.mdo
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/mdo/lifecycle.mdo?rev=191380&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/mdo/lifecycle.mdo 
(added)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/mdo/lifecycle.mdo 
Sun Jun 19 20:17:43 2005
@@ -0,0 +1,100 @@
+<model>
+  <id>lifecycle-mappings</id>
+  <name>LifecycleMappings</name>
+  <description><![CDATA[
+    Configuration of custom lifecycle mappings for the plugin.
+  ]]></description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.plugin.lifecycle</value>
+    </default>
+  </defaults>
+  <classes>
+    <class rootElement="true" xml.tagName="lifecycles">
+      <name>LifecycleConfiguration</name>
+      <version>1.0.0</version>
+      <description>Root element of the lifecycle.xml file.</description>
+      <fields>
+        <field xml.listStyle="flat">
+          <name>lifecycles</name>
+          <version>1.0.0</version>
+          <association>
+            <type>Lifecycle</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>Lifecycle</name>
+      <version>1.0.0</version>
+      <description><![CDATA[
+        A custom lifecycle mapping definition.
+      ]]></description>
+      <fields>
+        <field>
+          <name>id</name>
+          <required>true</required>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The ID of this lifecycle, for identification in the 
mojo descriptor.</description>
+        </field>
+        <field>
+          <name>phases</name>
+          <version>1.0.0</version>
+          <description>The phase mappings for this lifecycle.</description>
+          <association>
+            <type>Phase</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>Phase</name>
+      <version>1.0.0</version>
+      <description>A phase mapping definition.</description>
+      <fields>
+        <field>
+          <name>id</name>
+          <required>true</required>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description>The ID of this phase, eg 
&lt;code&gt;generate-sources&lt;/code&gt;.</description>
+        </field>
+        <field>
+          <name>executions</name>
+          <version>1.0.0</version>
+          <description>The goals to execute within the phase.</description>
+          <association>
+            <type>Execution</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>Execution</name>
+      <version>1.0.0</version>
+      <description>A set of goals to execute.</description>
+      <fields>
+        <field>
+          <name>configuration</name>
+          <version>1.0.0</version>
+          <type>DOM</type>
+          <description>Configuration to pass to the goals.</description>
+        </field>
+        <field>
+          <name>goals</name>
+          <version>1.0.0</version>
+          <description>The goals to execute.</description>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>

Added: 
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java?rev=191380&view=auto
==============================================================================
--- 
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
 (added)
+++ 
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
 Sun Jun 19 20:17:43 2005
@@ -0,0 +1,54 @@
+package org.apache.maven.plugin.lifecycle;
+
+/*
+ * Copyright 2001-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 junit.framework.TestCase;
+import org.apache.maven.plugin.lifecycle.io.xpp3.LifecycleMappingsXpp3Reader;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+/**
+ * Test the lifecycle reader.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Brett Porter</a>
+ * @version $Id$
+ */
+public class LifecycleXpp3ReaderTest
+    extends TestCase
+{
+    public void testLifecycleReader()
+        throws IOException, XmlPullParserException
+    {
+        LifecycleMappingsXpp3Reader reader = new LifecycleMappingsXpp3Reader();
+        LifecycleConfiguration config = reader.read( new InputStreamReader( 
getClass().getResourceAsStream( "/lifecycle.xml" ) ) );
+        assertEquals( "check number of lifecycles", 1, 
config.getLifecycles().size() );
+        Lifecycle l = (Lifecycle) config.getLifecycles().iterator().next();
+        assertEquals( "check id", "clover", l.getId() );
+        assertEquals( "check number of phases", 1, l.getPhases().size() );
+        Phase p = (Phase) l.getPhases().iterator().next();
+        assertEquals( "check id", "generate-sources", p.getId() );
+        assertEquals( "check number of executions", 1, 
p.getExecutions().size() );
+        Execution e = (Execution) p.getExecutions().iterator().next();
+        assertEquals( "check configuration", "true", ((Xpp3Dom) 
e.getConfiguration()).getChild( "debug" ).getValue() );
+        assertEquals( "check number of goals", 1, e.getGoals().size() );
+        String g = (String) e.getGoals().iterator().next();
+        assertEquals( "check goal", "clover:compiler", g );
+    }
+}

Propchange: 
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/trunk/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/components/trunk/maven-plugin-descriptor/src/test/resources/lifecycle.xml
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/test/resources/lifecycle.xml?rev=191380&view=auto
==============================================================================
--- 
maven/components/trunk/maven-plugin-descriptor/src/test/resources/lifecycle.xml 
(added)
+++ 
maven/components/trunk/maven-plugin-descriptor/src/test/resources/lifecycle.xml 
Sun Jun 19 20:17:43 2005
@@ -0,0 +1,20 @@
+<lifecycles>
+  <lifecycle>
+    <id>clover</id>
+    <phases>
+      <phase>
+        <id>generate-sources</id>
+        <executions>
+          <execution>
+            <configuration>
+              <debug>true</debug>
+            </configuration>
+              <goals>
+                <goal>clover:compiler</goal>
+              </goals>
+          </execution>
+        </executions>
+      </phase>
+    </phases>
+  </lifecycle>
+</lifecycles>

Propchange: 
maven/components/trunk/maven-plugin-descriptor/src/test/resources/lifecycle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/trunk/maven-plugin-descriptor/src/test/resources/lifecycle.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to