forked from mahmoudparsian/data-algorithms-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·155 lines (138 loc) · 5.83 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
154
155
<project name="Data Algorithms Book" default="build_jar" basedir=".">
<!-- ============================================================= -->
<!-- This is the build script for Data Algorithms Book -->
<!-- by using Apache's Ant (http://ant.apache.org) -->
<!-- -->
<!-- @author: Mahmoud Parsian -->
<!-- ============================================================= -->
<property name="src" location="src/main/java"/>
<property name="test" location="src/test/java"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="reports" location="reports"/>
<property environment="env"/>
<property name="project_name" value="Data Algorithms Book"/>
<path id="required_libs">
<fileset dir="lib" includes="**/*.jar"/>
</path>
<!-- ========================================================================= -->
<!-- Note that since the size of spark-assembly-1.1.0-hadoop2.5.0.jar is over -->
<!-- 100MBs, I could not upload this jar to the lib directory. I needed to add -->
<!-- the "copy_jar", so that it can copy it from my web site. -->
<!-- Once this task is done (the jar is copied to your lib), subsequent builds -->
<!-- will not dowload the jar dile. -->
<!-- ========================================================================= -->
<target name="copy_jar" depends="init">
<echo message="copying spark-assembly-1.1.0-hadoop2.5.0.jar..."/>
<copy todir="lib" flatten="true">
<url url="http://www.mapreduce4hackers.com/dataalgorithmsbook/lib/spark-assembly-1.1.0-hadoop2.5.0.jar"/>
</copy>
</target>
<target name="build_jar" depends="copy_jar">
<echo message="javac"/>
<echo message="compiling src..."/>
<javac includeantruntime="false"
srcdir="src"
destdir="build"
classpathref="required_libs"
source="1.7"
target="1.7"
debug="true"
fork="true"
memorymaximumsize="512m"
deprecation="false"
optimize="false"
failonerror="true"
verbose="false">
<compilerarg line="-encoding ISO-8859-1"/>
</javac>
<jar destfile="dist/data_algorithms_book.jar"
basedir="build"
/>
</target>
<target name="myenv" description="print some basic information about my environment">
<echo>----------------------------</echo>
<echo>"ant.file=${ant.file}"</echo>
<echo>"ant.version=${ant.version}"</echo>
<echo>"ant.project.name=${ant.project.name}"</echo>
<echo>"ant.java.version=${ant.java.version}"</echo>
<echo>"java.home=${java.home}"</echo>
<echo>"ANT_HOME=${env.ANT_HOME}"</echo>
<echo>"JAVA_HOME=${env.JAVA_HOME}"</echo>
<echo>----------------------------</echo>
</target>
<target name="compile" depends="build_jar" description="compile the source code " >
<javac includeantruntime="false"
srcdir="test"
destdir="build"
source="1.7"
target="1.7"
debug="true"
fork="true"
memorymaximumsize="512m"
deprecation="false"
optimize="false"
failonerror="true"
verbose="false">
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="dist">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="dist" depends="clean,compile" description="generate the distributable files " >
</target>
<target name="clean" description="clean up" >
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${reports}"/>
</target>
<target name="runtests" depends="compile" description="run your test suite" >
<junit printsummary="yes" haltonfailure="yes" showoutput="yes" >
<classpath>
<pathelement path="${build}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="dist">
<include name="**/*.jar"/>
</fileset>
</classpath>
<batchtest fork="yes" todir="${reports}/raw/">
<formatter type="xml"/>
<fileset dir="${tests}">
<include name="**/Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name ="test" depends="runtests">
<junitreport todir="${reports}">
<fileset dir="${reports}/raw/">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports}\html\"/>
</junitreport>
</target>
<target name ="run" depends="" description="if this project can be run, run it" >
</target>
<!-- supporting targets -->
<target name="init" description="initialize the build environment" >
<!-- Create the time stamp -->
<tstamp/>
<!-- Create directory structures -->
<mkdir dir="${build}"/>
<mkdir dir="${lib}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${reports}"/>
<mkdir dir="${reports}/raw/"/>
<mkdir dir="${reports}/html/"/>
</target>
<target name="all" depends="clean, test">
</target>
</project>