Subversion Repositories DevTools

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<project name="jboss-config-jms" default="install" basedir=".">

        <description>
        Configures JBoss with MASS server configuration(s) as required.

        Prerequisites:
                - JBoss version 3.2.3 must be installed.
                - The JBOSS_HOME environment variable must be set to the base directory
                  where JBoss is installed.
                - The ANTSHIELD Ant plugin must be installed in the %ANT_HOME%\lib directory.
                - The JANTS Ant plugin must be installed in the %ANT_HOME%\lib directory.
        </description>


        <taskdef resource="antshield.properties"/>
        <taskdef resource="jats.properties"/>

        <!-- =================================================================== -->
        <!--  GLOBAL PROPERTIES                                                  -->
        <!-- =================================================================== -->
        <property file="${user.home}/.ant.properties" />
        <property name="env" environment="env"         value="not used"/>
        <property name="jboss.cfg"                     value="project"/>


        <!--
          -  Pulls in project dependencies.
          -->
        <!-- <target name="sandbox"
                description="Prepare the project dependency 'sandbox'.">
                <echo message="Prepare the sandbox."/>
                <ant antfile="depends.xml"/>
        </target> -->


        <!--
          -  Cleans derived objects.
          -->
        <target name="clean">

                <delete dir="${basedir}/build"/>
                <delete dir="${basedir}/interface"/>
                <delete dir="${basedir}/pkg"/>

        </target>


        <!--
          -  Checks the JBoss environment.
          -
          -  This target verifies that the compatible version of JBoss is installed
          -  on the build machine. This latest release supports JBoss 3.2.3 only.
          -->
        <target name="-check-environment" depends="">

                <property name="jboss.home" value="${env.JBOSS_HOME}"/>
                <fail unless="jboss.home">
                        Environment variable 'JBOSS_HOME' is not set.
                </fail>
                <available property="jboss.present" file="${env.JBOSS_HOME}/bin/run.jar"/>
                <fail unless="jboss.present">
                        Environment variable JBOSS_HOME is set but it does
                    not seem to point to the right directory. The file
                        'run.jar' must be available at ${env.JBOSS_HOME}/bin"
                </fail>

                <property name="jats.home" value="${env.JATS_HOME}"/>
                <fail unless="jats.home">
                        Environment variable 'JATS_HOME' is not set.
                </fail>

                <!-- Check JBoss version - do not proceed unless compatible -->
                <mkdir dir="tmp"/>
                <unjar src="${env.JBOSS_HOME}/bin/run.jar" dest="tmp">
                        <patternset includes="META-INF/MANIFEST.MF"/>
                </unjar>
                <loadfile property="jboss.manifest" srcfile="tmp/META-INF/MANIFEST.MF"/>
                <delete dir="tmp"/>

                <condition property="jboss.active.version" value="3.2.3">
                        <contains string="${jboss.manifest}" substring="Implementation-Version: 3.2.3"/>
                </condition>

                <fail unless="jboss.active.version">
                        Incompatible version of JBoss detected. This configuration script is only
                        compatible with JBoss 3.2.3
                </fail>
        </target>

        <!--
          -  Packages the release
          -
          -  This target looks for the installed JDBC drivers, and flags their existence.
          -  This package should be dependent on the JDBC drivers, because it contains
          -  them within the release.
          -->
        <target name    ="package"
                depends ="-check-environment">

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

                <property name="jboss.cfg.directory" location="${basedir}/build/${jboss.cfg}.mas"/>
                <property name="jboss.default.directory" location="${env.JBOSS_HOME}/server/default"/>

                <available file="${jboss.cfg.directory}" type="dir" property="jboss.cfg.present"/>
                <fail if="jboss.cfg.present" message="JBoss configuration for ${jboss.cfg.directory} already exists."/>

                <mkdir dir="${jboss.cfg.directory}"/>
                <mkdir dir="${jboss.cfg.directory}/conf"/>
                <mkdir dir="${jboss.cfg.directory}/deploy"/>
                <mkdir dir="${jboss.cfg.directory}/lib"/>

                <!-- Prepare configuration -->
                <copy todir="${jboss.cfg.directory}/conf">
                        <fileset dir="${basedir}/conf"/>
                </copy>

                <copy todir="${jboss.cfg.directory}/deploy">
                        <fileset dir="${basedir}/deploy"/>
                </copy>
                
                <copy todir="${jboss.cfg.directory}/lib">
                        <fileset dir="${basedir}/lib"/>
                </copy>

        </target>

        <!--
          -  Formally releases package 'jboss_config'
          -->
        <target name="release"
                description="Formally release this package as a patch release.">
                <antshield packageName="${ant.project.name}"/>
                <antcall target="-label"/>
        </target>


        <!--
          -  Undoes a failed release
          -->
        <target name="undo"
                description="Remove artifacts from a partially complete build.">
                <antshield packageName="${ant.project.name}" type="minor"/>
                <!-- Remove any label for the given version -->
                <ccrmlabel labelname="${ant.project.name}_${antshield.release}"/>
                <!-- Remove any network drive mapping, and remove any view corresponding to the label -->
                <ccrmview viewname="${user.name}_jats_build_${ant.project.name}_${antshield.release}" unmap="${jants.map.drive}"/>
        </target>


        <!--
          -  Creates a label, a view based on the label, and invokes a build in the new view.
          -->
        <target name="-label">

                <cclabel package       = "${ant.project.name}"
                                 version       = "${antshield.release}"
                                 findCheckouts = "true"
                                 mkview        = "true"
                                 mapview       = "${jants.map.drive}"
                                 labelname     = "jants.build.label"
                                 viewname      = "jants.build.view.name"
                                 viewpath      = "jants.build.view.path"/>
                <ant antfile="build.xml" dir="${jants.build.view.path}" inheritAll="false" inheritRefs="false" target="-release">
                        <property name="jants.build.version" value="${antshield.release}"/>
                </ant>
                <cclocklabel labelname="${jants.build.label}"/>
                <ccrmview viewname="${jants.build.view.name}" unmap="${jants.map.drive}"/>

        </target>


        <!--
          -  Puts release elements in their staging location, and puts them into dpkg_archive.
          -->
        <target name="-release" depends="package">
                <!-- Clean the package directory -->
                <delete dir="pkg"/>
                <mkdir dir="pkg"/>
                <mkdir dir="pkg/pkg"/>
                <mkdir dir="pkg/scripts"/>

                <!-- Prepare the package entities -->
                <copy todir="pkg/pkg">
                        <fileset dir="${basedir}/build/project.mas"/>
                </copy>

                <copy todir="pkg/scripts">
                        <fileset dir="${basedir}/scripts" includes="*"/>
                </copy>

                <!-- And perform the dpkg release -->
                <jats package="${ant.project.name}">
                        <release version="${jants.build.version}" label="${jants.build.label}"/>
                </jats>
        </target>

</project>