forked from immibis/bearded-octo-nemesis
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
95 lines (80 loc) · 3.06 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
<project name="BON" default="install" basedir=".">
<property environment="env"/>
<!-- Basic directories -->
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="download.dir" value="${build.dir}/downloads"/>
<!-- Project information -->
<property name="build.name" value="BON"/>
<property name="class.pckg" value="immibis.bon"/>
<!-- Packaging -->
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="compile.dir" value="${build.dir}/compile"/>
<property name="classes.dir" value="${build.dir}/packaging"/>
<property name="apiclasses.dir" value="${build.dir}/api-packaging"/>
<!-- Enforce some paths -->
<mkdir dir="${build.dir}"/>
<!-- Task skipping -->
<target name="properties">
<available property="has.api" file="${src.dir}/${class.pckg}/api"/>
</target>
<!-- Building process -->
<target name="install" depends="build">
<!-- Cleanup -->
<delete dir="${apiclasses.dir}"/>
<delete dir="${classes.dir}"/>
<delete>
<fileset dir="${dist.dir}">
<exclude name="${build.name}-${build.number}.jar"/>
<exclude name="${build.name}-API-${build.number}.zip"/>
</fileset>
</delete>
</target>
<macrodef name="install-lite">
<attribute name="build"/>
<attribute name="classes" default="${compile.dir}"/>
<sequential>
<copy todir="${classes.dir}" preservelastmodified="true">
<fileset dir="@{classes}">
<include name="**/*.class"/>
</fileset>
</copy>
<jar destfile="${dist.dir}/${build.name}-@{build}.jar"
compress="true" level="9" basedir="${classes.dir}"
manifest="META-INF/MANIFEST.MF"/>
</sequential>
</macrodef>
<target name="build" depends="get-build-number" unless="already.compiled">
<!-- Recompile -->
<mkdir dir="${compile.dir}"/>
<depend srcdir="${src.dir}" destdir="${compile.dir}"
cache="${build.dir}/depcache" closure="true">
<include name="**/*.java"/>
</depend>
<javac srcdir="${src.dir}" destdir="${compile.dir}" target="1.6" source="1.6"
debug="true" debuglevel="lines,source" includeAntRuntime="false">
<include name="**/*.java"/>
</javac>
<local name="build"/><property name="build" value="${build.number}"/>
<install-lite build="${build}"/>
</target>
<target name="package-api" depends="get-build-number" unless="already.compiled" if="has.api">
<!-- Copy & package API -->
<copy todir="${apiclasses.dir}/${class.pckg}/api">
<fileset dir="${src.dir}/${class.pckg}/api"/>
</copy>
<zip destfile="${dist.dir}/${build.name}-API-${build.number}.zip" basedir="${apiclasses.dir}"/>
</target>
<target name="get-build-number" depends="build-number-there" unless="build.number">
<echo message="!! No build number set !!"/>
<property name="build.number" value="CUSTOM_BUILD"/>
</target>
<target name="build-number-there" if="env.BUILD_NUMBER" unless="build.number">
<echo message="Using build number ${env.BUILD_NUMBER}..."/>
<property name="build.number" value="${env.BUILD_NUMBER}"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="jar" depends="install"/>
</project>