forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject cvs commit: xml-forrest/src/resources/forrestbot2/core buildall.xml cvs.xml default-forrest.properties email.xml emailtemplate.txt forrestbot.xml local.xml rebuild-forrest.xml
Date Wed, 01 Oct 2003 12:16:54 GMT
jefft       2003/10/01 05:16:54

  Added:       src/resources/forrestbot2 README.txt xml-forrest.xml
                        xml-xmlbeans.xml
               src/resources/forrestbot2/core buildall.xml cvs.xml
                        default-forrest.properties email.xml
                        emailtemplate.txt forrestbot.xml local.xml
                        rebuild-forrest.xml
  Log:
  Rewritten Forrestbot using plain Ant 1.6
  
  Revision  Changes    Path
  1.1                  xml-forrest/src/resources/forrestbot2/README.txt
  
  Index: README.txt
  ===================================================================
                                   Forrestbot v2
                                   =============
  
  Introduction
  ------------
  
  This directory contains an attempt at rewriting the Forrestbot using vanilla
  Ant 1.6, making extensive use of the <import> task.
  
  Motivation
  ----------
  
  The old Forrestbot works by generating an Ant script with XSLT.  This script
  calls targets in templates.build.xml, which in turn calls targets in
  forrest.build.xml.  This scheme has two problems:
  
   - With three layers of indirection, this gets very hard to debug
  
   - It's inflexible.  We cannot define project-specific tasks.  We very much
     need this missing flexibility, because a lot of projects (notably Cocoon)
     call Forrest after customising the xdocs in their own Ant scripts.
  
  
  Design
  ------
  
  Instead, Forrestbot v2 uses Ant 1.6's <import> to define a hierarchy of
  scripts:
  
                                 forrest.build.xml
                                         |
                                         V
                                   forrestbot.xml
                                         |
                                         V
        xml-forrest.xml, xml-fop.xml, cocoon-site.xml, jakarta-poi.xml, ...
  
  
  forrestbot.xml runs <import file="forrest.build.xml"/>, making it a logical
  superset of forrest.build.xml.  Scripts for building each Forrest-using
  projects are likewise supersets of forrestbot.xml
  
  The nice thing about <import> is that overriding scripts can:
  
   - Redefine properties.  Our project scripts can all redefine details like the
     CVS location, where confirmation mail should go to, etc.
  
   - Override targets.  Two uses:
   
      - Customize the forrestbot workflow.  Want to get a project's contents
        locally instead of from CVS?  Just override the 'getsrc' method:
  
         <target name="getsrc" depends="local.getsrc"/>
  
        Similarly for 'deploy' (local, ftp, scp) and 'notify' (email or just
        <echo>), 
  
      - Project-specific stuff.  Cocoon needs to copy lib/jars.xml to the xdocs
        directory, xml-cocoon.xml would override the 'get-src' target from
        forrestbot.xml, and do the copy (or invoke a Cocoon script to do it).
  
  
  Status
  ------
  
  *Very* alpha.  Requires the latest Ant, which I don't think Forrest's is.  Only
  a few project scripts implemented.
  
  
  -- 
  $Date: 2003/10/01 12:16:54 $ 
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/xml-forrest.xml
  
  Index: xml-forrest.xml
  ===================================================================
  <?xml version="1.0"?>
  <project name="xml-forrest" basedir="." default="main">
  
    <import file="core/forrestbot.xml"/>
  
    <target name="getsrc" depends="getsrc.local"/>
  
  </project>
   
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/xml-xmlbeans.xml
  
  Index: xml-xmlbeans.xml
  ===================================================================
  <?xml version="1.0"?>
  <project name="xml-xmlbeans" basedir="." default="main">
  
    <import file="core/forrestbot.xml"/>
  
    <property name="project.root-dir" value="website"/>
  
    <target name="getsrc" depends="local.getsrc"/>
  
    <!-- <target name="notify" depends="email.notify-onfail"/> -->
    <target name="notify" depends="local.notify"/>
  
  </project>
   
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/buildall.xml
  
  Index: buildall.xml
  ===================================================================
  <project>
  
    <fileset id="buildfiles" dir="." includes="*.xml">
      <exclude name="base.xml"/>
      <exclude name="build.xml"/>
    </fileset>
  
    <property name="buildfiles.prop" refid="buildfiles"/>
    <echo>Building ${buildfiles.prop}</echo>
  
    <subant>
      <fileset refid="buildfiles"/>
    </subant>
  </project>
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/cvs.xml
  
  Index: cvs.xml
  ===================================================================
  <project name="cvs">
  
    <property name="user" value="anoncvs"/>
    <property name="password" value="anoncvs"/>
    <property name="root" value="/home/cvspublic"/>
    <property name="host" value="cvs.apache.org"/>
    <property name="module" value="${ant.project.name}"/>
  
    <property name="build.cvsmodule-dir"    value="work/cvsmodules"/>
    <property name="build.work-dir"         value="work/${ant.project.name}"/>
  
    <property name="project.root-dir" value="."/>
  
    <target name="getsrc">
      <cvspass cvsroot=":pserver:${user}@${host}:${root}" password="${password}"/>
  
      <cvs cvsRoot=":pserver:${user}@${host}:${root}"
        package="${module}/${project.root-dir}"
        dest="${build.cvsmodule-dir}"
        quiet="true"
        command="checkout -l"
        />
  
      <loadproperties srcFile="${build.cvsmodule-dir}/${module}/${project.root-dir}/forrest.properties"/>
      <loadproperties srcFile="default-forrest.properties"/>
  
      <cvs cvsRoot=":pserver:${user}@${host}:${root}"
        package="${module}/${project.root-dir}/${project.content-dir}"
        dest="${build.cvsmodule-dir}"
        quiet="false"
        />
  
      <copy todir="${build.work-dir}">
        <fileset dir="${build.cvsmodule-dir}/${module}/${project.root-dir}"/>
      </copy>
  
    </target>
  
  
  </project>
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/default-forrest.properties
  
  Index: default-forrest.properties
  ===================================================================
  project.content-dir=src/documentation
  project.conf-dir=${project.content-dir}/conf
  project.sitemap-dir=${project.content-dir}
  project.xdocs-dir=${project.content-dir}/content/xdocs
  project.resources-dir=${project.content-dir}/resources
  project.stylesheets-dir=${project.resources-dir}/stylesheets
  project.images-dir=${project.resources-dir}/images
  project.schema-dir=${project.resources-dir}/schema
  project.skins-dir=${project.content-dir}/skins
  project.skinconf=${project.content-dir}/skinconf.xml
  project.lib-dir=${project.content-dir}/lib
  project.classes-dir=${project.content-dir}/classes
  
  project.site-dir=build/site
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/email.xml
  
  Index: email.xml
  ===================================================================
  <project name="email">
  
    <target name="notify" depends="site" if="build-failed">
      <tstamp>
        <format property="NOW" pattern="dd MMMM hh:mm aa"/>
      </tstamp>
      <mail from="forrestbot@xml.apache.org"
        mailhost="${mail.host}"
        tolist="${mail.to}"
        subject="ForrestBot build for ${ant.project.name} ${completion-status}"
        failonerror="false"
        files="${build.logfile}"
        messagefile="${bot.home}/emailtemplate.txt">
      </mail>
    </target>
  
  </project>
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/emailtemplate.txt
  
  Index: emailtemplate.txt
  ===================================================================
  Automated build for ${ant.project.name} ${completion-status}
  Log attached.
  
  -- 
  Forrestbot run ended at ${NOW}
  Using Forrest ${version}
  Forrestbot administrator: ${administrator}
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/forrestbot.xml
  
  Index: forrestbot.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project basedir="." default="main">
  
    <property name="forrest.home" value="${user.home}/apache/xml/xml-forrest/build/dist/shbat"/>
    <property name="bot.home" value="${forrest.home}/forrestbot2"/>
    <import file="${forrest.home}/forrest.build.xml"/>
  
    <import file="${bot.home}/rebuild-forrest.xml"/>
    <import file="${bot.home}/cvs.xml"/>
    <import file="${bot.home}/local.xml"/>
    <import file="${bot.home}/email.xml"/>
  
    <property name="administrator"  value="jefft@apache.org"/>
    <property name="build.work-dir"         value="work/${ant.project.name}"/>
    <property name="build.deploy-dir"       value="sites/${ant.project.name}"/>
    <mkdir dir="logs"/>
    <tstamp>
      <format property="logtime" pattern="yyMMdd-hhmm"/>
    </tstamp>
    <property name="build.logfile"          value="logs/${ant.project.name}.log"/>
    <property name="build.logfile-stored"   value="logs/${ant.project.name}-${logtime}.log"/>
  
    <property name="mail.host" value="localhost"/>
    <property name="mail.to"   value="${user.name}@localhost"/>
  
  
    <target name="getsrc" depends="local.getsrc"/>
  
    <target name="site" depends="getsrc">
  
      <taskdef name="trycatch" classname="net.sf.antcontrib.logic.TryCatchTask">
        <classpath>
          <pathelement location="${forrest.home}/forrestbot/lib/ant-contrib-0.1.jar"/>
        </classpath>
      </taskdef>
  
      <trycatch>
        <try>
          <record name="${build.logfile}" action="start"/>
          <antcall target="forrest.site" inheritAll="false">
            <param name="basedir" value="${build.work-dir}"/>
          </antcall>
          <record name="forrest.log" action="stop"/>
          <property name="completion-status" value="succeeded" />
        </try>
        <catch>
          <record name="${build.logfile}" action="stop"/>
          <echo>Oops, something broke</echo>
          <property name="completion-status" value="FAILED" />
          <property name="build-failed" value="true"/>
        </catch>
      </trycatch>
      <copy file="${build.logfile}" tofile="${build.logfile-stored}"/>
    </target>
  
    <target name="deploy" depends="local.deploy"/>
  
    <target name="notify" depends="email.notify"/>
  
    <target name="main" depends="deploy, notify"/>
  
  </project>
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/local.xml
  
  Index: local.xml
  ===================================================================
  <project name="local">
  
    <property name="local.root-dir" value="${user.home}/apache/xml/${ant.project.name}/${project.root-dir}"/>
    <property name="build.work-dir"         value="work/${ant.project.name}"/>
  
    <target name="getsrc">
      <mkdir dir="${build.work-dir}"/>
      <copy todir="${build.work-dir}">
        <fileset dir="${local.root-dir}">
          <include name="forrest.properties"/>
          <include name="status.xml"/>
          <include name="module.xml"/>
        </fileset>
      </copy>
      <loadproperties srcFile="${build.work-dir}/forrest.properties"/>
      <loadproperties srcFile="default-forrest.properties"/>
  
      <copy todir="${build.work-dir}/${project.content-dir}">
        <fileset dir="${local.root-dir}/${project.content-dir}"/>
      </copy>
    </target>
  
    <target name="deploy" depends="site" unless="build-failed">
      <mkdir dir="${build.deploy-dir}"/>
      <copy todir="${build.deploy-dir}">
        <fileset dir="${build.work-dir}/${project.site-dir}"/>
      </copy>
    </target>
  
    <target name="notify" depends="site">
      <tstamp>
        <format property="NOW" pattern="dd MMMM hh:mm aa"/>
      </tstamp>
      <echo>
        ----------------------------------
        Forrestbot run ${completion-status}
        Output in: ${build.deploy-dir}
        Log in:    ${build.logfile-stored}
  
        Time: ${NOW}
        Using Forrest ${version}
        ----------------------------------
      </echo>
    </target>
  
  
  </project>
  
  
  
  1.1                  xml-forrest/src/resources/forrestbot2/core/rebuild-forrest.xml
  
  Index: rebuild-forrest.xml
  ===================================================================
  <project name="rebuild-forrest">
  
    <property name="apache-cvsroot" value=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"/>
  
    <property name="forrest.tag" value="HEAD"/>
  
    <cvspass cvsroot="${apache-cvsroot}" password="anoncvs"/>
  
    <cvs cvsRoot="${apache-cvsroot}"
      package="xml-forrest"
      dest="cvs/"
      quiet="true"
      command="update -dP"
      />
    <property name="forrest.home" value="cvs/xml-forrest"/>
    <echo>forrest.home set to ${forrest.home}</echo>
  
  </project>
  
  
  

Mime
View raw message