forked from newrelic/newrelic_mysql_java_plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
87 lines (77 loc) · 3.89 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="newrelic_mysql_extension" default="dist" basedir=".">
<property name="version" value="2.0.0"/>
<property name="filename" value="newrelic_mysql_plugin-${version}"/>
<property name="jarfile" value="plugin.jar"/>
<property name="tarfile" value="${filename}.tar.gz"/>
<property name="build.dir" location="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="dist.dir" location="dist"/>
<property name="src.dir" location="src"/>
<property name="lib.dir" location="lib"/>
<property name="conf.dir" location="config"/>
<property name="script.dir" location="scripts"/>
<property name="platform-metrics-java" value="${lib.dir}/metrics_publish-2.0.0.jar"/>
<property name="mysql-connector" value="${lib.dir}/mysql-connector-java-5.1.24-bin.jar"/>
<path id="classpath">
<pathelement location="${platform-metrics-java}"/>
<pathelement location="${mysql-connector}"/>
</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="${src.dir}" destdir="${build.classes.dir}" target="1.6" source="1.6">
<classpath refid="classpath"/>
</javac>
<echo>Done.</echo>
</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="MySQL Plugin"/>
<attribute name="Specification-Vendor" value="New Relic, Inc."/>
<attribute name="Implementation-Vendor" value="New Relic, Inc."/>
<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.newrelic.plugins.mysql.instance.Main"/>
</manifest>
<fileset dir="${build.classes.dir}"/>
<zipfileset src="${platform-metrics-java}"/>
<zipfileset src="${mysql-connector}"/>
</jar>
</target>
<target name="dist" depends="jar" description="create a downloadable file">
<mkdir dir="${build.tar.src.dir}"/>
<copy file="${conf.dir}/metric.category.json" todir="${build.tar.src.dir}/config" />
<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="CATEGORIES.TXT" todir="${build.tar.src.dir}" />
<copy file="LICENSE" todir="${build.tar.src.dir}" />
<copy file="MYSQL.TXT" todir="${build.tar.src.dir}" />
<copy file="README.md" todir="${build.tar.src.dir}" />
<copy file="CHANGELOG.md" todir="${build.tar.src.dir}" />
<copy todir="${build.tar.src.dir}">
<fileset dir="${script.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>