build.xml 3.52 KB
Newer Older
Vít Kabele's avatar
Vít Kabele committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
<project name="disl-server" default="build" basedir=".">

    <!--
     Import required property files.
     -->
    <property file="../common.properties"/>
    <property file="build.properties" />
    <property file="../disl.version.properties" />

    <!--
    Initialize the build directory
    -->
    <target name="init">
        <mkdir dir="${build.shvm}" />
    </target>

    <!--
    Dependency class paths
    -->
    <path id="asm.classpath">
        <fileset dir="../${lib.disl.dir}" includes="asm*.jar" id="asm.fileset"/>
    </path>
    <path id="util.classpath">
        <pathelement location="../${build.util}"/>
    </path>

    <path id="protobuf.classpath">
        <fileset dir="../${lib.disl.dir}" includes="protobuf*.jar"/>
    </path>

    <!--
    Refer to the parent targets
    -->
    <target name="compile-util">
        <ant antfile="../build.xml" target="compile-util" usenativebasedir="true" />
    </target>

    <target name="compile-shvm-dispatch">
        <ant antfile="../build.xml" target="compile-shvm-dispatch" usenativebasedir="true" />
    </target>

    <target name="build-shvm-dispatch">
        <ant antfile="../build.xml" target="build-shvm-dispatch" usenativebasedir="true" />
    </target>

    <!-- SHVM Server -->
    <target name="compile" depends="compile-util,compile-shvm-dispatch,init">
        <javac destdir="${build.shvm}" debug="true">

            <src path="src/src-dislreserver" />
            <src path="src/src-msg-analyze" />
            <src path="src/src-msg-analyze-mtdispatch" />
            <src path="src/src-msg-classinfo" />
            <src path="src/src-msg-close" />
            <src path="src/src-msg-instr" />
            <src path="src/src-msg-newclass" />
            <src path="src/src-msg-objfree" />
            <src path="src/src-msg-reganalysis" />
            <src path="src/src-msg-stringinfo" />
            <src path="src/src-msg-threadend" />
            <src path="src/src-msg-threadinfo" />
            <src path="src/src-remoteanalysis" />
            <src path="src/src-reqdispatch" />
            <src path="src/src-shadow" />
            <src path="src/src-util" />

            <classpath>
                <path path="../${src.shvm.prefix}/${build.shvm}" />
                <path refid="util.classpath"/>
                <path refid="asm.classpath" />
                <path refid="protobuf.classpath"/>
            </classpath>
        </javac>
    </target>

    <!-- Get ASM libs from ASM class path. -->
    <pathconvert pathsep=" " property="asm.libs" refid="asm.classpath">
        <mapper type="flatten"/>
    </pathconvert>

    <!-- Get ProtoBuf Java libs from ProtoBuf class path. -->
    <pathconvert pathsep=" " property="protobuf.libs" refid="protobuf.classpath">
        <mapper type="flatten"/>
    </pathconvert>

    <target name="build" depends="compile, build-shvm-dispatch">

        <jar destfile="${out.lib}/${shvm.lib}">
            <manifest>
                <attribute name="Class-Path" value="${asm.libs} ${protobuf.libs}"/>
                <attribute name="Main-Class" value="ch.usi.dag.dislreserver.DiSLREServer"/>
                <attribute name="DiSL-Version" value="${disl.version}"/>
            </manifest>

            <service type="javax.annotation.processing.Processor" provider="ch.usi.dag.disl.DislClassFinder"/>

            <fileset dir="${build.shvm}" />
            <fileset dir="../${build.util}"/>
        </jar>
    </target>

    <!--
    Clean the build directory
    -->
    <target name="clean">
        <delete dir="output" />
    </target>

</project>