forked from odnoklassniki/one-nio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·68 lines (57 loc) · 2.77 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
<?xml version="1.0"?>
<project name="one-nio" default="build" basedir=".">
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="test.dir" value="test"/>
<property name="lib.dir" value="lib"/>
<property name="target.jar" value="${build.dir}/${ant.project.name}.jar"/>
<property name="download.repo" value="http://repo1.maven.org/maven2"/>
<property name="gcc.extra.args" value=""/>
<target name="init">
<mkdir dir="${build.dir}"/>
<available file="${lib.dir}" type="dir" property="lib.dir.exists"/>
<path id="classpath.ref">
<fileset dir="${lib.dir}" includes="*.jar"/>
<fileset file="${java.home}/../lib/tools.jar"/>
</path>
</target>
<target name="retrieve-libs" unless="lib.dir.exists">
<echo message="Downloading external libraries..."/>
<mkdir dir="${lib.dir}"/>
<get src="${download.repo}/asm/asm/3.3/asm-3.3.jar" dest="${lib.dir}/asm-3.3.jar"/>
<get src="${download.repo}/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar" dest="${lib.dir}/commons-logging-1.0.3.jar"/>
<get src="${download.repo}/log4j/log4j/1.2.15/log4j-1.2.15.jar" dest="${lib.dir}/log4j-1.2.15.jar"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="clean-all" depends="clean">
<delete dir="${lib.dir}"/>
</target>
<target name="build" depends="build-jar"/>
<target name="compile-classes" depends="init, retrieve-libs">
<echo message="Compiling classes..."/>
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}" destdir="${build.dir}/classes" classpathref="classpath.ref" includeantruntime="false"/>
</target>
<target name="compile-native" depends="init">
<echo message="Compiling native library..."/>
<mkdir dir="${build.dir}/native"/>
<pathconvert property="src.native" pathsep=" ">
<fileset dir="${src.dir}" includes="**/*.c"/>
</pathconvert>
<exec os="Linux" executable="gcc">
<arg line="-g -O3 -fPIC -D_GNU_SOURCE ${gcc.extra.args}
-o ${build.dir}/native/libonenio.so -shared -Wl,-soname,libonenio.so
-I ${java.home}/../include -I ${java.home}/../include/linux
${src.native} -ldl -lrt"/>
</exec>
</target>
<target name="build-jar" depends="compile-classes, compile-native">
<echo message="Building ${target.jar}..."/>
<jar destfile="${target.jar}">
<fileset dir="${build.dir}/classes" includes="**/*.class" />
<fileset dir="${build.dir}/native" includes="*.so" />
</jar>
</target>
</project>