forked from PhantomBot/PhantomBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
153 lines (135 loc) · 5.85 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="dist">
<property environment="env" />
<property name="project.base.dir" value="." />
<property name="name" value="PhantomBot" />
<property name="version" value="2.0.4" />
<property name="java.class.path" value="" />
<property name="src" value="${project.base.dir}/source" />
<property name="reference" value="${project.base.dir}/libraries" />
<property name="build" value="${project.base.dir}/build" />
<property name="classes" value="${build}/classes" />
<property name="dist" value="${project.base.dir}/dist" />
<property name="versionfolder" value="${dist}/${name}-${version}" />
<property name="version.name" value="${name}-${version}" />
<property name="build.dir" value="${dist}/build" />
<property name="res.dir" value="${build.dir}" />
<property name="lib.dir" value="${build.dir}/lib" />
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<path id="reference.class.path">
<fileset dir="${reference}">
<include name="*.jar" />
</fileset>
</path>
<available file=".git" type="dir" property="git.present"/>
<target name="init">
<mkdir dir="${build}" />
<mkdir dir="${classes}" />
<mkdir dir="${dist}" />
<mkdir dir="${versionfolder}" />
<pathconvert property="mf.classpath" pathsep=" ">
<path refid="reference.class.path" />
<mapper>
<chainedmapper>
<flattenmapper/>
<globmapper from="*.jar" to="lib/*.jar" />
</chainedmapper>
</mapper>
</pathconvert>
</target>
<target name="git.revision" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<echo>Building revision ${repository.version}</echo>
</target>
<target depends="init,git.revision" name="pre.compile">
<replace
file="source/me/mast3rplan/phantombot/RepoVersion.java"
token="@repository.version@"
value="${repository.version}" />
</target>
<target depends="pre.compile" name="compile.src">
<javac target="1.7" source="1.7" debug="on" destdir="${classes}" srcdir="${src}" includeantruntime="false" >
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:-options" />
<classpath refid="reference.class.path" />
</javac>
</target>
<target depends="pre.compile" name="clean.build.test">
<delete dir="${build}" />
<mkdir dir="${build}" />
<mkdir dir="${classes}" />
</target>
<target depends="clean.build.test" name="compile.src.test">
<javac target="1.7" source="1.7" debug="on" destdir="${classes}" srcdir="${src}" includeantruntime="false" >
<compilerarg value="-Xlint:all" />
<compilerarg value="-Xlint:-options" />
<classpath refid="reference.class.path" />
</javac>
</target>
<target name="post.compile">
<replace
file="source/me/mast3rplan/phantombot/RepoVersion.java"
token="${repository.version}"
value="@repository.version@" />
</target>
<target depends="compile.src,post.compile" name="jar">
<jar destfile="${build.dir}/PhantomBot.jar">
<fileset dir="${classes}" />
<manifest>
<attribute name="Bundle-Name" value="${project.name}" />
<attribute name="Bundle-Version" value="${version.num}" />
<attribute name="Bundle-Date" value="${NOW}" />
<attribute name="Implementation-Title" value="${project.name}" />
<attribute name="Implementation-Version" value="${version.num}" />
<attribute name="Implementation-URL" value="http://www.phantombot.net" />
<attribute name="Class-Path" value="${mf.classpath}" />
<attribute name="Main-Class" value="me.mast3rplan.phantombot.Main" />
</manifest>
</jar>
<mkdir dir="${lib.dir}" />
<copy todir="${lib.dir}">
<fileset dir="./libraries" />
</copy>
<echo level="info" message="lib folder content was copied." />
<copy todir="${res.dir}">
<fileset dir="./resources" />
</copy>
<echo level="info" message="res folder content was copied." />
<copy todir="${versionfolder}">
<fileset dir="${build.dir}" />
</copy>
</target>
<target depends="compile.src.test,post.compile" name="test"></target>
<target name="run" depends="jar">
<java fork="true" classname="me.mast3rplan.phantombot.PhantomBot" dir="${build.dir}">
<classpath>
<path refid="classpath" />
<path location="${build.dir}/PhantomBot.jar" />
</classpath>
</java>
</target>
<target depends="jar" name="dist">
<delete file="${dist}/${version.name}.zip" />
<zip destfile="${dist}/${version.name}.zip" basedir="${dist}" update="false">
<include name="${version.name}/**" />
</zip>
</target>
<target name="clean" depends="git.revision,post.compile">
<delete dir="${build}" />
</target>
<target name="distclean" depends="clean">
<delete dir="${dist}" />
</target>
</project>