build.xml 6.95 KB
Newer Older
1
<project name="disl" default="prepare-all" basedir=".">
Lukáš Marek's avatar
Lukáš Marek committed
2

3 4
	<property file="build.properties" />
	<property file="disl.version" />
Lukáš Marek's avatar
Lukáš Marek committed
5 6

	<path id="buildpath">
7 8
		<pathelement location="${asm.path}" />
		<pathelement location="${bin}" />
Lukáš Marek's avatar
Lukáš Marek committed
9 10
	</path>

11 12
	<!-- it automatically compiles all other necessary stuff :) -->
	<target name="compile-tlvinserter">
13
		<mkdir dir="${bin}" />
14
		<javac srcdir="${src.disl}" includes="ch/usi/dag/disl/utilinstr/tlvinserter/" destdir="${bin}" debug="true" includeAntRuntime="false">
15
			<classpath refid="buildpath" />
Lukáš Marek's avatar
Lukáš Marek committed
16
		</javac>
Lukáš Marek's avatar
Lukáš Marek committed
17 18
	</target>

19
	<target name="prepare-extendedthread" depends="compile-tlvinserter">
20
		<mkdir dir="bin-thread/java/lang" />
21
		<java fork="true" classname="ch.usi.dag.disl.utilinstr.tlvinserter.ExtendThread">
22
			<classpath refid="buildpath" />
23
		</java>
24 25 26
		<mkdir dir="${build}" />
		<jar basedir="bin-thread" destfile="${extendedthread.path}" />
		<delete dir="bin-thread" />
Lukáš Marek's avatar
Lukáš Marek committed
27 28
	</target>

29
	<target name="compile-dynamicbypass" depends="prepare-extendedthread">
30
		<mkdir dir="${bin}" />
31
		<javac srcdir="${src.dynbypass}" destdir="${bin}" debug="true" includeAntRuntime="false">
32
			<classpath refid="buildpath" />
33
			<compilerarg value="-Xbootclasspath/p:${extendedthread.path}" />
Lukáš Marek's avatar
Lukáš Marek committed
34
		</javac>
35
		<delete file="${extendedthread.path}" />
Lukáš Marek's avatar
Lukáš Marek committed
36 37
	</target>

38 39
	<target name="compile-disl" depends="compile-dynamicbypass">
		<javac srcdir="${src.disl}" destdir="${bin}" debug="true" includeAntRuntime="false">
40
			<classpath refid="buildpath" />
Lukáš Marek's avatar
Lukáš Marek committed
41 42
		</javac>
	</target>
Lukáš Marek's avatar
Lukáš Marek committed
43

44 45
	<target name="compile-agent-java" depends="compile-dynamicbypass">
		<javac srcdir="${src.agent.java}" destdir="${bin}" debug="true" includeAntRuntime="false">
46
			<classpath refid="buildpath" />
47 48 49
		</javac>
	</target>

50 51 52 53 54 55
	<target name="compile-agent-c">
		<exec executable="make" dir="${src.agent.c}" />
	</target>

	<target name="compile-reserver">
		<javac srcdir="${src.reserver}" destdir="${bin}" debug="true" includeAntRuntime="false">
56 57 58 59
			<classpath refid="buildpath" />
		</javac>
	</target>

60 61
	<target name="compile-redispatch">
		<javac srcdir="${src.redispatch}" destdir="${bin}" debug="true" includeAntRuntime="false">
62 63 64 65
			<classpath refid="buildpath" />
		</javac>
	</target>

66 67 68 69 70
	<target name="compile-reagent">
		<exec executable="make" dir="${src.reagent}" />
	</target>

	<target name="compile-test" depends="compile-disl,compile-reserver,compile-redispatch">
71
		<javac srcdir="${src.test}" destdir="bin" debug="true" includeAntRuntime="false">
72
			<classpath refid="buildpath" />
73 74 75
		</javac>
	</target>

76
	<target name="compile" depends="compile-disl,compile-agent-java,compile-agent-c,compile-test,compile-reserver,compile-redispatch" />
Lukáš Marek's avatar
Lukáš Marek committed
77

78
	<target name="package-dislserver" depends="compile-disl">
79
		<jar basedir="${bin}" destfile="${build}/disl-server.jar"
80 81
			includes="ch/usi/dag/disl/**,ch/usi/dag/dislserver/**"
			excludes="ch/usi/dag/disl/test/**,ch/usi/dag/disl/testtools/**">
82

83
			<manifest>
84
				<attribute name="Class-Path" value="${asm.lib}" />
85
				<attribute name="Main-Class" value="ch.usi.dag.dislserver.DiSLServer" />
86
				<attribute name="DiSL-Version" value="${disl.version}" />
87 88 89 90
			</manifest>
		</jar>
	</target>

91 92 93 94 95 96 97 98 99 100 101 102
	<target name="compile-dynamicbypass-afterbootstrap">
		<mkdir dir="${build.afterbootstrap}" />
		<javac srcdir="${src.dynbypass.act}" destdir="${build.afterbootstrap}" debug="true" includeAntRuntime="false">
			<classpath refid="buildpath" />
		</javac>
	</target>

	<target name="package-dislagent-java" depends="compile-agent-java,compile-dynamicbypass,compile-dynamicbypass-afterbootstrap">

		<!-- rename after bootstrap class -->
		<move file="${build.afterbootstrap}/ch/usi/dag/disl/dynamicbypass/DynamicBypassCheck.class"
			tofile="${build.afterbootstrap}/DynamicBypassCheck-AfterBootstrap.class" />
103

104
		<jar basedir="${bin}" destfile="${build}/disl-agent.jar"
105
			includes="ch/usi/dag/dislagent/**,ch/usi/dag/disl/dynamicbypass/**">
106

107
			<manifest>
108
				<attribute name="Premain-Class" value="ch.usi.dag.dislagent.DiSLAgent" />
109
				<attribute name="Can-Redefine-Classes" value="true" />
110
				<attribute name="DiSL-Version" value="${disl.version}" />
Lukáš Marek's avatar
Lukáš Marek committed
111
			</manifest>
112 113 114

			<!-- include after bootstrap class -->
			<fileset file="${build.afterbootstrap}/DynamicBypassCheck-AfterBootstrap.class" />
Lukáš Marek's avatar
Lukáš Marek committed
115
		</jar>
116 117 118

		<!-- delete dir with after bootstrap class -->
		<delete dir="${build.afterbootstrap}" />
Lukáš Marek's avatar
Lukáš Marek committed
119
	</target>
120

121 122
	<target name="package-reserver" depends="compile-reserver">
		<jar basedir="${bin}" destfile="${build}/dislre-server.jar"
123 124
			includes="ch/usi/dag/dislreserver/**">
			<manifest>
125
				<attribute name="Class-Path" value="${asm.lib}" />
126
				<attribute name="Main-Class" value="ch.usi.dag.dislreserver.DiSLREServer" />
127
				<attribute name="DiSL-Version" value="${disl.version}" />
128 129 130 131
			</manifest>
		</jar>
	</target>

132 133
	<target name="package-redispatch" depends="compile-redispatch">
		<jar basedir="${bin}" destfile="${build}/dislre-dispatch.jar"
134 135 136 137
			includes="ch/usi/dag/dislre/**">
		</jar>
	</target>

138
	<target name="package" depends="package-dislserver,package-dislagent-java,package-reserver,package-redispatch,compile-agent-c,compile-reagent" />
139 140 141

	<target name="eclipse-agent" description="creates simple agent jar file for eclipse">
		<mkdir dir="build" />
142 143
		<jar jarfile="build/eclipse-agent.jar">
			<manifest>
144
				<attribute name="Premain-Class" value="ch.usi.dag.disl.testtools.agent.Agent" />
145 146 147
			</manifest>
		</jar>
	</target>
148 149 150

	<target name="eclipse-dynamicbypass" depends="compile-dynamicbypass"
		description="creates support library for DiSL development under eclipse">
151

152 153
		<jar basedir="${bin}" destfile="${build}/eclipse-dynamicbypass.jar"
			includes="ch/usi/dag/disl/dynamicbypass/" />
154
	</target>
155 156

	<target name="eclipse" depends="eclipse-dynamicbypass,eclipse-agent" />
Lukáš Marek's avatar
Lukáš Marek committed
157

158 159 160 161 162 163
	<target name="copy-asm">
		<copy file="${asm.path}" tofile="${build}/${asm.lib}" />
	</target>

	<target name="prepare-all" depends="package,eclipse,compile-test,copy-asm" />

Lukáš Marek's avatar
Lukáš Marek committed
164
	<target name="clean">
165 166 167 168
		<delete dir="${bin}" />
		<delete dir="${build}" />
		<delete dir="${build.thread}" />
		<delete dir="${build.afterbootstrap}" />
169 170 171 172 173 174 175 176
		<exec executable="make" dir="${src.agent.c}">
			<arg value="clean" />
		</exec>
		<exec executable="make" dir="${src.reagent}">
			<arg value="clean" />
		</exec>
		

Lukáš Marek's avatar
Lukáš Marek committed
177 178
	</target>

179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
	<!-- *** test instrumentaion package *** -->

	<target name="check-test-property">
		<condition property="test.set">
			<isset property="test.name"/>
		</condition>
	</target>

	<target name="report-missing-property" depends="check-test-property" unless="test.set">
		<fail message="Property test.name is not set. Set it using -Dtest.name=value" />
	</target>

	<property name="test.path" value="ch/usi/dag/disl/test/${test.name}"/>

	<target name="package-test" depends="report-missing-property,prepare-all" description="create instrumentation package for specified test">
		<mkdir dir="${build}"/>
		<jar jarfile="${build}/${instr.jar.name}"
		     basedir="${bin}"
197
		     includes="${test.path}/**"
198 199 200 201 202
		     excludes="${test.path}/TargetClass*.class ${test.path}/MANIFEST.MF"
		     manifest="${src.test}/${test.path}/MANIFEST.MF">
		</jar>
	</target>

Lukáš Marek's avatar
Lukáš Marek committed
203
</project>