-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.xml
226 lines (194 loc) · 7.23 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?xml version="1.0" encoding="UTF-8"?>
<project name="Rhipe" default="help" basedir="." xmlns:mvn="antlib:org.apache.maven.artifact.ant">
<!--
NOTE:
Targets that begin with an '_' (e.g. _build-hadoop-1) are not designed to run as a standalone target
-->
<property name="rhipe.version" value="0.75.2"/>
<property name="maven.project.name" value="rhipe-java"/>
<property name="maven.dl.dir" value="conf/maven"/>
<property name="maven.tmp.dir" value="${maven.dl.dir}/mvn-tmp"/>
<property name="maven.archive.name" value="apache-maven-3.0.5"/>
<property name="java.build" value="target"/>
<property name="package" value="package"/>
<property name="r.package" value="${package}/R"/>
<property name="r.inst" value="${r.package}/inst"/>
<property name="r.src" value="src/main/R"/>
<property name="r.test" value="src/test/R/install-test"/>
<property name="r.assembly" value="src/main/assembly"/>
<property name="c.src" value="src/main/C"/>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd"/>
</tstamp>
<path id="maven-ant-tasks.classpath" path="conf/maven/maven-ant-tasks-2.1.3.jar"/>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath"/>
<!--<available file="${maven.tmp.dir}/${maven.archive.name}.version" property="maven.available"/>-->
<target name="help" description="how to use this script">
<echo>
Options:
clean
- delete all build artifacts
build
- builds Rhipe for hadoop-2 and cdh5
build-distro -Dhadoop.version=version
- build Rhipe for the specified Hadoop version:hadoop-1,hadoop-2,cdh3,cdh4,cdh4mr1,cdh5,hdp-1,hdp-2
</echo>
</target>
<target name="init" depends="maven-version-update">
</target>
<target name="init-r-dir">
<mkdir dir="${r.package}"/>
<copy todir="${r.package}">
<fileset dir="${r.assembly}">
<exclude name="**/DESCRIPTION"/>
</fileset>
</copy>
<copy todir="${r.package}">
<fileset file="${r.assembly}/DESCRIPTION"/>
<filterset>
<filter token="VERSION" value="${rhipe.version}"/>
<filter token="DATE" value="${TODAY}"/>
</filterset>
</copy>
<mkdir dir="${r.package}/R"/>
<copy todir="${r.package}/R">
<fileset dir="${r.src}"/>
</copy>
<mkdir dir="${r.package}/src"/>
<copy todir="${r.package}/src">
<fileset dir="${c.src}"/>
</copy>
<mkdir dir="${r.inst}/java"/>
<mkdir dir="${r.package}/man"/>
<mkdir dir="${r.package}/inst/tests/testthat"/>
<copy todir="${r.package}/inst/tests/testthat">
<fileset dir="${r.test}"/>
</copy>
</target>
<!--<target name="build-all" depends="maven-clean,build,r-check,r-install-test" description="build, install and test Rhipe"/>-->
<target name="build-distro" depends="maven-clean,init-r-dir,r-doc" description="build Rhipe">
<echo>
Building Rhipe for Hadoop ${hadoop.version}
</echo>
<antcall target="_build-rhipe-jar">
<param name="hadoop.version" value="${hadoop.version}"/>
</antcall>
<antcall target="r-build"/>
</target>
<target name="build" depends="maven-clean,init-r-dir,r-doc" description="build Rhipe">
<antcall target="build-distro">
<param name="hadoop.version" value="hadoop-2"/>
</antcall>
<antcall target="build-distro">
<param name="hadoop.version" value="cdh5"/>
</antcall>
</target>
<target name="_build-rhipe-jar">
<!--call maven build -->
<antcall target="mvn-assembly">
<param name="profile" value="${hadoop.version}"/>
</antcall>
<copy tofile="${r.inst}/java/Rhipe.jar">
<file file="${java.build}/${maven.project.name}-${rhipe.version}-jar-with-dependencies.jar"/>
</copy>
</target>
<!--
Run R INSTALL and any tests
-->
<target name="r-install-test" depends="r-install,r-test" description="Install Rhipe and run a simple test"/>
<!--
Build the R tarball
-->
<target name="r-build">
<exec executable="R" failonerror="true" failifexecutionfails="true">
<arg value="CMD"/>
<arg value="build"/>
<arg value="${r.package}"/>
</exec>
<move tofile="${ant.project.name}_${rhipe.version}_${hadoop.version}.tar.gz">
<file file="${ant.project.name}_${rhipe.version}.tar.gz"/>
</move>
</target>
<!--
Run roxygen2 against the R code to generate documentation
-->
<target name="r-doc">
<exec executable="R" failonerror="true" failifexecutionfails="true">
<arg value="-e"/>
<arg value="library(roxygen2); roxygenize('${r.package}'); q('no')"/>
</exec>
</target>
<!--
Run R CMD check on the package before installing
-->
<target name="r-check">
<exec executable="R" failonerror="true" failifexecutionfails="true">
<arg value="CMD"/>
<arg value="check"/>
<arg value="${r.package}"/>
</exec>
</target>
<!--
Run R CMD INSTALL on the new built tar ball
-->
<target name="r-install">
<exec executable="R" failonerror="true" failifexecutionfails="true">
<arg value="CMD"/>
<arg value="INSTALL"/>
<arg value="Rhipe_${rhipe.version}.tar.gz"/>
</exec>
</target>
<!--
Run R tests
-->
<target name="r-test">
<!--
<exec executable="R" failonerror="true" failifexecutionfails="true">
<arg value="CMD"/>
<arg value="BATCH"/>
<arg value="${r.test}/RhipeTest.R"/>
</exec>
<echo message="success"/>
-->
</target>
<!--
Clean/delete generated artifacts
-->
<target name="clean" description="cleanup build artifacts" depends="maven-clean">
<delete dir="${package}"/>
<delete dir="Rhipe.Rcheck"/>
<delete>
<fileset dir="${basedir}" includes="*.tar.gz,*.Rout,*.versionsBackup,*.log"/>
</delete>
</target>
<!--
Build the java jar
-->
<target name="mvn-assembly"> <!-- depends="_prepare-maven"> -->
<mvn:mvn pom="./pom.xml" fork="true" failonerror="true">
<arg value="assembly:assembly"/>
<arg value="-DskipTests=true"/>
<arg value="-Dcargo.maven.skip=true"/>
<arg value="-P${profile}"/>
</mvn:mvn>
</target>
<!--
Run maven clean
-->
<target name="maven-clean">
<mvn:mvn pom="./pom.xml" fork="true" failonerror="true">
<arg value="clean"/>
</mvn:mvn>
</target>
<!--
Update the maven pom version number based on the property in this ant script
-->
<target name="maven-version-update">
<exec executable="mvn" failonerror="true" failifexecutionfails="true">
<arg value="versions:set"/>
<arg value="-DnewVersion=${rhipe.version}"/>
</exec>
</target>
</project>