| <project name="AllocationInstrumenter" basedir="."> |
| <description> |
| Builds the allocation instrumenter Java agent. |
| </description> |
| <property name="src" location="java-allocation-instrumenter/src"/> |
| <property name="build" location="build"/> |
| <property name="dist" location="dist"/> |
| |
| <target name="init"> |
| <mkdir dir="${build}"/> |
| <mkdir dir="${dist}"/> |
| </target> |
| |
| <path id="AllocationInstrumenter.classpath"> |
| <fileset dir="lib"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| |
| <target name="base_compile" depends="init" description="basic compile"> |
| <javac srcdir="${src}" destdir="${build}" includeantruntime="false"> |
| <classpath refid="AllocationInstrumenter.classpath"/> |
| </javac> |
| </target> |
| |
| <target name="collect_jar" description="Minimized collection classes"> |
| <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" |
| classpath="lib/jarjar-1.0.jar" /> |
| <jarjar destfile="${dist}/collect.jar"> |
| <zipfileset src="lib/guava-r06.jar" /> |
| <keep pattern="com.google.common.collect.MapMaker"/> |
| <keep pattern="com.google.common.collect.ForwardingMap"/> |
| </jarjar> |
| </target> |
| |
| <target name="dist" depends="base_compile,collect_jar" description="result"> |
| <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" |
| classpath="lib/jarjar-1.0.jar" /> |
| <jarjar destfile="${dist}/allocation.jar"> |
| <manifest> |
| <attribute name="Boot-Class-Path" value="./allocation.jar"/> |
| <attribute name="Premain-Class" value="com.google.monitoring.runtime.instrumentation.AllocationInstrumenter"/> |
| <attribute name="Can-Redefine-Classes" value="true" /> |
| <attribute name="Can-Retransform-Classes" value="true" /> |
| <attribute name="Main-Class" value="NotSuitableAsMain" /> |
| </manifest> |
| <fileset dir="${build}"/> |
| <zipfileset src="lib/asm-4.0.jar" /> |
| <zipfileset src="lib/asm-analysis-4.0.jar" /> |
| <zipfileset src="lib/asm-commons-4.0.jar" /> |
| <zipfileset src="lib/asm-tree-4.0.jar" /> |
| <zipfileset src="lib/asm-util-4.0.jar" /> |
| <zipfileset src="lib/asm-xml-4.0.jar" /> |
| <zipfileset src="${dist}/collect.jar" /> |
| <rule pattern="org.objectweb.asm.**" result="com.google.monitoring.runtime.instrumentation.asm.@1"/> |
| <rule pattern="com.google.common.**" result="com.google.monitoring.runtime.instrumentation.common.@0"/> |
| </jarjar> |
| </target> |
| |
| <target name="clean" description="clean up" > |
| <delete dir="${build}"/> |
| <delete dir="${dist}"/> |
| </target> |
| |
| </project> |