You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2003/06/08 15:51:22 UTC

cvs commit: avalon-excalibur maven-common-gump-build.xml maven-common.xml maven.xml

leosimons    2003/06/08 06:51:22

  Modified:    .        maven-common-gump-build.xml maven-common.xml
                        maven.xml
  Log:
  improved gump integration
  
  Revision  Changes    Path
  1.2       +68 -2     avalon-excalibur/maven-common-gump-build.xml
  
  Index: maven-common-gump-build.xml
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/maven-common-gump-build.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- maven-common-gump-build.xml	8 Jun 2003 12:01:11 -0000	1.1
  +++ maven-common-gump-build.xml	8 Jun 2003 13:51:22 -0000	1.2
  @@ -35,6 +35,9 @@
           <property name="maven.compile.debug" value="on"/>
           <property name="maven.compile.optimize" value="off"/>
           <property name="maven.compile.deprecation" value="off"/>
  +        <property name="maven.junit.fork" value="off"/>
  +        <property name="maven.junit.dir" value="${basedir}"/>
  +        <property name="maven.junit.usefile" value="true"/>
   
           <property name="project.name" value="some-nameless-gump-built-component"/>
           <tstamp>
  @@ -43,7 +46,7 @@
           <property name="project.copyright.year" value="1997-2003"/>
       </target>
   
  -    <target name="excalibur:debug" depends="excalibur:init">
  +    <target name="excalibur:debug" depends="excalibur:init" unless="do.not.debug">
           <echo>
   =======================================================================
   DEBUG INFO
  @@ -66,7 +69,7 @@
           </echo>
       </target>
   
  -    <target name="excalibur:warning" depends="excalibur:init,excalibur:debug" unless="called.from.gump">
  +    <target name="excalibur:warning" depends="excalibur:init,excalibur:debug" unless="do.not.warn">
           <echo>
   =======================================================================
                             WARNING!
  @@ -78,6 +81,11 @@
       </target>
   
       <target name="excalibur:jar" depends="excalibur:init,excalibur:warning">
  +        <echo>
  +=======================================================================
  + Compiling Sources
  +=======================================================================
  +        </echo>
           <mkdir dir="${maven.build.dir}"/>
           <mkdir dir="${maven.build.dir}/classes"/>
           <javac
  @@ -92,6 +100,64 @@
               </src>
           </javac>
   
  +        <echo>
  +=======================================================================
  + Compiling Tests
  +======================================================================
  +        </echo>
  +        <mkdir dir="${maven.build.dir}/test-classes"/>
  +        <javac
  +                destdir="${maven.build.dir}/test-classes"
  +                excludes="**/package.html"
  +                debug="${maven.compile.debug}"
  +                deprecation="${maven.compile.deprecation}"
  +                optimize="${maven.compile.optimize}">
  +
  +            <src>
  +                <pathelement path="${maven.src.dir}/test"/>
  +            </src>
  +            <classpath>
  +              <pathelement path="${maven.build.dir}/classes"/>
  +            </classpath>
  +        </javac>
  +
  +        <echo>
  +=======================================================================
  + Running tests
  +=======================================================================
  +        </echo>
  +        <taskdef
  +          name="junit"
  +          classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
  +
  +        <mkdir dir="${maven.build.dir}/test-reports"/>
  +
  +        <junit printSummary="yes"
  +               failureProperty="maven.test.failure"
  +               fork="${maven.junit.fork}"
  +               dir="${maven.junit.dir}">
  +          <sysproperty key="basedir" value="${basedir}"/>
  +
  +          <formatter type="xml"/>
  +          <formatter type="plain" usefile="${maven.junit.usefile}"/>
  +          <classpath>
  +            <pathelement location="${maven.build.dir}/classes"/>
  +            <pathelement location="${maven.build.dir}/test-classes"/>
  +          </classpath>
  +          <batchtest todir="${maven.build.dir}/test-classes">
  +            <fileset dir="${maven.src.dir}/test">
  +                <include name="**/*TestCase.java"/>
  +                <!-- KEEP ALL ABSTRACT TESTS FROM BEING RUN! -->
  +                <exclude name="**/*Abstract*"/>
  +            </fileset>
  +          </batchtest>
  +        </junit>
  +
  +        <echo>
  +=======================================================================
  + Building jar
  +=======================================================================
  +        </echo>
           <jar destfile="${maven.build.dir}/${project.name}-${project.version}.jar" basedir="${maven.build.dir}/classes"/>
       </target>
   
  
  
  
  1.8       +92 -14    avalon-excalibur/maven-common.xml
  
  Index: maven-common.xml
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/maven-common.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- maven-common.xml	7 Jun 2003 15:12:19 -0000	1.7
  +++ maven-common.xml	8 Jun 2003 13:51:22 -0000	1.8
  @@ -162,6 +162,25 @@
       </postGoal>
   
       <!-- ==========================================================
  +          Build customization
  +         ========================================================== -->
  +
  +    <!-- copy additional test resources -->
  +    <postGoal name="test:prepare-filesystem">
  +        <echo>
  +            copy additional unit test resources
  +            from ${pom.build.unitTestSourceDirectory}
  +            to ${maven.test.dest}
  +        </echo>
  +        <copy todir="${maven.build.dir}/test-classes">
  +            <fileset dir="${pom.build.unitTestSourceDirectory}">
  +                <exclude name="**/*.java"/>
  +                <exclude name="**/package.html"/>
  +            </fileset>
  +        </copy>
  +    </postGoal>
  +
  +    <!-- ==========================================================
             Distribution customization
            ========================================================== -->
   
  @@ -239,7 +258,7 @@
           <attainGoal name="excalibur:version-override"/>
   
           <!-- generate checksums -->
  -        <ant:checksum filext="md5">
  +        <ant:checksum fileext="md5">
               <fileset dir="target/distributions">
                   <include name="*.zip"/>
                   <include name="*.gz"/>
  @@ -304,52 +323,52 @@
   
           <!-- -src.tar.gz to basedir -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.tar.gz ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.tar.gz ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz"/>
           </ant:exec>
           <!-- basedir/$v-src.tar.gz to basedir/latest-src.tar.gz -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.tar.gz"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.tar.gz"/>
           </ant:exec>
           <!-- -src.tar.gz.asc to basedir -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.tar.gz.asc ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.asc"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.tar.gz.asc ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.asc"/>
           </ant:exec>
           <!-- basedir/$v-src.tar.gz.asc to basedir/latest-src.tar.gz.asc -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.asc ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.tar.gz.asc"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.asc ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.tar.gz.asc"/>
           </ant:exec>
           <!-- -src.tar.gz.md5 to basedir -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.tar.gz.md5 ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.md5"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.tar.gz.md5 ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.md5"/>
           </ant:exec>
           <!-- basedir/$v-src.tar.gz.md5 to basedir/latest-src.tar.gz.md5 -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.md5 ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.tar.gz.md5"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.tar.gz.md5 ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.tar.gz.md5"/>
           </ant:exec>
   
           <!-- -src.zip to basedir -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.zip ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.zip ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip"/>
           </ant:exec>
           <!-- basedir/$v-src.zip to basedir/latest-src.zip -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.zip"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.zip"/>
           </ant:exec>
           <!-- -src.zip.md5 to basedir -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.zip.md5 ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.md5"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.zip.md5 ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.md5"/>
           </ant:exec>
           <!-- basedir/$v-src.zip.md5 to basedir/latest-src.zip.md5 -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.md5 ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.zip.md5"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.md5 ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.zip.md5"/>
           </ant:exec>
           <!-- -src.zip.asc to basedir -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.zip.asc ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.asc"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/source/${maven.final.name}-src.zip.asc ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.asc"/>
           </ant:exec>
           <!-- basedir/$v-src.zip.asc to basedir/latest-src.zip.asc -->
           <ant:exec dir="." executable="${maven.ssh.executable}">
  -            <arg line="${sshopts} ${hostname} ln -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.asc ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.zip.asc"/>
  +            <arg line="${sshopts} ${hostname} ln -f -s ${repodir}/${pom.artifactId}/${maven.final.name}-src.zip.asc ${repodir}/${pom.artifactId}/${pom.artifactId}-latest-src.zip.asc"/>
           </ant:exec>
   
           <!-- create announcment -->
  @@ -388,12 +407,71 @@
           <!-- e-mail announcement -->
   
           <j:if test="${mailannounce}">
  +<ant:echo>
  +    Attempting to send
  +</ant:echo>
               <ant:mail
                   from="Avalon Development Team &gt;dev@avalon.apache.org&lt;"
  -                toList="leosimons@apache.org"
  +                toList="Avalon Development List &gt;dev@avalon.apache.org&lt;, Avalon User List &gt;users@avalon.apache.org&lt;"
                   messageFile="${maven.build.dir}/announcement-${pom.currentVersion}.txt"
                   subject="[Announce] ${pom.artifactId} ${pom.currentVersion} released"/>
           </j:if>
       </goal>
  +
  +
  +    <!-- ==========================================================
  +          Gump Integration
  +         ========================================================== -->
  +
  +    <goal name="excalibur:seed-gump">
  +        <mkdir dir="${basedir}/../gump-integration"/>
  +        <mkdir dir="${basedir}/../gump-integration/project"/>
  +        <!-- create gump-project.xml -->
  +        <ant:available file="${basedir}/../gump-integration/project/${pom.artifactId}.xml"
  +                property="gump.exists"/>
  +        <j:set var="gexists" value="${gump.exists}"/>
  +        <j:if test="${gexists}"><ant:echo>Warning: ${basedir}/../gump-integration/project/${pom.artifactId}.xml already exists!</ant:echo></j:if>
  +        <j:if test="${not gexists}">
  +
  +            <!-- copied from the maven gump plugin -->
  +            <j:new var="dependentProjects" className="java.util.TreeSet" />
  +            <j:forEach var="dependency" items="${pom.dependencies}">
  +              <j:set var="gumpDepName">${dependency.groupId}</j:set>
  +              <j:set var="dummy">${dependentProjects.add(gumpDepName)}</j:set>
  +            </j:forEach>
  +
  +            <j:file name="${basedir}/../gump-integration/project/${pom.artifactId}.xml">
  +            <j:whitespace xmlns="dummy">
  +<project name="${pom.artifactId}">
  +    <package>${pom.package}</package>
  +    <ant basedir="${pom.artifactId}" target="dist">
  +        <property name="project.version" value="@@DATE@@"/>
  +    </ant>
  +
  +    <!-- common dependencies -->
  +    <depend project="ant" inherit="runtime"/>
  +    <depend project="xml-xalan2"/>
  +    <depend project="xml-xerces"/>
  +
  +    <!-- dump out the set of dependencies -->
  +    <j:forEach var="dependency" items="${dependentProjects}">
  +      <depend project="${dependency}" runtime="true"/>
  +    </j:forEach>
  +
  +    <work nested="${component.dir}/target/classes"/>
  +    <work nested="${component.dir}/target/test-classes"/>
  +
  +    <home nested="${component.dir}"/>
  +    <jar name="target/${component.id}-@@DATE@@.jar"/>
  +    <javadoc nested="${component.dir}/target/docs/apidocs"/>
  +
  +    <nag from="Gump Integration Build &lt;dev@avalon.apache.org&gt;"
  +            to="dev@avalon.apache.org"/>
  +</project>
  +            </j:whitespace>
  +            </j:file>
  +        </j:if>
  +    </goal>
  +
   
   </project>
  
  
  
  1.3       +115 -7    avalon-excalibur/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/maven.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- maven.xml	8 Jun 2003 12:01:11 -0000	1.2
  +++ maven.xml	8 Jun 2003 13:51:22 -0000	1.3
  @@ -72,6 +72,8 @@
           maven excalibur:seed
               # create a new component; see below for more info
   
  +        maven excalibur:write-gump-module.xml
  +            # create a module descriptor for gump; see below for more info
   
       Creating a distribution
       =======================
  @@ -166,6 +168,49 @@
               -Dcomponent.id=my-component \
               -Dcomponent.dir=mycomponent \
               excalibur:seed
  +
  +    Note that existing files in the specified directory will *not*
  +    be replaced. So if you are converting an existing component to
  +    build using maven, you will need to remove any existing ant
  +    build.xml file, for example.
  +
  +    Gump integration
  +    ================
  +
  +    Since gump cannot directly call maven, this script contains
  +    functionality for generating basic ant buildfiles as well as gump
  +    descriptors.
  +
  +    When you call the 'excalibur:seed' goal, a build.xml file is
  +    generated for you which can be called from gump. Since Gump handles
  +    classpath management, there is no need to do so in the buildfile,
  +    keeping it nice and simple.
  +
  +    Once you have added dependency information to your project.xml
  +    file, change into the component subdirectory and run the
  +    'excalibur:seed-gump' target. You have to specify the
  +    component.dir property once again. This will generate a file
  +    gump-integration/project/${component.id}.xml that contains a gump
  +    descriptor for your component.
  +
  +    Example:
  +
  +        cd mycomponent
  +        maven excalibur:seed-gump
  +            -Dcomponent.dir=mycomponent
  +
  +    After creating this descriptor, you still need to reference it from
  +    the gump module descriptor at
  +
  +        gump-integration/project/avalon-excalibur.xml
  +
  +    One way to do this is to autogenerate the file based on the
  +    contents of the 'gump-integration/project' directory:
  +
  +        cd ~/cvs/avalon-excalibur/
  +        maven excalibur:write-gump-module.xml
  +
  +    Note this won't work if the file mentioned above already exists.
   </ant:echo>
       </goal>
   
  @@ -258,6 +303,23 @@
           <ant:mkdir dir="${component.dir}/src/test"/>
           <ant:mkdir dir="${component.dir}/src/xdocs"/>
   
  +        <!-- write files -->
  +        <attainGoal name="excalibur:seed-project.xml"/>
  +        <attainGoal name="excalibur:seed-maven.xml"/>
  +        <attainGoal name="excalibur:seed-project.properties"/>
  +        <attainGoal name="excalibur:seed-build.xml"/>
  +<!-- doesn't work!        <attainGoal name="excalibur:seed-gump-project.xml"/> -->
  +        <attainGoal name="excalibur:seed-.cvsignore"/>
  +
  +        <j:if test="${use.forrest}">
  +            <attainGoal name="excalibur:seed-forrest"/>
  +        </j:if>
  +
  +        <!-- info to stdout -->
  +        <attainGoal name="excalibur:seed-info"/>
  +    </goal>
  +
  +    <goal name="excalibur:seed-project.xml">
           <!-- create project.xml -->
           <ant:available file="${component.dir}/project.xml"
                   property="project.exists"/>
  @@ -282,11 +344,17 @@
   to add one.
       </description>
   
  +    <dependencies>
  +        <!-- add dependencies here! -->
  +    </dependencies>
  +
   </project>
           </j:whitespace>
           </j:file>
           </j:if>
  +    </goal>
   
  +    <goal name="excalibur:seed-maven.xml">
           <!-- create maven.xml -->
           <ant:available file="${component.dir}/maven.xml"
                   property="maven.exists"/>
  @@ -295,7 +363,9 @@
           <j:if test="${not mexists}">
           <ant:copy file="maven-template.xml" tofile="${component.dir}/maven.xml"/>
           </j:if>
  +    </goal>
   
  +    <goal name="excalibur:seed-project.properties">
           <!-- create project.properties -->
           <ant:available file="${component.dir}/project.properties"
                   property="props.exists"/>
  @@ -312,7 +382,9 @@
   project.name=${component.id}
           </ant:echo>
           </j:if>
  +    </goal>
   
  +    <goal name="excalibur:seed-build.xml">
           <!-- create build.xml for gump integration-->
           <ant:available file="${component.dir}/build.xml"
                   property="build.exists"/>
  @@ -361,11 +433,9 @@
               </j:whitespace>
               </j:file>
           </j:if>
  +    </goal>
   
  -        <j:if test="${use.forrest}">
  -            <attainGoal name="excalibur:seed-forrest"/>
  -        </j:if>
  -
  +    <goal name="excalibur:seed-.cvsignore">
           <!-- create .cvsignore -->
           <ant:echo file="${component.dir}/.cvsignore">
   target
  @@ -375,9 +445,6 @@
   *.classpath
   *.project
           </ant:echo>
  -
  -        <attainGoal name="excalibur:seed-info"/>
  -
       </goal>
   
       <goal name="excalibur:seed-forrest"
  @@ -465,6 +532,47 @@
      excalibur cvs
   ===================================================================
           </ant:echo>
  +    </goal>
  +
  +    <goal name="excalibur:write-gump-module.xml"
  +            description="creates a gump-module.xml referencing all gump-project.xml files">
  +
  +        <mkdir dir="gump-integration"/>
  +        <mkdir dir="gump-integration/project"/>
  +
  +        <!-- create avalon-excalibur.xml -->
  +        <ant:available file="gump-integration/project/avalon-excalibur.xml"
  +                property="gumpmodule.exists"/>
  +        <j:set var="gmexists" value="${gumpmodule.exists}"/>
  +        <j:if test="${gmexists}"><ant:echo>Warning: gump-integration/project/avalon-excalibur.xml already exists!</ant:echo></j:if>
  +        <j:if test="${not gmexists}">
  +
  +            <ant:fileScanner var="projectfiles">
  +                <ant:fileset dir="gump-integration/project/">
  +                    <ant:patternset>
  +                        <ant:include name="*.xml"/>
  +                        <ant:exclude name="avalon-excalibur.xml"/>
  +                    </ant:patternset>
  +                </ant:fileset>
  +            </ant:fileScanner>
  +
  +            <j:file name="gump-integration/project/avalon-excalibur.xml">
  +            <j:whitespace xmlns="dummy">
  +<module name="avalon-excalibur">
  +    <url href="http://avalon.apache.org/excalibur/"/>
  +    <description>
  +      Avalon's repository of reusable components.
  +    </description>
  +    <cvs repository="avalon"/>
  +
  +<j:forEach var="file" items="${projectfiles.iterator()}">
  +    <project href="./${file.name}"/>
  +</j:forEach>
  +
  +</module>
  +            </j:whitespace>
  +            </j:file>
  +        </j:if>
       </goal>
   
   </project>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org