jvanzyl     02/03/04 20:10:55

  Modified:    src/templates/build Control.vm build-docs.xml
                        build-metrics.xml build-test.xml
                        build.properties.loading build.xml
                        default.properties
  Added:       src/templates/build build-maven.xml project.properties
  Log:
  The build system generator will now place the maven build file in
  a directory of their own to keep them out of the top level directory.
  
  The project specific build file is now the build.xml file and there is
  now a standard delegator section so the standard targets shared by all
  projects are simply delegates.
  
  The generation mechanism will detect if a build.xml and project.properties
  file exists and won't overwrite them if they exist.
  
  None of this is cast in stone. Moving toward getting things working from
  the maven.jar file.
  
  Revision  Changes    Path
  1.7       +74 -6     jakarta-turbine-maven/src/templates/build/Control.vm
  
  Index: Control.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/Control.vm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Control.vm        25 Feb 2002 05:51:49 -0000      1.6
  +++ Control.vm        5 Mar 2002 04:10:55 -0000       1.7
  @@ -1,10 +1,78 @@
  -#set ($buildElements = ["build-metrics.xml", 
"build-docs.xml","build-test.xml","build.xml","default.properties","LICENSE","README.txt"])
  +## -------------------------------------------------------
  +## Make our list of build system elements
  +## -------------------------------------------------------
   
  -$project
  -$project.name
  -$project.id
  -$project.currentVersion
  +$buildElements.add("build-metrics.xml")
  +$buildElements.add("build-docs.xml")
  +$buildElements.add("build-test.xml")
  +$buildElements.add("build-maven.xml")
  +$buildElements.add("default.properties")
  +
  +## -------------------------------------------------------
  +## Make our list of build.xml delegators
  +## -------------------------------------------------------
  +
  +$delegators.put("env","build-maven.xml")
  +$delegators.put("update-jars","build-maven.xml")
  +$delegators.put("compile","build-maven.xml")
  +$delegators.put("jar","build-maven.xml")
  +$delegators.put("dist","build-maven.xml")
  +$delegators.put("install-jar","build-maven.xml")
  +$delegators.put("gump-descriptor","build-maven.xml")
  +$delegators.put("clean","build-maven.xml")
  +
  +## -------------------------------------------------------
  +## Make our list of build-test.xml delegators
  +## -------------------------------------------------------
  +
  +$delegators.put("test","build-test.xml")
  +
  +## -------------------------------------------------------
  +## Make our list of build-metrics.xml delegators
  +## -------------------------------------------------------
  +
  +$delegators.put("metrics","build-metrics.xml")
  +
  +## -------------------------------------------------------
  +## Make our list of build-docs.xml delegators
  +## -------------------------------------------------------
  +
  +$delegators.put("docs","build-docs.xml")
  +$delegators.put("javadocs","build-docs.xml")
  +$delegators.put("site","build-docs.xml")
  +$delegators.put("deploy-site","build-docs.xml")
  +
  +$delegators.get("deploy-site")
  +
  +## -------------------------------------------------------
  +## Make our list of build-docs.xml delegators
  +## -------------------------------------------------------
  +
  +#set ($mavenDirectory = "maven")
  +$files.mkdir($mavenDirectory)
  +
  +## -------------------------------------------------------
  +## Generate all the maven specific build elements that
  +## are placed in the maven directory.
  +## -------------------------------------------------------
  +
  +#set ($antBasedir = "..")
   
   #foreach ($buildElement in $buildElements)
  -$generator.parse($buildElement,$buildElement,"project",$project)
  +$generator.parse($buildElement,"$mavenDirectory/$buildElement")
  +#end
  +
  +## We don't want to overwrite an existing build.xml file
  +## or project.properties if they exist.
  +
  +#if (!$files.file("build.xml").exists())
  +$generator.parse("build.xml","build.xml")
  +#end
  +
  +#if (!$files.file("project.properties").exists())
  +$generator.parse("project.properties","project.properties")
   #end
  +
  +$generator.parse("LICENSE","LICENSE")
  +$generator.parse("README.txt","README.txt")
  +
  
  
  
  1.23      +4 -4      jakarta-turbine-maven/src/templates/build/build-docs.xml
  
  Index: build-docs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-docs.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- build-docs.xml    1 Mar 2002 18:27:43 -0000       1.22
  +++ build-docs.xml    5 Mar 2002 04:10:55 -0000       1.23
  @@ -1,10 +1,10 @@
   <?xml version="1.0"?>
   
  -<project name="$project.id" default="docs" basedir=".">
  +<project name="$project.id" default="docs" basedir="$antBasedir">
   
  -#include("build.properties.loading")
  +##parse("build.properties.loading")
   
  -#include("build.init.target")
  +#parse("build.init.target")
   
     <target
       name="docs"
  @@ -15,7 +15,7 @@
     <target 
       name="jdepend-metrics"
       description="o Generiates html from jdepend metrics">
  -       <ant antfile="build-metrics.xml" target="jdepend-xml"/>
  +    <ant antfile="$mavenDirectory/build-metrics.xml" target="jdepend-xml"/>
     </target>
   
     <!-- ================================================================== -->
  
  
  
  1.6       +3 -3      jakarta-turbine-maven/src/templates/build/build-metrics.xml
  
  Index: build-metrics.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-metrics.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build-metrics.xml 1 Mar 2002 18:11:26 -0000       1.5
  +++ build-metrics.xml 5 Mar 2002 04:10:55 -0000       1.6
  @@ -1,10 +1,10 @@
   <?xml version="1.0"?>
   
  -<project name="$project.id" default="metrics" basedir=".">
  +<project name="$project.id" default="metrics" basedir="$antBasedir">
   
  -#include("build.properties.loading")
  +##parse("build.properties.loading")
   
  -#include("build.init.target")
  +#parse("build.init.target")
   
     <!-- ================================================================== -->
     <!-- C O M P I L E                                                      -->
  
  
  
  1.7       +3 -3      jakarta-turbine-maven/src/templates/build/build-test.xml
  
  Index: build-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-test.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- build-test.xml    3 Mar 2002 05:04:58 -0000       1.6
  +++ build-test.xml    5 Mar 2002 04:10:55 -0000       1.7
  @@ -1,10 +1,10 @@
   <?xml version="1.0"?>
   
  -<project name="$project.id" default="test" basedir=".">
  +<project name="$project.id" default="test" basedir="$antBasedir">
   
  -#include("build.properties.loading")
  +##parse("build.properties.loading")
   
  -#include("build.init.target")
  +#parse("build.init.target")
   
     <!-- ================================================================== -->
     <!-- C O M P I L E  T E S T S                                           -->
  
  
  
  1.2       +2 -0      
jakarta-turbine-maven/src/templates/build/build.properties.loading
  
  Index: build.properties.loading
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/templates/build/build.properties.loading,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.properties.loading  23 Feb 2002 07:18:02 -0000      1.1
  +++ build.properties.loading  5 Mar 2002 04:10:55 -0000       1.2
  @@ -7,3 +7,5 @@
     <property file="build.properties" />
     <!-- Set default values for the build -->
     <property file="default.properties" />
  +  <!-- Set default values for the build -->
  +  <property file="$mavenDirectory/project.properties" />
  
  
  
  1.18      +70 -383   jakarta-turbine-maven/src/templates/build/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build.xml,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- build.xml 28 Feb 2002 23:49:18 -0000      1.17
  +++ build.xml 5 Mar 2002 04:10:55 -0000       1.18
  @@ -1,394 +1,81 @@
   <?xml version="1.0"?>
   
  -<!-- Build file for ${name} -->
  +<project name="maven" default="jar" basedir=".">
   
  -<project name="$project.id" default="jar" basedir=".">
  +  <!-- Give user a chance to override without editing this file
  +       (and without typing -D each time they invoke a target) -->
   
  -#include("build.properties.loading")
  +  <!-- Allow any user specific values to override the defaults -->
  +  <property file="${user.home}/build.properties" />
  +  <!-- Allow user defaults for this project -->
  +  <property file="build.properties" />
  +  <!-- Set default values for the build -->
  +  <property file="project.properties" />
  +  <!-- Set default values for the build -->
  +  <property file="$mavenDirectory/default.properties" />
   
  -#include("build.init.target")
  -
  -  <!-- ================================================================== -->
  -  <!-- E N V I R O N M E N T                                              -->
  -  <!-- ================================================================== -->
  -
  -  <target 
  -    name="env"
  -    depends="init">
  -
  -    <property name="classpath" refid="classpath"/>
  -
  -    <echo>
  -      java.home = ${java.home}
  -      user.home = ${user.home}
  -      lib.repo = ${lib.repo}
  -      
  -      Classpath:
  -      ${classpath}
  -    </echo>      
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- U P D A T E  J A R S                                               -->
  -  <!-- ================================================================== -->
  -
  -  <target
  -    name="update-jars" 
  -    description="o Update JARs required for building"
  -    depends="update-jars-proxy,update-jars-noproxy">
  -  </target>
  -
  -  <target 
  -    name="prepare.httpget">    
  -    
  -    <taskdef 
  -      name="httpget" 
  -      className="org.apache.maven.UpdateResources">
  -      <classpath refid="maven-classpath"/>
  -    </taskdef>
  -  </target>
  -
  -  <target 
  -    name="update-jars-noproxy" 
  -    unless="proxy.host" 
  -    depends="prepare.httpget">
  -    
  -    <httpget
  -      projectDescriptor="project.xml"
  -      baseUrl="http://jakarta.apache.org/turbine/jars/";
  -      dest="${lib.repo}"
  -    />
  -  </target>    
  -
  -  <target name="update-jars-proxy" if="proxy.host" depends="prepare.httpget">
  -    <httpget
  -      projectDescriptor="project.xml"
  -      baseUrl="http://jakarta.apache.org/turbine/jars/";
  -      dest="${lib.repo}"
  -      proxyHost="${proxy.host}"
  -      proxyPort="${proxy.port}"
  -    />
  -  </target>    
  -
  -  <!-- ================================================================== -->
  -  <!-- U S A G E                                                          -->
  -  <!-- ================================================================== -->
  -
  -  <target 
  -    name="usage">
  -    
  -    <echo message="use -projecthelp to see the available targets"/>
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- C O M P I L E                                                      -->
  -  <!-- ================================================================== -->
  -
  -  <target
  -    name="compile"
  -    depends="javac.compile,aspectj.compile"
  -    description="o Compile project source code"/>
  -
  -  <!-- ================================================================== -->
  -  <!-- J A V A C  C O M P I L E                                           -->
  -  <!-- ================================================================== -->
  -
  -  <target
  -    name="javac.compile"
  -    unless="build.includes.aspects"
  -    depends="env"
  -    description="o Compile project source code with javac">
  -
  -    <!-- Make sure the target directory exists -->
  -    <mkdir dir="${build.dest}"/>
  -
  -    <javac
  -      destdir="${build.dest}"
  -      excludes="**/package.html"
  -      debug="${compile.debug}"
  -      deprecation="${compile.deprecation}"
  -      optimize="${compile.optimize}">
  -      <src>
  -        <path refid="src.set"/>
  -      </src>
  -      <classpath refid="classpath"/>
  -    </javac>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- A S P E C T  C O M P I L E                                          -->
  -  <!-- =================================================================== -->
  -
  -  <target
  -    name="aspectj.compile"
  -    if="build.includes.aspects"
  -    depends="env"
  -    description="o Compile project source code with AspectJ compiler">
  -
  -    <taskdef
  -      name="ajc"
  -      classname="org.aspectj.tools.ant.taskdefs.Ajc"/>
  -
  -    <ajc 
  -      destdir="${build.dest}"
  -      excludes="**/package.html"
  -      debug="${compile.debug}"
  -      deprecation="${compile.deprecation}"
  -      optimize="${compile.optimize}">
  -      
  -      <src>
  -        <path refid="src.aspect.set"/>
  -      </src>
  -      <classpath>
  -        <path refid="classpath"/>
  -        <pathelement location="${aspectjrt.jar}"/>
  -        <pathelement location="${aspectjtools.jar}"/>
  -      </classpath>
  -    </ajc>
  -
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- J A R  R E S O U R C E S                                           -->
  -  <!-- ================================================================== -->
  -  
  -  <target
  -    name="search-for-jar-resources">
  -    <echo message="jar.resources = ${jar.resources}"/>
  -    <available file="${jar.resources}" property="jar.resources.present"/>
  -    <echo message="jar.resources.present = ${jar.resources.present}"/>
  -  </target>
  +  <!-- maven:start -->
     
  -  <target
  -    name="jar-resources"
  -    if="jar.resources.present"
  -    depends="search-for-jar-resources">
  -
  -    <!-- Copy any resources that must be present in the deployed
  -         JAR file.
  -    -->
  -    
  -    <!-- JAR Resources PatternSet -->
  -    <create-patternset rid="jar.resources.set" descriptor="${jar.resources}"/>
  -    
  -    <echo>
  -      Copy resources into destination directory for deployment
  -      in the JAR.
  -    </echo>
  -    
  -    <copy todir="${build.dest}">
  -      <fileset dir="${basedir}">
  -        <patternset refid="jar.resources.set"/>
  -      </fileset>
  -    </copy>
  -  </target>    
  -
     <!-- ================================================================== -->
  -  <!-- J A R                                                              -->
  +  <!-- D E L E G A T O R S                                                -->
     <!-- ================================================================== -->
  -
  -  <target
  -    name="jar"
  -    depends="compile,jar-resources"
  -    description="o Generates the ${project} JAR file (default)">
  -
  -    <jar
  -      jarfile="${build.dir}/${final.name}.jar"
  -      basedir="${build.dest}"
  -      excludes="**/package.html"
  -    />
  -
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- D I S T R I B U T I O N S                                          -->
  -  <!-- ================================================================== -->
  -
  -  <target
  -    name="dist"
  -    depends="jar,javadocs"
  -    description="o Create source and binary distributions">
  -
  -    <property name="distDir" value="${build.dir}/${final.name}"/>
  -
  -    <!-- B I N A R Y  D I S T R I B U T I O N -->
  -
  -    <echo>
  -      +-------------------------------------------------------+
  -      | C R E A T I N G  B I N A R Y  D I S T R I B U T I O N |
  -      +-------------------------------------------------------+
  -    </echo>
  -
  -    <mkdir dir="${distDir}"/>
  -
  -    <!-- Copy README and LICENSE -->
  -    <!--
  -    <copy todir="${distDir}" file="README.txt"/>
  -    <copy todir="${distDir}" file="LICENSE"/>
  -    -->
  -
  -    <!-- Copy Jars -->
  -    <copy todir="${distDir}">
  -      <fileset dir="${build.dir}">
  -        <include name="**/*.jar"/>
  -      </fileset>
  -    </copy>
  -
  -    <!-- Copy documentation -->
  -    <copy todir="${distDir}/docs">
  -      <fileset dir="${docs.dest}">
  -        <include name="**"/>
  -      </fileset>
  -    </copy>
  -
  -    <!-- Create a tar.gz file -->
  -    <tar longfile="gnu" tarfile="${build.dir}/${final.name}.tar">
  -      <tarfileset dir="${build.dir}">
  -        <include name="${final.name}/**"/>
  -      </tarfileset>
  -    </tar>
  -
  -    <gzip zipfile="${build.dir}/${final.name}.tar.gz" 
src="${build.dir}/${final.name}.tar"/>
  -    <delete file="${build.dir}/${final.name}.tar"/>
  -
  -    <!-- Create a zip file -->
  -    <zip zipfile="${build.dir}/${final.name}.zip">
  -      <zipfileset dir="${build.dir}">
  -        <include name="${final.name}/**"/>
  -      </zipfileset>
  -    </zip>
  -
  -    <!-- S O U R C E  D I S T R I B U T I O N -->
  -
  -    <echo>
  -      +-------------------------------------------------------+
  -      | C R E A T I N G  S O U R C E  D I S T R I B U T I O N |
  -      +-------------------------------------------------------+
  -    </echo>
  -
  -    <delete>
  -      <fileset dir="${distDir}">
  -        <include name="**/*.jar"/>
  -      </fileset>
  -    </delete>
  -
  -    <copy todir="${distDir}" file="default.properties"/>
  -    <copy todir="${distDir}" file="build.xml"/>
  -
  -    <!-- Copy Source -->
  -    <copy todir="${distDir}/src">
  -      <fileset dir="${src.dir}">
  -        <include name="**/*.java"/>
  -      </fileset>
  -    </copy>
  -
  -    <!-- Create a tar.gz file -->
  -    <tar longfile="gnu" tarfile="${build.dir}/${final.name}-src.tar">
  -      <tarfileset dir="${build.dir}">
  -        <include name="${final.name}/**"/>
  -      </tarfileset>
  -    </tar>
  -
  -    <gzip zipfile="${build.dir}/${final.name}-src.tar.gz" 
src="${build.dir}/${final.name}-src.tar"/>
  -    <delete file="${build.dir}/${final.name}-src.tar"/>
  -
  -    <!-- Create a zip file -->
  -    <zip zipfile="${build.dir}/${final.name}-src.zip">
  -      <zipfileset dir="${build.dir}">
  -        <include name="${final.name}/**"/>
  -      </zipfileset>
  -    </zip>
  -
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- I N S T A L L  J A R                                               -->
  -  <!-- ================================================================== -->
  -
  -  <target 
  -    name="install-jar" 
  -    depends="jar"
  -    description="o Installs JAR file in local ${lib.repo}">
  +        
  +    <target name="site">
  +      <ant antfile="maven/build-docs.xml" target="site"/>
  +    </target>
  +        
  +    <target name="jar">
  +      <ant antfile="maven/build-maven.xml" target="jar"/>
  +    </target>
  +        
  +    <target name="install-jar">
  +      <ant antfile="maven/build-maven.xml" target="install-jar"/>
  +    </target>
  +        
  +    <target name="env">
  +      <ant antfile="maven/build-maven.xml" target="env"/>
  +    </target>
  +        
  +    <target name="docs">
  +      <ant antfile="maven/build-docs.xml" target="docs"/>
  +    </target>
  +        
  +    <target name="test">
  +      <ant antfile="maven/build-test.xml" target="test"/>
  +    </target>
  +        
  +    <target name="clean">
  +      <ant antfile="maven/build-maven.xml" target="clean"/>
  +    </target>
  +        
  +    <target name="metrics">
  +      <ant antfile="maven/build-metrics.xml" target="metrics"/>
  +    </target>
  +        
  +    <target name="dist">
  +      <ant antfile="maven/build-maven.xml" target="dist"/>
  +    </target>
  +        
  +    <target name="deploy-site">
  +      <ant antfile="maven/build-docs.xml" target="deploy-site"/>
  +    </target>
  +        
  +    <target name="gump-descriptor">
  +      <ant antfile="maven/build-maven.xml" target="gump-descriptor"/>
  +    </target>
  +        
  +    <target name="javadocs">
  +      <ant antfile="maven/build-docs.xml" target="javadocs"/>
  +    </target>
  +        
  +    <target name="compile">
  +      <ant antfile="maven/build-maven.xml" target="compile"/>
  +    </target>
  +        
  +    <target name="update-jars">
  +      <ant antfile="maven/build-maven.xml" target="update-jars"/>
  +    </target>
       
  -    <copy todir="${lib.repo}" filtering="no">
  -      <fileset dir="${build.dir}">
  -        <include name="${final.name}.jar"/>
  -      </fileset>
  -    </copy>
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- G U M P  D E S C R I P T O R                                       -->
  -  <!-- ================================================================== -->
  -  <!-- Converts a Maven descriptor to Gump format so that projects        -->
  -  <!-- using Maven can easily participate in Gump builds. This also       -->
  -  <!-- means that the Gump descriptor will be accurate because if         -->
  -  <!-- the project builds with Maven then the descriptor generated        -->
  -  <!-- for Gump will be correct. Distribution of responsibility.          -->
  -  <!-- ================================================================== -->
  -
  -  <target
  -    name="gump-descriptor"
  -    depends="init"
  -    description="o Generate Gump descriptor from Maven descriptor">
  -
  -    <taskdef name="dvsl" classname="org.apache.tools.dvsl.DVSLTask">
  -      <classpath>
  -        <path refid="classpath"/>
  -      </classpath>
  -    </taskdef>
  -
  -    <!-- Make sure the target directory -->
  -    <mkdir dir="${docs.dest}"/>
  -
  -    <dvsl
  -      basedir="."
  -      destdir="./"
  -      extension=".xml"
  -      style="src/dvsl/gump/convert-project.dvsl"
  -      in="project.xml"
  -      out="${project}.xml"
  -    />
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- C L E A N                                                          -->
  -  <!-- ================================================================== -->
  -
  -  <target 
  -    name="clean" 
  -    description="o Cleans up the build directory">
  -    
  -    <delete dir="${build.dir}"/>
  -  </target>
  -
  -  <!-- ================================================================== -->
  -  <!-- C O N V E N I E N C E  D E L E G A T O R S                         -->
  -  <!-- ================================================================== -->
  -
  -  <target
  -    name="metrics">
  -    <ant antfile="build-metrics.xml"/>
  -  </target>
  -
  -  <target
  -    name="test">
  -    <ant antfile="build-test.xml"/>
  -  </target>
  -
  -  <target
  -    name="docs">
  -    <ant antfile="build-docs.xml"/>
  -  </target>
  -
  -  <target
  -    name="javadocs">
  -    <ant antfile="build-docs.xml" target="javadocs"/>
  -  </target>
  -
  -  <target
  -    name="deploy-site">
  -    <ant antfile="build-docs.xml" target="deploy-site"/>
  -  </target>
  +  <!-- maven:end -->
   
   </project>
  
  
  
  1.7       +3 -15     jakarta-turbine-maven/src/templates/build/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/default.properties,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- default.properties        1 Mar 2002 11:37:41 -0000       1.6
  +++ default.properties        5 Mar 2002 04:10:55 -0000       1.7
  @@ -1,20 +1,8 @@
   # -------------------------------------------------------------------
  -# D E F A U L T  P R O P E R T I E S
  +# D E F A U L T  M A V E N  P R O P E R T I E S
   # -------------------------------------------------------------------
  -
  -name = $project.name
  -version = $project.currentVersion
  -project = $project.id
  -id = $project.id
  -organization = $project.organization
  -inception.year = $project.inceptionYear
  -package = $project.package
  -compile.debug = on
  -compile.optimize = off
  -compile.deprecation = off
  -
  -# -------------------------------------------------------------------
  -# I M M U T A B L E
  +# These are the properties that we believe are immutable so we
  +# keep them apart from the project specific properties.
   # -------------------------------------------------------------------
   
   test.reportsDirectory = ${basedir}/test-reports
  
  
  
  1.1                  jakarta-turbine-maven/src/templates/build/build-maven.xml
  
  Index: build-maven.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project name="$project.id" default="jar" basedir="$antBasedir">
  
  ##parse("build.properties.loading")
  
  #parse("build.init.target")
  
    <!-- ================================================================== -->
    <!-- E N V I R O N M E N T                                              -->
    <!-- ================================================================== -->
  
    <target 
      name="env"
      depends="init">
  
      <property name="classpath" refid="classpath"/>
  
      <echo>
        java.home = ${java.home}
        user.home = ${user.home}
        lib.repo = ${lib.repo}
        
        Classpath:
        ${classpath}
      </echo>      
    </target>
  
    <!-- ================================================================== -->
    <!-- U P D A T E  J A R S                                               -->
    <!-- ================================================================== -->
  
    <target
      name="update-jars" 
      description="o Update JARs required for building"
      depends="update-jars-proxy,update-jars-noproxy">
    </target>
  
    <target 
      name="prepare.httpget">    
      
      <taskdef 
        name="httpget" 
        className="org.apache.maven.UpdateResources">
        <classpath refid="maven-classpath"/>
      </taskdef>
    </target>
  
    <target 
      name="update-jars-noproxy" 
      unless="proxy.host" 
      depends="prepare.httpget">
      
      <httpget
        projectDescriptor="project.xml"
        baseUrl="http://jakarta.apache.org/turbine/jars/";
        dest="${lib.repo}"
      />
    </target>    
  
    <target name="update-jars-proxy" if="proxy.host" depends="prepare.httpget">
      <httpget
        projectDescriptor="project.xml"
        baseUrl="http://jakarta.apache.org/turbine/jars/";
        dest="${lib.repo}"
        proxyHost="${proxy.host}"
        proxyPort="${proxy.port}"
      />
    </target>    
  
    <!-- ================================================================== -->
    <!-- U S A G E                                                          -->
    <!-- ================================================================== -->
  
    <target 
      name="usage">
      
      <echo message="use -projecthelp to see the available targets"/>
    </target>
  
    <!-- ================================================================== -->
    <!-- C O M P I L E                                                      -->
    <!-- ================================================================== -->
  
    <target
      name="compile"
      depends="javac.compile,aspectj.compile"
      description="o Compile project source code"/>
  
    <!-- ================================================================== -->
    <!-- J A V A C  C O M P I L E                                           -->
    <!-- ================================================================== -->
  
    <target
      name="javac.compile"
      unless="build.includes.aspects"
      depends="env"
      description="o Compile project source code with javac">
  
      <!-- Make sure the target directory exists -->
      <mkdir dir="${build.dest}"/>
  
      <javac
        destdir="${build.dest}"
        excludes="**/package.html"
        debug="${compile.debug}"
        deprecation="${compile.deprecation}"
        optimize="${compile.optimize}">
        <src>
          <path refid="src.set"/>
        </src>
        <classpath refid="classpath"/>
      </javac>
    </target>
  
    <!-- =================================================================== -->
    <!-- A S P E C T  C O M P I L E                                          -->
    <!-- =================================================================== -->
  
    <target
      name="aspectj.compile"
      if="build.includes.aspects"
      depends="env"
      description="o Compile project source code with AspectJ compiler">
  
      <taskdef
        name="ajc"
        classname="org.aspectj.tools.ant.taskdefs.Ajc"/>
  
      <ajc 
        destdir="${build.dest}"
        excludes="**/package.html"
        debug="${compile.debug}"
        deprecation="${compile.deprecation}"
        optimize="${compile.optimize}">
        
        <src>
          <path refid="src.aspect.set"/>
        </src>
        <classpath>
          <path refid="classpath"/>
          <pathelement location="${aspectjrt.jar}"/>
          <pathelement location="${aspectjtools.jar}"/>
        </classpath>
      </ajc>
  
    </target>
  
    <!-- ================================================================== -->
    <!-- J A R  R E S O U R C E S                                           -->
    <!-- ================================================================== -->
    
    <target
      name="jar-resources"
      if="jar.resources.present">
  
      <!-- Copy any resources that must be present in the deployed
           JAR file.
      -->
      
      <echo>
        Copy resources into destination directory for deployment
        in the JAR.
      </echo>
      
      <copy todir="${build.dest}">
        <fileset dir="${basedir}">
          <patternset refid="jar.resources.set"/>
        </fileset>
      </copy>
    </target>    
  
    <!-- ================================================================== -->
    <!-- J A R                                                              -->
    <!-- ================================================================== -->
  
    <target
      name="jar"
      depends="compile,jar-resources"
      description="o Generates the ${project} JAR file (default)">
  
      <jar
        jarfile="${build.dir}/${final.name}.jar"
        basedir="${build.dest}"
        excludes="**/package.html"
      />
  
    </target>
  
    <!-- ================================================================== -->
    <!-- D I S T R I B U T I O N S                                          -->
    <!-- ================================================================== -->
  
    <target
      name="dist"
      depends="jar,javadocs"
      description="o Create source and binary distributions">
  
      <property name="distDir" value="${build.dir}/${final.name}"/>
  
      <!-- B I N A R Y  D I S T R I B U T I O N -->
  
      <echo>
        +-------------------------------------------------------+
        | C R E A T I N G  B I N A R Y  D I S T R I B U T I O N |
        +-------------------------------------------------------+
      </echo>
  
      <mkdir dir="${distDir}"/>
  
      <!-- Copy README and LICENSE -->
      <!--
      <copy todir="${distDir}" file="README.txt"/>
      <copy todir="${distDir}" file="LICENSE"/>
      -->
  
      <!-- Copy Jars -->
      <copy todir="${distDir}">
        <fileset dir="${build.dir}">
          <include name="**/*.jar"/>
        </fileset>
      </copy>
  
      <!-- Copy documentation -->
      <copy todir="${distDir}/docs">
        <fileset dir="${docs.dest}">
          <include name="**"/>
        </fileset>
      </copy>
  
      <!-- Create a tar.gz file -->
      <tar longfile="gnu" tarfile="${build.dir}/${final.name}.tar">
        <tarfileset dir="${build.dir}">
          <include name="${final.name}/**"/>
        </tarfileset>
      </tar>
  
      <gzip zipfile="${build.dir}/${final.name}.tar.gz" 
src="${build.dir}/${final.name}.tar"/>
      <delete file="${build.dir}/${final.name}.tar"/>
  
      <!-- Create a zip file -->
      <zip zipfile="${build.dir}/${final.name}.zip">
        <zipfileset dir="${build.dir}">
          <include name="${final.name}/**"/>
        </zipfileset>
      </zip>
  
      <!-- S O U R C E  D I S T R I B U T I O N -->
  
      <echo>
        +-------------------------------------------------------+
        | C R E A T I N G  S O U R C E  D I S T R I B U T I O N |
        +-------------------------------------------------------+
      </echo>
  
      <delete>
        <fileset dir="${distDir}">
          <include name="**/*.jar"/>
        </fileset>
      </delete>
  
      <copy todir="${distDir}" file="default.properties"/>
      <copy todir="${distDir}" file="build.xml"/>
  
      <!-- Copy Source -->
      <copy todir="${distDir}/src">
        <fileset dir="${src.dir}">
          <include name="**/*.java"/>
        </fileset>
      </copy>
  
      <!-- Create a tar.gz file -->
      <tar longfile="gnu" tarfile="${build.dir}/${final.name}-src.tar">
        <tarfileset dir="${build.dir}">
          <include name="${final.name}/**"/>
        </tarfileset>
      </tar>
  
      <gzip zipfile="${build.dir}/${final.name}-src.tar.gz" 
src="${build.dir}/${final.name}-src.tar"/>
      <delete file="${build.dir}/${final.name}-src.tar"/>
  
      <!-- Create a zip file -->
      <zip zipfile="${build.dir}/${final.name}-src.zip">
        <zipfileset dir="${build.dir}">
          <include name="${final.name}/**"/>
        </zipfileset>
      </zip>
  
    </target>
  
    <!-- ================================================================== -->
    <!-- I N S T A L L  J A R                                               -->
    <!-- ================================================================== -->
  
    <target 
      name="install-jar" 
      depends="jar"
      description="o Installs JAR file in local ${lib.repo}">
      
      <copy todir="${lib.repo}" filtering="no">
        <fileset dir="${build.dir}">
          <include name="${final.name}.jar"/>
        </fileset>
      </copy>
    </target>
  
    <!-- ================================================================== -->
    <!-- G U M P  D E S C R I P T O R                                       -->
    <!-- ================================================================== -->
    <!-- Converts a Maven descriptor to Gump format so that projects        -->
    <!-- using Maven can easily participate in Gump builds. This also       -->
    <!-- means that the Gump descriptor will be accurate because if         -->
    <!-- the project builds with Maven then the descriptor generated        -->
    <!-- for Gump will be correct. Distribution of responsibility.          -->
    <!-- ================================================================== -->
  
    <target
      name="gump-descriptor"
      depends="init"
      description="o Generate Gump descriptor from Maven descriptor">
  
      <taskdef name="dvsl" classname="org.apache.tools.dvsl.DVSLTask">
        <classpath>
          <path refid="classpath"/>
        </classpath>
      </taskdef>
  
      <!-- Make sure the target directory -->
      <mkdir dir="${docs.dest}"/>
  
      <dvsl
        basedir="."
        destdir="./"
        extension=".xml"
        style="src/dvsl/gump/convert-project.dvsl"
        in="project.xml"
        out="${project}.xml"
      />
    </target>
  
    <!-- ================================================================== -->
    <!-- C L E A N                                                          -->
    <!-- ================================================================== -->
  
    <target 
      name="clean" 
      description="o Cleans up the build directory">
      
      <delete dir="${build.dir}"/>
    </target>
  
    <!-- ================================================================== -->
    <!-- C O N V E N I E N C E  D E L E G A T O R S                         -->
    <!-- ================================================================== -->
  
    <target
      name="metrics">
      <ant antfile="build-metrics.xml"/>
    </target>
  
    <target
      name="test">
      <ant antfile="build-test.xml"/>
    </target>
  
    <target
      name="docs">
      <ant antfile="build-docs.xml"/>
    </target>
  
    <target
      name="javadocs">
      <ant antfile="build-docs.xml" target="javadocs"/>
    </target>
  
    <target
      name="deploy-site">
      <ant antfile="build-docs.xml" target="deploy-site"/>
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-turbine-maven/src/templates/build/project.properties
  
  Index: project.properties
  ===================================================================
  # -------------------------------------------------------------------
  # P R O J E C T  P R O P E R T I E S
  # -------------------------------------------------------------------
  
  name = $project.name
  version = $project.currentVersion
  project = $project.id
  id = $project.id
  organization = $project.organization
  inception.year = $project.inceptionYear
  package = $project.package
  compile.debug = on
  compile.optimize = off
  compile.deprecation = off
  
  
  

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

Reply via email to