forked from fredemmott/jp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
145 lines (119 loc) · 5.19 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
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="jp-lib" basedir="." default="main">
<property name="build.dir" value="lib/java-build" />
<property name="src.dir" value="lib/" />
<property name="test.dir" value="tests/lib/java" />
<property name="examples.dir" value="examples/simple" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="javadoc.dir" value="${build.dir}/javadoc" />
<property name="testclasses.dir" value="${build.dir}/testclasses" />
<property name="jar.dir" value="${build.dir}/jar" />
<property name="report.dir" value="${build.dir}/report" />
<property name="javadoc.dir" value="${build.dir}/javadoc" />
<property name="ivy.lib.dir" value="${build.dir}/lib/"/>
<property name="libs.dir" value="${ivy.lib.dir}" />
<!-- Change this for your local thrift lib jar -->
<property name="thrift.lib" value="/usr/share/java/libthrift.jar" />
<path id="classpath">
<fileset dir="lib/" includes="**/*.jar" />
<pathelement location="${thrift.lib}" />
<pathelement location="gen-java/jp.jar" />
</path>
<path id="appjar" location="${jar.dir}/${ant.project.name}.jar" />
<target name="main" depends="clean,jar,junit,javadoc,compile_examples,create_scripts" />
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="resolve" description="--> retrieve dependencies with ivy" depends="init-ivy">
<ivy:retrieve />
</target>
<!-- IVY STUFF -->
<property name="ivy.install.version" value="2.1.0-rc2" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<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"/>
</target>
<!-- END IVY STUFF -->
<target name="compile" depends="resolve">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" />
</target>
<target name="compile_tests" depends="jar">
<mkdir dir="${testclasses.dir}" />
<javac srcdir="${test.dir}" destdir="${testclasses.dir}" classpathref="classpath">
<classpath>
<path refid="classpath" />
<path refid="appjar" />
</classpath>
</javac>
</target>
<target name="compile_examples" depends="jar">
<javac srcdir="${examples.dir}" destdir="${examples.dir}" classpathref="classpath">
<classpath>
<path refid="classpath" />
<path refid="appjar" />
</classpath>
</javac>
</target>
<target name="create_scripts">
<delete file = "${examples.dir}/TextConsumer_java"/>
<delete file = "${examples.dir}/TextProducer_java"/>
<echo file="${examples.dir}/TextConsumer_java" append="false">#\!/bin/sh
CLASSPATH="../../gen-java/jp.jar:../../lib/java-build/lib/*:/usr/share/java/libthrift.jar:../../lib/java-build/jar/jp-lib.jar:."
export CLASSPATH
java TextConsumer
</echo>
<echo file="${examples.dir}/TextProducer_java" append="false">#\!/bin/sh
CLASSPATH="../../gen-java/jp.jar:../../lib/java-build/lib/*:/usr/share/java/libthrift.jar:../../lib/java-build/jar/jp-lib.jar:."
export CLASSPATH
java TextProducer
</echo>
<chmod file="${examples.dir}/TextConsumer_java" perm="ugo+x"/>
<chmod file="${examples.dir}/TextProducer_java" perm="ugo+x"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}" />
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
</jar>
</target>
<target name="javadoc">
<javadoc access="public" destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="Mendeley Datamining">
<classpath refid="classpath" />
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="**/*.java" />
</fileset>
</javadoc>
</target>
<target name="junit" depends="jar,compile_tests">
<mkdir dir="${report.dir}" />
<junit printsummary="yes">
<classpath>
<path refid="classpath" />
<path refid="appjar" />
<pathelement location="${testclasses.dir}"/>
</classpath>
<formatter type="xml" />
<batchtest fork="no" todir="${report.dir}">
<fileset dir="${test.dir}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
</project>