This repository has been archived by the owner on Mar 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.xml
107 lines (97 loc) · 4.54 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
102
103
104
105
106
107
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="dist" name="newrelic_unix_plugin">
<!-- UPDATE VERSION NUMBER HERE, NOT DIRECTLY IN SRC! -->
<property name="version" value="3.6.4"/>
<property name="unixagent.file" value="com/chocolatefactory/newrelic/plugins/unix/UnixAgent.java"/>
<property name="pluginname" value="newrelic_unix_plugin"/>
<property name="pluginname.long" value="New Relic Unix Plugin"/>
<property name="filename" value="${pluginname}"/>
<property name="jarfile" value="${pluginname}.jar"/>
<property name="tarfile" value="${filename}.tar.gz"/>
<property name="build.dir" location="bin"/>
<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}/${pluginname}"/>
<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="etc.dir" location="etc"/>
<property name="script.dir" location="."/>
<property name="newrelic.lib" value="${lib.dir}/metrics_publish-2.0.1.jar"/>
<property name="json.lib" value="${lib.dir}/json-simple-1.1.1.jar"/>
<path id="classpath">
<pathelement location="${build.dir}"/>
<pathelement location="${newrelic.lib}"/>
<pathelement location="${json.lib}"/>
</path>
<target name="clean">
<echo>Cleaning project.</echo>
<delete dir="${build.dir}"/>
<echo>Done.</echo>
</target>
<target depends="clean" name="cleanall"/>
<target name="init" depends="clean">
<echo>Creating directory: ${build.dir}</echo>
<mkdir dir="${build.dir}"/>
</target>
<target name="compile" depends="init">
<echo>Updating version number.</echo>
<replaceregexp file="${src.dir}/${unixagent.file}"
match="kAgentVersion = .*"
replace="kAgentVersion = "${version}";"
/>
<echo>Building project.</echo>
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.classes.dir}" target="1.6" source="1.6" includeantruntime="false">
<classpath refid="classpath"/>
</javac>
<echo>Done.</echo>
</target>
<target name="jar" depends="compile" description="create a Jar file for the plugin">
<mkdir dir="${build.jar.dir}"/>
<tstamp/>
<jar destfile="${build.jar.dir}/${jarfile}">
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Specification-Title" value="${pluginname.long}"/>
<attribute name="Specification-Vendor" value="The Chocolate Factory"/>
<attribute name="Implementation-Vendor" value="The Chocolate Factory"/>
<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.chocolatefactory.newrelic.plugins.unix.Main"/>
</manifest>
<fileset dir="${build.classes.dir}"/>
</jar>
</target>
<target name="dist" depends="jar" description="create a downloadable file">
<mkdir dir="${build.tar.src.dir}"/>
<mkdir dir="${build.tar.src.dir}/bin"/>
<mkdir dir="${build.tar.src.dir}/config"/>
<mkdir dir="${build.tar.src.dir}/lib"/>
<mkdir dir="${build.tar.src.dir}/etc"/>
<copy file="LICENSE" todir="${build.tar.src.dir}" />
<copy file="README.md" todir="${build.tar.src.dir}" />
<copy file="pluginctl.sh" todir="${build.tar.src.dir}" />
<copy todir="${build.tar.src.dir}/config">
<fileset dir="${conf.dir}" />
</copy>
<copy todir="${build.tar.src.dir}/lib">
<fileset dir="${lib.dir}" />
</copy>
<copy todir="${build.tar.src.dir}/etc">
<fileset dir="${etc.dir}" />
</copy>
<copy file="${build.jar.dir}/${jarfile}" todir="${build.tar.src.dir}/bin" />
<tar compression="gzip" destfile="${dist.dir}/${tarfile}">
<tarfileset dir="${build.tar.dir}">
<exclude name="*.sh"/>
</tarfileset>
<tarfileset mode="755" dir="${build.tar.dir}">
<include name="*.sh"/>
</tarfileset>
</tar>
</target>
</project>