-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.xml
185 lines (154 loc) · 6.64 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<project name="HadoopLink" default="build" basedir=".">
<property environment="env"/>
<property name="app.name" value="HadoopLink"/>
<property name="build.name" value="build"/>
<property name="compile.dir" location="compile"/>
<property name="src.dir" location="src" />
<property name="src.java.dir" location="${src.dir}/java"/>
<property name="src.test.dir" location="${src.dir}/test"/>
<property name="doc.src.dir" location="${basedir}/Documentation"/>
<property name="classes.dir" location="${compile.dir}/classes"/>
<property name="log.dir" location="${basedir}/log"/>
<property name="lib.dir" location="${basedir}/Java"/>
<property name="mathematica.dir" location="/Applications/Mathematica.app"/>
<property name="workbench.dir" location="/Applications/eclipse"/>
<property name="build.dir" value="${basedir}/${build.name}/${app.name}"/>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${compile.dir}"/>
<delete dir="${classes.dir}"/>
<delete dir="${log.dir}"/>
<delete dir="${basedir}/${build.name}"/>
<delete dir="HadoopLink/Java"/>
</target>
<target name="init">
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${compile.dir}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${log.dir}"/>
<fail message="Please set the mathematica.dir property to the path of your Mathematica installation.">
<condition>
<not><isset property="mathematica.dir"/></not>
</condition>
</fail>
<property name="jlink.jar" location="${mathematica.dir}/SystemFiles/Links/JLink/JLink.jar"/>
<property name="mathExe" value="${mathematica.dir}/Contents/MacOS/MathKernel"/>
<condition property="skip.docbuild">
<not><isset property="workbench.dir"/></not>
</condition>
<!-- Load J/Link and set up the mathematica task type -->
<taskdef name="mathematica" classname="com.wolfram.jlink.util.MathematicaTask"
classpath="${jlink.jar}"/>
<mathematica exe="${mathExe}">
<![CDATA[
AntSetProperty["user.app.dir", FileNameJoin[{$UserBaseDirectory, "Applications"}]];
search[path_, form_] :=
Module[
{files, dirs},
files = FileNames[form, {path}];
If[ Length@files > 0,
files,
dirs = Select[FileNames["*", path], DirectoryQ];
Flatten@Table[search[dir, form], {dir, dirs}]
]
];
workbenchDir = AntProperty["workbench.dir"];
If[ workbenchDir =!= Null,
AntLog["Searching path "<>workbenchDir<>" for DocumentationBuild source."];
paths = search[workbenchDir, "DocumentationBuild"];
If[ Length@paths > 0,
AntLog[paths[[1]]];
AntSetProperty[
"mathematica.app.dir",
ParentDirectory[AbsoluteFileName@paths[[1]]]
];
]
];
(* Extract the version number from PacletInfo.m *)
paclet = Import[FileNameJoin[{
AntProperty["basedir"],
AntProperty["app.name"],
"PacletInfo.m"}]
];
version = Version /. List@@paclet;
AntSetProperty["version", version];
]]>
</mathematica>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${jlink.jar}"/>
</path>
</target>
<target name="compile" depends="init" description="compile the source">
<!-- Compile the java code from ${src.java} into ${build} -->
<javac srcdir="${src.java.dir}" destdir="${classes.dir}"
debug="${java.debug}" debuglevel="lines,vars,source">
<classpath refid="classpath"/>
</javac>
</target>
<target name="jar" depends="compile" description="package up Java components">
<!-- The core jar holds classes intended to be used primarily from Mathematica -->
<delete file="${compile.dir}/${app.name}-core-${version}.jar"/>
<jar jarfile="${compile.dir}/${app.name}-core-${version}.jar">
<fileset dir="${classes.dir}">
<include name="**/ExprUtil.class"/>
<include name="com/wolfram/hadoop/dfs/*.class"/>
<include name="com/wolfram/hbase/*.class"/>
</fileset>
</jar>
<!-- The mapreduce jar is used to construct job jars. -->
<delete file="${compile.dir}/${app.name}-mapreduce-${version}.jar"/>
<jar jarfile="${compile.dir}/${app.name}-mapreduce-${version}.jar">
<fileset dir="${classes.dir}">
<include name="**/ExprUtil.class"/>
<include name="com/wolfram/hadoop/mapreduce/*.class"/>
</fileset>
<fileset dir="${basedir}/${app.name}">
<include name="MapReduceAPI.m"/>
</fileset>
</jar>
</target>
<target name="docbuild" depends="init" unless="skip.docbuild" description="">
<!-- Check for the location of DocumentationBuild -->
<fail message="Please set the mathematica.app.dir property to
the path where the DocumentationBuild application is located">
<condition>
<not><isset property="mathematica.app.dir"/></not>
</condition>
</fail>
<!-- Set up the properties expected by the doc build script -->
<property name="appPath" value="${mathematica.app.dir}"/>
<property name="mathematicaInstallDir" value="${mathematica.dir}"/>
<property name="inputDir" value="${doc.src.dir}/English"/>
<property name="outputDir" value="${build.dir}/Documentation/English"/>
<property name="logdir" value="${log.dir}"/>
<property name="JLinkLoaded" value="true"/>
<property name="jlink.lib" value="${jlink.jar}"/>
<!-- call into documentation build scripts that ship with Mathematica -->
<ant
antfile="${appPath}/DocumentationBuild/SystemFiles/ant/Build/notebook.xml"
target="main"/>
</target>
<target name="srcbuild" depends="jar" description="assemble .java and .m files">
<mkdir dir="${build.dir}"/>
<copy todir="${build.dir}">
<fileset dir="${basedir}/${app.name}">
<include name="**/*.m"/>
</fileset>
</copy>
<copy todir="${build.dir}/Java">
<fileset dir="${lib.dir}"/>
</copy>
<copy todir="${build.dir}/Java"
file="${compile.dir}/${app.name}-core-${version}.jar"/>
<copy todir="${build.dir}/Data"
file="${compile.dir}/${app.name}-mapreduce-${version}.jar"/>
</target>
<target name="build" depends="srcbuild,docbuild" description="assemble all the components of the application"/>
<target name="dist" depends="build">
<zip destfile="${basedir}/${build.name}/${app.name}-${version}.zip" basedir="${basedir}/${build.name}"/>
</target>
</project>