build.xml 8.97 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

Lukáš Marek's avatar
Lukáš Marek committed
44 45 46 47 48 49 50
	<target name="compile-agent-java" depends="compile-dynamicbypass">
		<javac srcdir="${src.agent.java}" destdir="${bin}" debug="true" includeAntRuntime="false">
			<classpath refid="buildpath" />
		</javac>
	</target>

	<target name="compile-agent-c">
51
		<exec executable="make" dir="${src.agent.c}/javahome" />
Lukáš Marek's avatar
Lukáš Marek committed
52
		<exec executable="make" dir="${src.agent.c}" />
53 54 55 56
	</target>

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

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

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

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

Lukáš Marek's avatar
Lukáš Marek committed
78
	<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
79

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

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

Lukáš Marek's avatar
Lukáš Marek committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
	<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" />

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

			<manifest>
				<attribute name="Premain-Class" value="ch.usi.dag.dislagent.DiSLAgent" />
				<attribute name="Can-Redefine-Classes" value="true" />
				<attribute name="DiSL-Version" value="${disl.version}" />
			</manifest>

			<!-- include after bootstrap class -->
			<fileset file="${build.afterbootstrap}/DynamicBypassCheck-AfterBootstrap.class" />
		</jar>

		<!-- delete dir with after bootstrap class -->
		<delete dir="${build.afterbootstrap}" />
	</target>

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

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

Lukáš Marek's avatar
Lukáš Marek committed
140
	<target name="package" depends="package-dislserver,package-dislagent-java,package-reserver,package-redispatch,compile-agent-c,compile-reagent" />
141 142 143

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

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

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

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

160 161 162 163 164 165
	<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
166
	<target name="clean">
167 168 169
		<delete dir="${bin}" />
		<delete dir="${build}" />
		<delete dir="${build.thread}" />
Lukáš Marek's avatar
Lukáš Marek committed
170
		<delete dir="${build.afterbootstrap}" />
171
		<delete dir="${dist}" />
František Haas's avatar
František Haas committed
172
		<delete dir="${test}" />
173 174 175
		<exec executable="make" dir="${src.agent.c}/javahome">
			<arg value="clean" />
		</exec>
Lukáš Marek's avatar
Lukáš Marek committed
176
		<exec executable="make" dir="${src.agent.c}">
177 178
			<arg value="clean" />
		</exec>
179 180 181
		<exec executable="make" dir="${src.reagent}/javahome">
			<arg value="clean" />
		</exec>
182 183 184 185 186
		<exec executable="make" dir="${src.reagent}">
			<arg value="clean" />
		</exec>
		

Lukáš Marek's avatar
Lukáš Marek committed
187 188
	</target>

189 190 191
	<target name="javadoc" depends="package,eclipse">
		<javadoc access="public" author="true" overview="doc/overview.html" classpath="build/eclipse-dynamicbypass.jar:${asm.path}" destdir="doc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="ch.usi.dag.disl.guardcontext,ch.usi.dag.disl.staticcontext,ch.usi.dag.disl.dynamiccontext,ch.usi.dag.disl.classcontext,ch.usi.dag.disl.marker,ch.usi.dag.disl.transformer,ch.usi.dag.disl.processorcontext,ch.usi.dag.disl.annotation" source="1.7" sourcefiles="src/ch/usi/dag/disl/scope/Scope.java,src/ch/usi/dag/disl/scope/ScopeImpl.java,src/ch/usi/dag/disl/DiSL.java,src/ch/usi/dag/disl/snippet/Shadow.java" sourcepath="src-test:src-agent-java:src" splitindex="true" use="true" version="true"/>
	</target>
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208

	<property name="dist.excludes" value="
		.classpath,
		.project,
		${dist}/**,
		bin/**,
		build/**,
		src-test/**,
		run**" />

	<target name="dist-tar">
		<mkdir dir="${dist}" />
		<tar
			destfile="${dist}/disl-src-${disl.version}.tar"
			basedir="."
			excludes="${dist.excludes}" />
	</target>
209
	
210 211 212 213 214 215 216 217
	<target name="dist-zip">
		<mkdir dir="${dist}" />
		<zip
			destfile="${dist}/disl-src-${disl.version}.zip"
			basedir="."
			excludes="${dist.excludes}" />
	</target>

218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
	<!-- *** 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}"/>
František Haas's avatar
František Haas committed
234 235 236 237 238 239 240 241 242 243 244 245
		<jar jarfile="${build}/${instr.jar.name}.jar"
		     basedir="${bin}"
		     includes="${test.path}/**"
		     excludes="${test.path}/TargetClass*.class ${test.path}/MANIFEST.MF"
		     manifest="${src.test}/${test.path}/MANIFEST.MF">
		</jar>
	</target>

	<!-- unsafe for missing dependencies -->
	<target name="unsafe-package-test" description="create instrumentation package for specified test">
		<mkdir dir="${build}"/>
		<jar jarfile="${build}/disl-instr-${test.name}.jar"
246
		     basedir="${bin}"
247
		     includes="${test.path}/**"
248 249 250 251 252
		     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
253
</project>