Source

mrt-storeCloud / store-demo / make-repository.xml

Full commit
<?xml version="1.0" encoding="UTF-8"?>
<!-- Builds the CDL Framework --><!-- Assumes: Java source is at '../src' --><!-- Builds:  Java classes at '../classes' --><!-- Builds:  Jar at '../lib' --><!--  -->
<project basedir="." default="create" name="buildstore">
    <target name="-init">
        <echo message="-init entered"/>
        <available file="../mrt.local.properties" property="local.present"/>
    </target>
    
    <target name="-initProp">
        <echo message="-initProp entered"/>
        <property file="make-repository.properties"/>
    </target>

    <target name="create" depends="-init">
        <antcall target="-if-repository"/>
    </target>

    <target name="-if-repository" if="local.present">
        <property file="../mrt.local.properties"/>
        <property file="make-repository.properties"/>
        <echo message="local.properties exists.storage.node=${exists.storage.node}"/>
        <echo message="local.properties exists.can.node=${exists.can.node}"/>
        <antcall target="handle-repository"/>
    </target>

    <target name="handle-repository"
        depends="-set-conditions, -delete-can, -delete-store, -test-available, -build-store, -build-can, -build-can-conf">
        <echo message="handle-repository entered"/>
    </target>

    <target name="-set-conditions">
        <echo message="exists.storage.node=${exists.storage.node}"/>
        <echo message="exists.can.node=${exists.can.node}"/>
        <condition property="delete.storage">
            <equals arg1="${exists.storage.node}" arg2="delete" />
        </condition>
        <condition property="delete.can">
            <equals arg1="${exists.can.node}" arg2="delete" />
        </condition>
        <echo message="delete.storage=${delete.storage}"/>
        <echo message="delete.can=${delete.can}"/>
    </target>

    <target name="-delete-can" if="delete.can">
        <echo message="delete-can entered"/>
        <delete dir="${can.node}"/>
    </target>

    <target name="-delete-store" if="delete.can">
        <echo message="delete-store entered"/>
        <delete dir="${storage.node}"/>
    </target>

    <target name="-test-available">
        <available file="${storage.node}" property="storage.present"/>
        <available file="${can.node}" property="can.present"/>
        <echo message="test-available entered"/>
        <echo message="storage.present=${storage.present}"/>
        <echo message="can.present=${can.present}"/>
    </target>

    <target name="-build-store" unless="storage.present">
        <echo message="build-store entered"/>
        <mkdir dir="${storage.node}"/>
        <copy todir="${storage.node}">
            <fileset dir="make/store"/>
        </copy>
        <echo file="${storage.node}/store-info.txt">serviceScheme: Store/1.0${line.separator}name: ${store.info.name}${line.separator}identifier: ${store.info.identifier}${line.separator}description: ${store.info.description}${line.separator}supportURI: ${store.info.supportURI}${line.separator}baseURI: ${store.info.baseURI}${line.separator}</echo>
        <echo file="${storage.node}/nodes.txt" message="${can.node}${line.separator}" />
    </target>

    <target name="-build-can" unless="can.present">
        <echo message="build-can entered"/>
        <mkdir dir="${can.node}"/>
        <copy todir="${can.node}">
            <fileset dir="make/node"/>
        </copy>
        <mkdir dir="${can.node}/log"/>
        <mkdir dir="${can.node}/store"/>
        <echo file="${can.node}/can-info.txt" message="identifier: ${can.info.identifier}${line.separator}" append="yes"/>
    </target>

    <target name="-build-can-conf">
        <echo message="-build-can-conf entered"/>
        <delete dir="../store-conf/properties"></delete>
        <mkdir dir="../store-conf/properties"></mkdir>
        <copy todir="../store-conf/properties">
            <fileset dir="make/store-properties"/>
        </copy>
        <echo file="../store-conf/properties/TStorageStore.properties" message="${line.separator}StorageService=${storage.node}" append="yes"/>
    </target>

    <target name="-make-testout" depends="-initProp">
        <echo message="-make-testout entered"/>
        <delete dir="${testout}"/>
        <mkdir dir="${testout}/out"/>
        <antcall target="-setup-cmdline"/>
    </target>

    <target name="test-cmdline-windows" depends="-initProp">
        <property file="../mrt.local.properties"/>
        <echo message="****test-cmdline-windows entered"/>
        <property name="cmdtest" value="${testout}/cmdline"/>
        <mkdir dir="${testout}/out"/>
        <delete file="${cmdtest}/cmds.bat"/>
        <copy file="make/cmdline/cmds.bat" todir="${cmdtest}"/>
        <copy file="storecmd.jar" todir="${cmdtest}"/>
        <replace file="${cmdtest}/cmds.bat" token="xxnodexx" value="${can.info.identifier}"/>
        <exec dir="${cmdtest}" executable="cmd.exe">
            <arg line="/K cmds.bat"/>
        </exec>
    </target>

    <target name="test-cmdline-node-windows" depends="-initProp">
        <property file="../mrt.local.properties"/>
        <property name="cmdtest" value="${testout}/cmdline"/>
        <delete file="${cmdtest}/cmds-node.bat"/>
        <copy file="make/cmdline/cmds-node.bat" todir="${cmdtest}"/>
        <replace file="${cmdtest}/cmds-node.bat" token="xxnodexx" value="${can.info.identifier}"/>
        <exec dir="${cmdtest}" executable="cmd.exe">
            <arg line="/K cmds-node.bat"/>
        </exec>
    </target>

    <target name="test-cmdline-unix" depends="-setup-cmdline">
        <property file="../mrt.local.properties"/>
        <property name="cmdtest" value="${testout}/cmdline"/>
        <delete file="${cmdtest}/storecmd.jar"/>
        <copy file="storecmd.jar" todir="${cmdtest}"/>
        <delete file="${cmdtest}/cmds.sh"/>
        <copy file="make/cmdline/cmds.sh" todir="${cmdtest}"/>
        <replace file="${cmdtest}/cmds.sh" token="xxnodexx" value="${can.info.identifier}"/>
        <copy file="make/cmdline/store" todir="${cmdtest}"/>
        <chmod file="${cmdtest}/cmds.sh" perm="a+x"/>
        <chmod file="${cmdtest}/store" perm="a+x"/>
	<mkdir dir="${testout}/out"/>
        <exec dir="${cmdtest}" executable="./cmds.sh"></exec>
    </target>

    <target name="-setup-cmdline" depends="-initProp">
        <property name="cmdtest" value="${testout}/cmdline"/>
        <mkdir dir="${cmdtest}"/>
    </target>
</project>