forked from apache/zookeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-recipes.xml
161 lines (134 loc) · 6.18 KB
/
build-recipes.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
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Imported by recipesb/*/build.xml files to share generic targets. -->
<project name="zookeeperbuildrecipes">
<property name="name" value="${ant.project.name}"/>
<property name="root" value="${basedir}"/>
<property name="zk.root" location="${root}/../../"/>
<property name="src.dir" location="${root}/src/main/java"/>
<property name="src.test" location="${root}/src/test"/>
<property name="build.dir" location="${zk.root}/build/recipes/${name}"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="javac.deprecation" value="on"/>
<property name="javac.debug" value="on"/>
<property name="build.encoding" value="utf8"/>
<!-- to be overridden by sub-projects -->
<target name="check-recipes"/>
<target name="init-recipes"/>
<property name="lib.jars.includes" value="lib/*.jar" />
<property name="lib.jars.excludes" value="" />
<!-- prior to ant 1.7.1 fileset always fails if dir doesn't exist
so just point to bin directory and provide settings that exclude
everything - user can change as appropriate -->
<property name="additional.lib.dir" value="${zk.root}/bin" />
<property name="additional.lib.dir.includes" value="**/*.jar" />
<property name="additional.lib.dir.excludes" value="**/*.jar" />
<fileset id="lib.jars" dir="${root}">
<include name="${lib.jars.includes}" />
<exclude name="${lib.jars.excludes}" />
</fileset>
<path id="classpath">
<pathelement location="${build.classes}"/>
<!-- allow the user to override (e.g. if there are local versions) -->
<fileset dir="${additional.lib.dir}">
<include name="${additional.lib.dir.includes}" />
<exclude name="${additional.lib.dir.excludes}" />
</fileset>
<fileset refid="lib.jars"/>
<pathelement location="${zk.root}/build/classes"/>
<fileset dir="${zk.root}/build/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${zk.root}/build/test/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${zk.root}/zookeeper-server/src/main/resources/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init" depends="check-recipes" unless="skip.recipes">
<echo message="recipes: ${name}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.test}"/>
<antcall target="init-recipes"/>
</target>
<!-- ====================================================== -->
<!-- Compile a recipes files -->
<!-- ====================================================== -->
<target name="compile" depends="init" unless="skip.contrib">
<echo message="contrib: ${name}"/>
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}">
<classpath refid="classpath"/>
</javac>
</target>
<!-- ====================================================== -->
<!-- Make a recipes jar -->
<!-- ====================================================== -->
<target name="jar" depends="compile" unless="skip.recipes">
<echo message="recipes: ${name}"/>
<jar
jarfile="${build.dir}/zookeeper-${version}-recipes-${name}.jar"
basedir="${build.classes}"
/>
</target>
<!-- ====================================================== -->
<!-- Package a recipes files -->
<!-- ====================================================== -->
<target name="package" depends="jar" unless="skip.recipes">
<echo message="recipes: ${name}"/>
<mkdir dir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}"/>
<copy todir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}" includeEmptyDirs="false"
flatten="true">
<fileset dir="${build.dir}">
<include name="zookeeper-${version}-recipes-${name}.jar" />
</fileset>
</copy>
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean">
<echo message="recipes: ${name}"/>
<delete dir="${build.dir}"/>
</target>
<!-- ================================================================== -->
<!-- Utility features -->
<!-- ================================================================== -->
<target name="checkMainIsAvailable">
<available classname="org.apache.zookeeper.ZooKeeperMain"
property="mainIsCompiled">
<!-- we can't use id=classpath, because available fails if fileset directory
doesn't exist -->
<classpath>
<pathelement location="${zk.root}/build/classes"/>
</classpath>
</available>
</target>
<target name="checkMainCompiled" unless="mainIsCompiled" depends="checkMainIsAvailable">
<fail message="ZooKeeper main must first be compiled (toplevel build.xml)"/>
</target>
</project>