-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
101 lines (89 loc) · 4.31 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="new-relic-cassandra" default="dist" basedir=".">
<property name="version" value="1.2.0" />
<property name="filename" value="newrelic_cassandra_plugin-${version}"/>
<property name="jarfile" value="plugin.jar" />
<property name="tarfile" value="${filename}.tar.gz" />
<property name="build.dir" value="build" />
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.jar.dir" value="${build.dir}/jar"/>
<property name="build.tar.dir" value="${build.dir}/tar"/>
<property name="build.tar.src.dir" value="${build.tar.dir}/${filename}"/>
<property name="src.dir" value="src" />
<property name="lib.dir" value="lib" />
<property name="conf.dir" value="config" />
<property name="dist.dir" location="dist" />
<property name="test.dir" location="test" />
<property name="test.lib.dir" location="test/lib" />
<property name="sdk.jar" value="${lib.dir}/metrics_publish-2.0.1.jar" />
<path id="classpath">
<pathelement location="${sdk.jar}" />
</path>
<target name="clean">
<echo>Cleaning project...</echo>
<delete dir="${build.dir}" />
<echo>Done.</echo>
</target>
<target name="init" depends="clean">
<echo>Creating directory: ${build.dir}</echo>
<mkdir dir="${build.dir}" />
</target>
<target name="compile" depends="init">
<!-- Compile the java code -->
<echo>Building project...</echo>
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="." destdir="${build.classes.dir}" target="1.8" source="1.8">
<classpath refid="classpath" />
<classpath location="${test.lib.dir}/junit-4.12.jar" />
<classpath location="${test.lib.dir}/hamcrest-core-1.3.jar" />
<classpath location="${test.lib.dir}/mockito-all-1.9.5.jar" />
</javac>
<echo>Done.</echo>
</target>
<target name="test" depends="compile">
<junit printsummary="true">
<classpath location="${test.lib.dir}/junit-4.12.jar" />
<classpath location="${test.lib.dir}/hamcrest-core-1.3.jar" />
<classpath location="${test.lib.dir}/mockito-all-1.9.5.jar" />
<classpath location="${lib.dir}/metrics_publish-2.0.1.jar" />
<classpath location="${build.classes.dir}" />
<batchtest>
<fileset dir="${test.dir}">
<include name="**/*Test*" />
</fileset>
</batchtest>
<formatter type="brief" usefile="false"/>
</junit>
</target>
<target name="jar" depends="compile" description="create a jar file for the application">
<mkdir dir="${build.jar.dir}"/>
<tstamp />
<jar destfile="${build.jar.dir}/${jarfile}">
<manifest>
<attribute name="Specification-Title" value="New Relic Cassandra" />
<attribute name="Specification-Vendor" value="New Relic, Inc." />
<attribute name="Implementation-Vendor" value="Tyler Hoersch" />
<attribute name="Built-Date" value="${TODAY}" />
<attribute name="Specification-Version" value="${version}" />
<attribute name="Implementation-Version" value="${version} ${TODAY}" />
<attribute name="Main-Class" value="com.tylerhoersch.nr.cassandra.Main" />
</manifest>
<fileset dir="${build.classes.dir}"/>
<zipfileset src="${sdk.jar}" />
</jar>
</target>
<target name="dist" depends="jar" description="create a downloadable file">
<mkdir dir="${build.tar.src.dir}" />
<copy file="${conf.dir}/plugin.template.json" todir="${build.tar.src.dir}/config" />
<copy file="${conf.dir}/newrelic.template.json" todir="${build.tar.src.dir}/config" />
<copy file="LICENSE" todir="${build.tar.src.dir}" />
<copy file="README.md" todir="${build.tar.src.dir}" />
<copy todir="${build.tar.src.dir}/config">
<fileset dir="${conf.dir}" />
</copy>
<copy file="${build.jar.dir}/${jarfile}" todir="${build.tar.src.dir}" />
<tar compression="gzip" destfile="${dist.dir}/${tarfile}">
<tarfileset dir="${build.tar.dir}" />
</tar>
</target>
</project>