Blevins,
 
Here they are.
 
Updates:
1. properties variable ${maven.exe}
2. changed the command line syntax to skip tests.
 
Cheers
Prasad

 
On 11/11/05, Prasad Kashyap <[EMAIL PROTECTED]> wrote:
1. Done. Moved the maven executable to the properties file.
 
2. Hmm.. The svn info command seems to work fine for me. In fact, it saves the output to a file which I then convert into the properties format. So yes, the info is readily available in a properties format. Need to figure out why/what is failing on your machine.
 
Cheers
Prasad

 
On 11/11/05, David Blevins <[EMAIL PROTECTED] > wrote:

On Nov 10, 2005, at 9:59 AM, Prasad Kashyap wrote:

> Hi David,
>
> Check out the ant files for the work publish_build.sh used to do.
> It does almost everything except for the remote cleanup <target
> name="cleanupRemote">. I'm still thinking about a nice clean way of
> doing this. Executing a remote script (ant or other) is one of the
> thoughts. Let me know what you think.
>

I gave it a whirl.  Didn't quite work as-is on my machine.  Couple
notes for you:

  1. It has maven.bat hardcoded in there.  Maybe you could make the
path to the maven executable a property.

  2. The svn info command doesn't seem to work on URLs (i.e. http://
svn.apache.org/..../).  Seems to just report the version and other
info of your working copy.  I can't see any other way to get the
version other than what I was doing, so I put that one-liner in a
script in my home dir that you can hit from the ant script:
       http://people.apache.org/~dblevins/gbuild/svnversion.cgi

Now that I think about it, you might want that version in a
properties file format.  Let me know if you do or what else you need.

Looks great so far!

-David




Attachment: build_publish.properties
Description: Binary data

<?xml version="1.0" encoding="UTF-8" ?>
<project name="PublishBuild" default="init" basedir=".">

  <property file="build_publish.properties"/>
  <property name="dist" location="dist"/>
  <property name="dependency.dir" location="dependencyModules"/>

  <target name="init" >
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${dist}"/>
    <!-- Execute svn info and store the output in geronimoInfo.properties -->
    <exec executable="svn" output="${project.name}Info.properties">
      <arg line="info ${svn.url}"/>
    </exec>
    <replace file="${project.name}Info.properties" token=": " value="=" />
    <!-- Read the Revision info from geronimoInfo.properties -->
    <loadproperties srcFile="${project.name}Info.properties">
      <filterchain>
        <linecontains>
          <contains value="Revision"/>
        </linecontains>
      </filterchain>
    </loadproperties>
    <echo>Revision is ${Revision}</echo>
    <!--  Example value: 1.0-123456 -->
    <property name="full.version" value="${version.number}-${Revision}"/>
    <!--  Example value: geronimo-1.0-123456 -->
    <property name="release.id" value="${project.name}-${full.version}"/>
    <!--  Example value: /www/cvs.apache.org/dist/geronimo/unstable/1.0-123456 -->
    <property name="version.dir" value="${release.dir}-${full.version}"/>
  </target>

  <available file="${release.id}" type="dir" property="${release.id}.dir.present"/>
  <available file="${dependency.dir}\openejb" type="dir" property="openejb.dir.present"/>

  <target name="setup" depends="init" unless="${project.name}.dir.present, openejb.dir.present"
    description="Checkout the latest revision of the source code" >
    <mkdir dir="${dependency.dir}"/>
    <exec executable="svn">
      <arg line="co --revision ${Revision} ${svn.url} ${release.id}"/>
    </exec>
    <cvs cvsRoot=":pserver:[EMAIL PROTECTED]:/scm/openejb" package="openejb" dest="${dependency.dir}" />
    <cvs cvsRoot=":pserver:[EMAIL PROTECTED]:/scm/tranql" package="tranql" dest="${dependency.dir}" />
    <cvs cvsRoot=":pserver:[EMAIL PROTECTED]:/scm/tranql" package="connector" dest="${dependency.dir}"/>
    <copy todir="${release.id}\modules">
      <fileset dir="${dependency.dir}"/>
    </copy>
    <!-- The geronimo version should be changed from SNAPSHOT to the svn revision number we checked out -->
    <replaceregexp file="${release.id}/etc/project.properties" match="${project.name}_version=(.*)" 
      replace="${project.name}_version=${full.version}" flags="gi"/>
  </target>

  <target name="packageSrc" depends="setup" description="Package source tree">
    <tar destfile="${dist}/${release.id}-src.tar.gz" basedir="${release.id}" compression="gzip"/>
    <zip destfile="${dist}/${release.id}-src.zip" basedir="${release.id}" />
  </target>

  <target name="compile" depends="setup" description="compile">
    <exec executable="${maven.exe}" dir="${release.id}" output="build-all.log">
      <arg line="-Dmaven.test.skip=true -Dmaven.itest.skip=true build-all"/>
    </exec>
  </target>

  <target name="packageBinaries" depends="compile" description="Package binaries">
    <tar destfile="${dist}/${release.id}.tar.gz" basedir="${release.id}/bin" compression="gzip"/>
    <zip destfile="${dist}/${release.id}.zip" basedir="${release.id}/bin" />
  </target>

  <target name="createChecksum" description="create checksum using MD5">
    <checksum>
      <fileset dir="${dist}">
        <include name="*"/>
      </fileset>
    </checksum>
  </target>

  <available file="${release.dir}" type="dir" property="running.locally"/>
  <target name="publish" depends="publishLocal, publishRemote" />
  <target name="cleanup" depends="cleanupLocal, cleanupRemote"/>

  <target name="publishLocal" if="running.locally" description="Publish to a local directory">
    <mkdir dir="${version.dir}" />
    <copy todir="${version.dir}" >
      <fileset dir="${dist}"/>
    </copy>
  </target>

  <target name="publishRemote" unless="running.locally" description="Publish to a remote directory">
    <sshexec host="${remote.host}"  username="${user.name}" command="mkdir ${version.dir }" />
    <scp todir="${remote.host}:${version.dir}" >
      <fileset dir="${dist}"/>
    </scp>
  </target>

  <!-- List the files and delete all but the latest 7 -->
  <target name="cleanupLocal" if="running.locally" description="Cleanup local unstable builds directory">
    <exec executable="ls" dir="${release.dir}" output="deleteList.txt">
      <arg line="-t"/>
    </exec>
    <move file="deleteList.txt" tofile="deletedList.txt">
      <filterchain>
        <headfilter lines="-1" skip="3" />
      </filterchain>
    </move>
    <delete includeEmptyDirs="true">
      <fileset dir="${release.dir}" includesfile="deletedList.txt"/>
    </delete>
    <delete>
      <fileset dir="${basedir}" includes="deletedList.txt"/>
    </delete>
  </target>

  <!-- (Supposed to) List the files and delete all but the latest 7 -->
  <!-- How do I delete files remotely ? -->
  <target name="cleanupRemote" unless="running.locally" description="Cleanup remote unstable builds directory">
    <sshexec host="${remote.host}" command="ls -t ${release.dir}" output="deleteList.txt" />
  </target>

</project>


Reply via email to