|
There comes a time at batch script writing that there are issues with version control, ... what am i saying - there are alwayS issues with revisioning and keeping track of version control, especially when working in a large team. Dilemma: execute automated SVN update prior to tool's execution to ensure team is always running the latest revision of the tool in SVN. Tool's specification: Batch script to auto-configure development's environment of the relevant hardware (i.e. irrelevant) I am using a plugin tool for ANT, called SVNant. Its relatively straight forward to implement. Directory structure /main_batch_from_svn.bat /setup_batch_with_svn_update.bat /build.xml (ant task here) /lib/ svnant.jar (must have plugins) /lib/ svnClientAdapter.jar (must have plugins) /lib/ svnjavahl.jar (must have plugins) Now, Lets make that ANT task that will do the update from SVN for us. replace SVN_LOCATION with your actual svn address Build.xml <?xml version="1.0"?> <!-- Sample build file used to retrieve svnant's sources --> <project name="autoUpdate" basedir="." default="UpdateLatest"> <!-- all properties are in build.properties --> <property name="my_svn" value="http://SVN_LOCATION/"/>
<property name="build" value="./"/> <property name="lib.dir" value="lib"/> <property name="svnant.jar" value="${lib.dir}/svnant.jar"/> <property name="svnClientAdapter.jar" value="${lib.dir}/svnClientAdapter.jar"/> <property name="svnjavahl.jar" value="${lib.dir}/svnjavahl.jar"/>
<!-- path to the svnant libraries. Usually they will be located in ANT_HOME/lib --> <path id="project.classpath"> <pathelement location="${svnjavahl.jar}" /> <pathelement location="${svnant.jar}" /> <pathelement location="${svnClientAdapter.jar}" /> </path> <!-- load the svn task --> <taskdef resource="svntask.properties" classpathref="/sinetsite/project.classpath"/> <target name="UpdateLatest"> <svn > <checkout url="${my_svn}" revision="HEAD" /> </svn> </target> </project> --------------------------------------------------------------end of file. Presuming you are using subeclipse (for Eclipse Java dev kit) of Tortoise SVN already, this system integration should be quick, easy and painless. Now, /setup_batch_with_svn_update.bat has an ANT task call. which will run the update, once this complete, the follow $$$UPDATED$$$ (HOPEFULLY) version of /main_batch_from_svn.bat is actually executed. Which is what we were trying to achieve. Your Tech Admin.
|