123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <!--
- 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.
- -->
- <project name="queue" default="jar">
- <import file="../build-recipes.xml"/>
- <property name="test.main.classes" value="${zk.root}/build/test/classes"/>
- <property name="test.build.dir" value="${build.test}" />
- <property name="test.src.dir" value="src/test/java"/>
- <property name="test.log.dir" value="${test.build.dir}/logs" />
- <property name="test.data.dir" value="${test.build.dir}/data" />
- <property name="test.data.upgrade.dir" value="${test.data.dir}/upgrade" />
- <property name="test.tmp.dir" value="${test.build.dir}/tmp" />
- <property name="test.output" value="no" />
- <property name="test.timeout" value="900000" />
- <property name="test.junit.output.format" value="plain" />
- <property name="test.junit.fork.mode" value="perTest" />
- <property name="test.junit.printsummary" value="yes" />
- <property name="test.junit.haltonfailure" value="no" />
- <property name="test.junit.maxmem" value="512m" />
- <target name="setjarname">
- <property name="jarname"
- value="${build.dir}/zookeeper-${version}-recipes-${name}.jar"/>
- </target>
- <!-- Override jar target to specify main class -->
- <target name="jar" depends="checkMainCompiled, setjarname, compile">
- <echo message="recipes: ${name}"/>
- <jar jarfile="${jarname}">
- <fileset file="${zk.root}/LICENSE.txt" />
- <fileset dir="${build.classes}"/>
- <fileset dir="${build.test}"/>
- </jar>
- </target>
- <target name="test" depends="compile-test,test-init,test-category,junit.run" />
- <target name="compile-test" depends="compile">
- <property name="target.jdk" value="${ant.java.version}" />
- <property name="src.test.local" location="${basedir}/src/test/java" />
- <mkdir dir="${build.test}"/>
- <javac srcdir="${src.test.local}"
- destdir="${build.test}"
- target="${target.jdk}"
- debug="on" encoding="${build.encoding}">
- <classpath refid="classpath" />
- <classpath>
- <pathelement path="${test.main.classes}"/>
- </classpath>
- </javac>
- </target>
-
- <target name="test-init" depends="jar,compile-test">
- <delete dir="${test.log.dir}" />
- <delete dir="${test.tmp.dir}" />
- <delete dir="${test.data.dir}" />
- <mkdir dir="${test.log.dir}" />
- <mkdir dir="${test.tmp.dir}" />
- <mkdir dir="${test.data.dir}" />
- </target>
- <target name="test-category">
- <property name="test.category" value=""/>
- </target>
- <target name="junit.run">
- <echo message="${test.src.dir}" />
- <junit showoutput="${test.output}"
- printsummary="${test.junit.printsummary}"
- haltonfailure="${test.junit.haltonfailure}"
- fork="yes"
- forkmode="${test.junit.fork.mode}"
- maxmemory="${test.junit.maxmem}"
- dir="${basedir}" timeout="${test.timeout}"
- errorProperty="tests.failed" failureProperty="tests.failed">
- <sysproperty key="build.test.dir" value="${test.tmp.dir}" />
- <sysproperty key="test.data.dir" value="${test.data.dir}" />
- <sysproperty key="log4j.configuration"
- value="file:${basedir}/conf/log4j.properties" />
- <classpath refid="classpath"/>
- <classpath>
- <pathelement path="${build.test}" />
- <pathelement path="${test.main.classes}"/>
- </classpath>
- <formatter type="${test.junit.output.format}" />
- <batchtest todir="${test.log.dir}" unless="testcase">
- <fileset dir="${test.src.dir}"
- includes="**/*${test.category}Test.java"/>
- </batchtest>
- <batchtest todir="${test.log.dir}" if="testcase">
- <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
- </batchtest>
- </junit>
- <fail if="tests.failed">Tests failed!</fail>
- </target>
- <target name="package" depends="jar, zookeeperbuildrecipes.package"
- unless="skip.recipes">
- <copy file="${basedir}/build.xml" todir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}"/>
- <mkdir dir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}/src/test/java"/>
- <copy todir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}/src/test/java">
- <fileset dir="${basedir}/src/test/java"/>
- </copy>
- <mkdir dir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}/src/main/java"/>
- <copy todir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}/src/main/java">
- <fileset dir="${basedir}/src/main/java"/>
- </copy>
- <mkdir dir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}/src/main/c"/>
- <copy todir="${dist.dir}${package.share}/zookeeper-recipes/zookeeper-recipes-${name}/src/main/c">
- <fileset dir="${basedir}/src/main/c"/>
- </copy>
- </target>
- </project>
|