ANT Comple and Deploy script for ITDI

From KnowWiki
Jump to: navigation, search

This script allows automatic build to be done for ITIM service profiles straight from the ITDI's Configuration Editor.

In other words, when configured as a second builder and an external tool to run a TDI project, it will help in creating a JAR file with an adapter profile suitable for an import into TIM. As a "runner" of the project it would deploy the adapter profile to TIM.

There is also a more complicated version of this build script that uses SVN to apply versioning to the ITIM service profiles.

Download

<project name="AdapterBuilder" default="packup" basedir=".">
        <description>
            Builds and deploys an ITIM RMI adapter profile
    </description>
        <xmlproperty file=".project" />
        <target name="packup" description="Builds an ITIM RMI adapter profile">
                <fileset id="adapter.files" dir="AdapterDefinitions/" includes="*" />
                <pathconvert pathsep="," property="tdiadapter.files" refid="adapter.files" />
                <!--<echo message="${tdiadapter.files}" />-->
                <mkdir dir="Runtime-${projectDescription.name}/${projectDescription.name}" />
                <copy todir="Runtime-${projectDescription.name}/${projectDescription.name}">
                        <fileset dir="AdapterDefinitions/" includes="*" />
                        <fileset dir="Runtime-${projectDescription.name}/" includes="${projectDescription.name}.xml" />
                </copy>
                <jar jarfile="Runtime-${projectDescription.name}/${projectDescription.name}.jar" basedir="Runtime-${projectDescription.name}" includes="${projectDescription.name}/*">
                </jar>
        </target>
        <target name="deploy" depends="packup" description="Deploy the profile onto an ITIM server">
                <copy file="Runtime-${projectDescription.name}/${projectDescription.name}.jar" todir="\\${server}\f$\Temp" />
                <echo message="Deploying to \\${server}..." />
                <exec executable="psexec.exe">
                        <arg value="\\${server}" />
                        <arg value="-accepteula" />
                        <arg value="cmd"/>
                        <arg value="/c" />
                        <arg value="F:\Program Files\ibm\itim\bin\win\config_remote_services.cmd" />
                        <arg value="-profile" />
                        <arg value="${projectDescription.name}" />
                        <arg value="-jar" />
                        <arg value="F:\Temp\${projectDescription.name}.jar" />
                        <arg value=">" />
                        <arg value="nul" />
                </exec>
        </target>
</project>

[edit] ITIM service profile build script with ANT, SVN and dynamic versioning

This one is a bit more complicated and relies on ant-contrib and subclipse libararies to make it all work. Put the libs into the ant-contrib subfolder.

Download

<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== 
     AdapterBuilder    
     Builds an ITIM RMI adapter profile
     by Alex Ivkin
     ====================================================================== -->
<project name="AdapterBuilder" default="packup" basedir=".">
        <description>
            Builds an ITIM RMI adapter profile
        </description>
        <xmlproperty file=".project" />
        <dirname file="${ant.file}" property="tools.base"/>
        <taskdef resource="net/sf/antcontrib/antcontrib.properties">
          <classpath>
            <pathelement location="${tools.base}/ant-contrib/ant-contrib-1.0b3.jar"/>
          </classpath>
        </taskdef>
        <target name="packup" description="Builds an ITIM RMI adapter profile">
                <fileset id="adapter.files" dir="AdapterDefinitions/" includes="*" />
                <pathconvert pathsep="," property="tdiadapter.files" refid="adapter.files" />
                <!-- get the current revision number -->
           <path id="svnant.libs.path">
                        <fileset dir="${tools.base}/ant-contrib/">
                                <include name="svnant.jar"/>
                                <include name="svnClientAdapter.jar"/>
                                <include name="svnjavahl.jar"/>
                        </fileset>
                </path>
                <!-- Load SvnAnt -->
                <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.libs.path" />
                <!--<property name="curdir" location="."/>-->
                <tstamp><format property="touch.time" pattern="EEE MMM d HH:mm:ss z yyyy" offset="-8" unit="hour"/></tstamp>
                <!--<echo>curdir ${curdir}</echo>-->
                <!-- use javahl or command line binding, svnkit="true" may hang eclipse =  javahl="false" svnkit="false"-->
                <svn>
                        <info target="${basedir}"/>
                        <wcVersion path="${basedir}" prefix="svn.version."/>
                </svn>
                <if>
                        <equals arg1="${svn.version.modified}" arg2="true" />
                        <then>
                                <echo message="The code you are building has not been committed." />
                                <echo message="Make sure to re-build once it has been committed to have the version correctly reflected in the build" />
                                <property name="tagalong" value="plus"/>
                                <property name="updatedate" value="${touch.time}"/>
                        </then>
                        <else>
                                <property name="tagalong" value=""/>
                                <property name="updatedate" value="${svn.info.lastDate}"/>
                        </else>
                </if>
                <!-- Display svn revision number-->
                <!--<echo>Revision: ${svn.info.lastRev} ${svn.info.lastDate} ${basedir} ${user.dir} ${touch.time}</echo>-->
                <mkdir dir="Runtime-${projectDescription.name}/${projectDescription.name}" />
                <copy todir="Runtime-${projectDescription.name}/${projectDescription.name}">
                        <fileset dir="AdapterDefinitions/" includes="*" />
                        <fileset dir="Runtime-${projectDescription.name}/" includes="${projectDescription.name}.xml" />
                </copy>
                <replace file="Runtime-${projectDescription.name}/${projectDescription.name}/CustomLabels.properties" token="#Revision#" value="Rev:${svn.info.lastRev}${tagalong} (${updatedate})" />
                <jar jarfile="Runtime-${projectDescription.name}/${projectDescription.name}.rev${svn.info.lastRev}${tagalong}.jar" basedir="Runtime-${projectDescription.name}" includes="${projectDescription.name}/*" />
                <delete dir="Runtime-${projectDescription.name}/${projectDescription.name}"/>
        </target>
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox