forked from pentaho/big-data-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
239 lines (205 loc) · 10.2 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
227
228
229
230
231
232
233
234
235
236
237
238
239
<!--===========================================================================
This is the build file for the Pentaho Big Data Project
This build file will use the subfloor.xml file as the default build
process and should only override the tasks that need to differ from
the common build file.
See subfloor.xml for more details
============================================================================-->
<project name="Pentaho Big Data Plugin" basedir="." default="dist"
xmlns:ivy="antlib:org.apache.ivy.ant" >
<description>
This build file is used to create the Pentaho Big Data Plugin project
and works with the subfloor.xml file.
</description>
<!-- Import the common_build.xml file which contains all the default tasks -->
<import file="build-res/subfloor-pkg.xml"/>
<property name="stage.pmr.dir" value="${basedir}/stage-pmr"/>
<property name="pmr.archive.name" value="pentaho-mapreduce-libraries"/>
<property name="resolve.shims.dir" value="${bin.dir}/shims"/>
<property name="stage.shims.dir" value="${stage.dir}/${ivy.artifact.id}/hadoop-configurations"/>
<property name="prepared.src.dir" value="${bin.dir}/prepared-src"/>
<property name="pdi-with-plugin"
value="pdi-ce-big-data"
description="Name of the pdi distribution with Big Data plugin"/>
<property name="plugin.destination" location="kettle-dist" />
<property name="samples.dir" value="${basedir}/samples" />
<property name="package-samples.artifact.ivyfile"
value="package-samples-ivy.xml"
description="The ivy file defining dependencies of the package" />
<property name="package-samples.artifact.pomfile"
value="package-samples-pom.xml"
description="The Maven pom file defining dependencies of the package" />
<!--
AS STATED ABOVE, THE ONLY TASKS THAT SHOULD EXIST IN THIS BUILD FILE ARE
THE TASKS THAT NEED TO DIFFER FROM THE DEFAULT IMPLEMENTATION OF THE TASKS
FOUND IN subfloor.xml.
-->
<target name="resolve" depends="subfloor.resolve,resolve-pmr"/>
<target name="clean-pmr">
<delete dir="${stage.pmr.dir}"/>
</target>
<target name="resolve-pmr" depends="install-ivy">
<delete dir="${stage.pmr.dir}/lib"/>
<ivy:resolve file="${ivyfile}" conf="default" />
<ivy:retrieve conf="pmr" pattern="${stage.pmr.dir}/lib/[module]-[revision](-[classifier]).[ext]" symlink="true" />
</target>
<target name="resolve-hadoop-shims" depends="install-ivy">
<delete dir="${resolve.shims.dir}"/>
<ivy:resolve file="${ivyfile}" conf="shim" />
<ivy:retrieve conf="shim" pattern="${resolve.shims.dir}/[module]-[revision](-[classifier]).[ext]" symlink="true" />
</target>
<target name="dist-noresolve" depends="jar,package" description="Builds and packages the application" />
<target name="dist" depends="resolve,jar,package" description="Builds and packages the application" />
<target name="clean-all" depends="subfloor.clean-all,clean-pmr" />
<target name="clean-dist">
<delete dir="${dist.dir}" />
<delete dir="${stage.dir}" />
<delete dir="${platform.unzip.dir}" />
</target>
<target name="assemble.init">
<mkdir dir="${stage.dir}" />
<mkdir dir="${stage.dir}/${ivy.artifact.id}" />
</target>
<!-- Assemble the Hadoop Shim zips by first resolving them then extracting them
into the package stage directory at hadoop-configurations/.
-->
<target name="assemble-hadoop-shims" depends="resolve-hadoop-shims">
<delete dir="${stage.shims.dir}"/>
<!-- <mkdir dir="${stage.shims.dir}"/> -->
<unzip dest="${stage.shims.dir}">
<fileset dir="${resolve.shims.dir}">
<include name="*.zip"/>
</fileset>
</unzip>
</target>
<!-- Assemble all libraries required for Pentaho MapReduce into the ${pmr.archive.name}.zip file in the staging directory -->
<target name="assemble-pmr-libraries">
<!-- Archive must contain a top level lib/ directory -->
<zip destfile="${stage.dir}/${ivy.artifact.id}/${pmr.archive.name}.zip">
<zipfileset dir="${stage.pmr.dir}/lib" prefix="lib"/>
</zip>
</target>
<target name="assemble.copy-libs" depends="assemble-pmr-libraries,assemble-hadoop-shims">
<copy todir="${stage.dir}/${ivy.artifact.id}/lib">
<fileset dir="${lib.dir}">
<exclude name="kettle-*.jar" />
<exclude name="pentaho-xul-*.jar" />
<exclude name="metro-*.jar" />
<exclude name="log4j-*.jar" />
<exclude name="jface*.jar" />
<exclude name="hadoop-*.jar" />
<exclude name="hbase-*.jar" />
<exclude name="zookeeper-*.jar" />
<exclude name="jug-*.jar" />
<exclude name="commons-codec*.jar" />
<exclude name="commons-httpclient*.jar" />
<exclude name="commons-io*.jar" />
<exclude name="commons-lang*.jar" />
<exclude name="commons-logging*.jar" />
<exclude name="commons-vfs*.jar" />
<exclude name="pentaho-vfs-browser*.jar" />
<exclude name="scannotation*.jar" />
<exclude name="dom4j*.jar" />
<exclude name="jface*.jar" />
<exclude name="x86*.jar" />
</fileset>
</copy>
<copy todir="${stage.dir}/${ivy.artifact.id}">
<fileset file="${dist.dir}/${ivy.artifact.id}-${project.revision}.jar" />
</copy>
</target>
<!-- this target builds a kettle release that includes the plugin -->
<target name="kettle-w-plugin-dist">
<property name="pdi-dist-root" value="${bin.dir}/kettle-dist/${kettle-distrib-with-plugin-name}"/>
<delete dir="${bin.dir}/kettle-dist" />
<!-- Unzip PDI CE -->
<untar compression="gzip" dest="${pdi-dist-root}" src="${kettle.dist.dir}/${kettle-distrib-artifact-name}.tar.gz"/>
<!-- Unzip plugin -->
<unzip src="${dist.dir}/${package.basename}.zip" dest="${pdi-dist-root}/data-integration/plugins"/>
<!-- Unzip samples -->
<unzip src="${dist.dir}/${ivy.artifact.id}-samples-${project.revision}.zip" dest="${pdi-dist-root}/data-integration/samples" />
<tar destfile="${dist.dir}/${kettle-distrib-with-plugin-name}.tar.gz" longfile="gnu" compression="gzip">
<tarfileset dir="${bin.dir}/kettle-dist" mode="755" excludes="docs/api/** docs/api-core/** **/Thumbs.db">
<include name="**/*.sh" />
<include name="**/JavaApplicationStub" />
</tarfileset>
<tarfileset dir="${bin.dir}/kettle-dist" excludes="docs/api/** docs/api-core/** **/Thumbs.db">
<exclude name="**/*.sh" />
<exclude name="**/JavaApplicationStub" />
</tarfileset>
</tar>
<!-- Zip up new PDI CE with Pentaho Big Data Plugin and Samples -->
<zip destfile="${dist.dir}/${kettle-distrib-with-plugin-name}.zip">
<zipfileset dir="${bin.dir}/kettle-dist" filemode="755">
<include name="**/*.sh" />
<include name="**/JavaApplicationStub" />
</zipfileset>
<zipfileset dir="${bin.dir}/kettle-dist">
<exclude name="**/*.sh" />
<exclude name="**/JavaApplicationStub" />
</zipfileset>
</zip>
</target>
<target name="install-plugin" depends="jar,package" description="Build the plugin and extract it into ${kettle.dist.dir}/plugins">
<!-- Install the plugin -->
<delete dir="${kettle.dist.dir}/plugins/pentaho-big-data-plugin"/>
<unzip dest="${kettle.dist.dir}/plugins">
<fileset file="${dist.dir}/${package.basename}.zip"/>
</unzip>
<!-- Install samples -->
<delete dir="${kettle.dist.dir}/samples/job/hadoop"/>
<unzip dest="${kettle.dist.dir}/samples">
<fileset file="${dist.dir}/${ivy.artifact.id}-samples-${project.revision}.zip"/>
</unzip>
</target>
<target name="publish-local-nojar" depends="install-ivy,subfloor.publish-local-nojar">
<ivy:resolve file="${package.artifact.ivyfile}" />
<ivy:publish resolver="local" pubrevision="${project.revision}" overwrite="true" forcedeliver="true">
<artifacts pattern="${dist.dir}/[artifact]-[revision].[ext]" />
</ivy:publish>
<ivy:resolve file="${package-samples.artifact.ivyfile}" />
<ivy:publish resolver="local" pubrevision="${project.revision}" overwrite="true" forcedeliver="true">
<artifacts pattern="${dist.dir}/[artifact]-[revision].[ext]" />
</ivy:publish>
</target>
<target name="publish-nojar" depends="subfloor-pkg.publish-nojar">
<antcall target="maven-publish-artifact">
<param name="publish.pomFile" value="${package-samples.artifact.pomfile}" />
<param name="publish.file" value="${dist.dir}/${ivy.artifact.id}-samples-${project.revision}.zip" />
</antcall>
</target>
<target name="create-package-pom"
depends="install-ivy,subfloor-pkg.create-package-pom"
description="Creates a POM file based on the ivy dependencies for a separate package">
<ivy:makepom ivyfile="${package-samples.artifact.ivyfile}" pomfile="${package-samples.artifact.pomfile}" />
<replace file="${package-samples.artifact.pomfile}" token="jar" value="zip" />
</target>
<target name="package" depends="subfloor-pkg.package">
<zip destfile="${dist.dir}/${ivy.artifact.id}-samples-${project.revision}.zip" basedir="${samples.dir}" />
</target>
<!-- Override compile.pre and compile.compile so we can inject ${project.version} into PluginPropertiesUtil -->
<target name="compile.pre">
<!-- Update the @VERSION@ string in PluginPropertiesUtil -->
<echo>Replacing @VERSION@ in ${src.dir}/org/pentaho/hadoop/PluginPropertiesUtil.java</echo>
<copy todir="${prepared.src.dir}/org/pentaho/hadoop" file="${src.dir}/org/pentaho/hadoop/PluginPropertiesUtil.java" />
<replace file="${prepared.src.dir}/org/pentaho/hadoop/PluginPropertiesUtil.java" token="@VERSION@" value="${project.revision}" />
</target>
<!-- Build the prepared source after the normal source so we can replace the non-instrumented classes -->
<target name="compile.compile" depends="subfloor.compile.compile">
<echo>Building prepared source</echo>
<delete file="${classes.dir}/org/pentaho/hadoop/PluginPropertiesUtil.class"/>
<javac destdir="${classes.dir}"
includeAntRuntime="false"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
fork="true"
memorymaximumsize="${javac.maxmemory}"
source="${javac.source}"
target="${javac.target}">
<classpath>
<path refid="classpath" />
</classpath>
<src path="${prepared.src.dir}" />
</javac>
</target>
</project>