build.xml
3.47 KB
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
<project name="mcmas" xmlns:ivy="antlib:org.apache.ivy.ant" default="build">
<!-- SETTINGS -->
<!-- Required jar location -->
<property name="libs.dir" value="lib" />
<!-- Source directory -->
<property name="src.dir" value="src" />
<!-- Output directory -->
<property name="build.dir" value="build" />
<!-- Classes directory -->
<property name="classes.dir" value="${build.dir}/classes" />
<!-- Output JAR directory -->
<property name="jar.dir" value="${build.dir}/jar" />
<!-- Output JAR name -->
<property name="jar.name" value="${ant.project.name}.jar" />
<!-- Output JAR fullpath -->
<property name="jar.path" value="${jar.dir}/${jar.name}" />
<!-- Output JAR mainclass -->
<property name="jar.main" value="ocl.TestMain" />
<!-- Deployement directory -->
<property name="dest.dir" value="/opt" />
<!-- Documentation directory -->
<property name="doc.dir" value="doc/api" />
<!-- Classpath -->
<path id="classpath">
<fileset dir="${libs.dir}">
<include name="*.jar"/>
</fileset>
</path>
<!-- Ivy configuration -->
<property name="ivy.install.version" value="2.3.0-rc1"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<ivy:settings file="ivysettings.xml"/>
<!-- Ivy integration -->
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}"/>
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
</target>
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve />
</target>
<!-- TARGETS -->
<target name="clean" description="Clean generated files">
<delete dir="${build.dir}"/>
</target>
<target name="build" description="Build the library">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" debug="true" classpathref="classpath" srcdir="${src.dir}" destdir="${classes.dir}"/>
</target>
<target name="jar" depends="build" description="Generate a JAR">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.path}" basedir="${classes.dir}">
<!-- <manifest>
<attribute name="Main-Class" value="${jar.main}"/>
</manifest> -->
</jar>
</target>
<target name="bundle" depends="build" description="Generate an all-in-one JAR including dependencies">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}-all.jar" basedir="${classes.dir}">
<zipgroupfileset dir="${libs.dir}" includes="*.jar"/>
</jar>
</target>
<target name="run" description="Run JAR main class">
<java classpathref="classpath" jar="${jar.path}" fork="true"/>
</target>
<target name="deploy" depends="jar" description="Copy JAR for deployement">
<copy file="${jar.path}" todir="${dest.dir}"/>
</target>
<target name="doc" description="Generate javadoc">
<javadoc
classpathref="classpath"
sourcepath="${src.dir}"
defaultexcludes="yes"
destdir="${doc.dir}"
/>
</target>
</project>