| <?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> |