summaryrefslogtreecommitdiffstats
path: root/java-allocation-instrumenter/build.xml
blob: 1a2a001bee8066fe481d223102ab24446ee73f3c (plain)
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
<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>