[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Help converting build script to use TortoiseSVN

From: Zaranthos <Zaranthos_99_at_yahoo.com>
Date: 2007-08-03 18:07:57 CEST

I am trying to avoid using svnversion since TortoiseSVN should be able to do
the same thing. Maybe someone with more skills could make this build script
work with TortoiseSVN instead of svn or both (use TortoiseSVN if available
and fall back to svn if not). I know SubWCRev.exe should be able to do what
svnversion does maybe with some slight changes.

<project name="KoLmafia" default="debug" basedir=".">

        <!-- ========================================== -->
        <!-- set the global properties for this build -->
        <!-- ========================================== -->

        <property name="root" location="."/>
        <property name="src" location="src"/>
        <property name="lib" location="lib"/>
        <property name="build" location="build"/>
        <property name="dist" location="dist"/>
        <property name="docs" location="${dist}/docs"/>

        <property name="jarfile" location="${dist}/${ant.project.name}.jar"/>
        <property name="tarfile" location="${dist}/${ant.project.name}.tar.gz"/>
        <property name="main" value="net.sourceforge.kolmafia.KoLmafia"/>

        <!-- ========================================== -->
        <!-- create directories used by other targets -->
        <!-- ========================================== -->

        <target name="init">

                <tstamp/>
                <mkdir dir="${build}"/>
                <mkdir dir="${dist}"/>

        </target>

        <!-- ================================== -->
        <!-- update files from the repository -->
        <!-- ================================== -->

        <target name="update" unless="revision">

                <exec executable="svn" failifexecutionfails="false">
                        <arg value="update"/>
                        <arg value="${root}"/>
                </exec>

                <antcall target="version"/>

        </target>

        <!-- ================================== -->
        <!-- update files from the repository -->
        <!-- ================================== -->

        <target name="version" unless="revision">

                <property name="version" value="11.2"/>

                <exec executable="svnversion" outputproperty="revision"
failifexecutionfails="false">
                        <arg value="-n"/>
                        <arg value="${root}"/>
                </exec>

                <property name="revision" value="0"/>
                <echo message="Current revision: ${revision}"/>

        </target>

        <!-- ======================= -->
        <!-- clean up object files -->
        <!-- ======================= -->

        <target name="clean">

                <delete dir="${build}"/>
                <delete dir="${docs}"/>

                <delete>
                        <fileset dir="${dist}">
                                <include name="${ant.project.name}*"/>
                        </fileset>
                </delete>

        </target>

        <!-- ====================== -->
        <!-- generate class files -->
        <!-- ====================== -->

        <target name="build" depends="init">

                <javac source="1.4" srcdir="${src}" destdir="${build}"
classpath="${lib}/*.jar"
                        debug="on" debuglevel="lines,vars,source" deprecation="on" nowarn="on"/>

                <copy todir="${build}" preservelastmodified="true">
                        <fileset dir="${src}">
                                <exclude name="**/*.java"/>
                        </fileset>
                </copy>

                <copy todir="${build}" preservelastmodified="true">
                        <fileset dir="${lib}"/>
                </copy>

        </target>

        <!-- =========================== -->
        <!-- generate the standard JAR -->
        <!-- =========================== -->

        <target name="createjar" depends="build">

                <jar destfile="${jarfile}" basedir="${build}" update="true" index="yes">
                        <manifest>
                                <attribute name="Main-Class" value="${main}"/>
                        </manifest>
                </jar>

        </target>

        <!-- ================================ -->
        <!-- generate the alpha testing JAR -->
        <!-- ================================ -->

        <target name="debug" depends="version,clean">

                <replace file="${src}/net/sourceforge/kolmafia/KoLConstants.java"
                        token="v${version}" value="v${version}, r${revision}"/>

                <antcall target="createjar"/>

                <replace file="${src}/net/sourceforge/kolmafia/KoLConstants.java"
                        token="v${version}, r${revision}" value="v${version}"/>

        </target>

        <!-- ============================ -->
        <!-- generate a daily build JAR -->
        <!-- ============================ -->

        <target name="daily" depends="update,clean">

                <replace file="${src}/net/sourceforge/kolmafia/KoLConstants.java"
                        token="v${version}" value="v${version}, r${revision}"/>

                <antcall target="build"/>

                <jar destfile="${dist}/${ant.project.name}-${revision}.jar"
basedir="${build}" update="true" index="yes">
                        <manifest>
                                <attribute name="Main-Class" value="${main}"/>
                        </manifest>
                </jar>

                <replace file="${src}/net/sourceforge/kolmafia/KoLConstants.java"
                        token="v${version}, r${revision}" value="v${version}"/>

        </target>

        <!-- =========================== -->
        <!-- generate the distribution -->
        <!-- =========================== -->

        <target name="dist" depends="update,clean,createjar">

                <tar destfile="${tarfile}" basedir="${root}" compression="gzip">
                        <exclude name="build/**"/>
                        <exclude name="dist/**"/>
                </tar>

        </target>

        <!-- ==================================================== -->
        <!-- runs program with all needed libraries in the path -->
        <!-- ==================================================== -->

        <target name="exec" depends="createjar">
                <java fork="true" jar="${jarfile}" dir="${dist}"/>
        </target>

        <!-- ======================================= -->
        <!-- generate the javadocs from sourcecode -->
        <!-- ======================================= -->

        <target name="javadoc" depends="init">

                <mkdir dir="${docs}"/>
                <mkdir dir="${docs}/api"/>

                <javadoc sourcepath="${src}" destdir="${docs}" packagenames="*">
                        <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>

                        <classpath>
                                <pathelement location="${lib}"/>
                                <pathelement location="${build}"/>
                        </classpath>

                </javadoc>

        </target>

</project>

-- 
View this message in context: http://www.nabble.com/Help-converting-build-script-to-use-TortoiseSVN-tf4213390.html#a11986209
Sent from the tortoisesvn - users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: users-help@tortoisesvn.tigris.org
Received on Fri Aug 3 18:06:16 2007

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.