| <?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. |
| --> |
| |
| <project name="chukwa-xtrace" default="main" xmlns:ivy="antlib:org.apache.ivy.ant"> |
| |
| <property name="name" value="chukwa-xtrace" /> |
| |
| <import file="../build-contrib.xml" optional="true" /> |
| <available file="../build-contrib.xml" property="present" /> |
| |
| <property name="src.dir" value="${basedir}/src" /> |
| <property name="build.dir" value="${basedir}/build" /> |
| <property name="build.classes" value="${build.dir}/classes/" /> |
| <property name="conf.dir" value="${basedir}/conf" /> |
| <property name="docs.src" value="${basedir}/src/docs" /> |
| <property name="docs.dir" value="${basedir}/docs" /> |
| <property name="changes.src" value="${docs.src}/changes" /> |
| <property name="tools.dir" value="${basedir}/tools" /> |
| <property name="opt.dir" value="${basedir}/opt" /> |
| <property name="javac.debug" value="on" /> |
| <property name="javac.version" value="1.6" /> |
| <property name="test.src.dir" value="${basedir}/test/src/java/" /> |
| <property name="test.lib.dir" value="${basedir}/src/test/lib" /> |
| <property name="test.build.dir" value="${build.dir}/test" /> |
| <property name="test.generated.dir" value="${test.build.dir}/src" /> |
| <property name="test.build.data" value="${test.build.dir}/data" /> |
| <property name="test.cache.data" value="${test.build.dir}/cache" /> |
| <property name="test.debug.data" value="${test.build.dir}/debug" /> |
| <property name="test.log.dir" value="${test.build.dir}/logs" /> |
| <property name="test.build.classes" value="${test.build.dir}/classes/" /> |
| <property name="test.build.testjar" value="${test.build.dir}/testjar" /> |
| <property name="test.build.javadoc" value="${test.build.dir}/docs/api" /> |
| <property name="test.build.javadoc.dev" value="${test.build.dir}/docs/dev-api" /> |
| <property name="test.include" value="Test*" /> |
| <property name="test.classpath.id" value="test.classpath" /> |
| <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="yes" /> |
| <property name="test.junit.maxmemory" value="256m" /> |
| <property name="javadoc.link.java" value="http://java.sun.com/javase/6/docs/api/" /> |
| <property name="javadoc.packages" value="org.apache.hadoop.*" /> |
| <property name="javadoc.maxmemory" value="512m" /> |
| |
| |
| |
| <target name="ivy-init-properties-local" description="to initiate ivy properties"> |
| <property name="ivy.dir" location="ivy" /> |
| <property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" /> |
| <loadproperties srcfile="${ivy.dir}/libraries.properties" /> |
| <loadproperties srcfile="${ivy.dir}/libraries.properties" /> |
| <property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar" /> |
| <property name="ivy_repo_url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" /> |
| <property name="build.dir" location="build" /> |
| <property name="build.ivy.dir" location="${build.dir}/ivy" /> |
| <property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" /> |
| <property name="build.ivy.report.dir" location="${build.ivy.dir}/report" /> |
| <property name="common.ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}/common" /> |
| <property name="rat.reporting.classname" value="rat.Report" /> |
| <property name="jdiff.build.dir" value="${build.docs}/jdiff" /> |
| <property name="jdiff.xml.dir" value="${build.ivy.lib.dir}/${name}/jdiff" /> |
| <property name="jdiff.stable" value="0.1.2" /> |
| <property name="jdiff.stable.javadoc" value="http://hadoop.apache.org/core/docs/r${jdiff.stable}/api/" /> |
| |
| <!--this is the naming policy for artifacts we want pulled down--> |
| <property name="ivy.artifact.retrieve.pattern" value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]" /> |
| <property name="jdiff.home" value="${build.ivy.lib.dir}/${ant.project.name}/jdiff" /> |
| <property name="jdiff.jar" value="${jdiff.home}/jdiff-${jdiff.version}.jar" /> |
| <property name="xerces.jar" value="${jdiff.home}/xerces-${xerces.version}.jar" /> |
| |
| <property name="clover.jar" location="${clover.home}/lib/clover.jar" /> |
| <available property="clover.present" file="${clover.jar}" /> |
| |
| </target> |
| |
| <target name="ivy-download-local" description="To download ivy" unless="offline"> |
| <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true" /> |
| </target> |
| |
| <target name="ivy-init-dirs-local" depends="ivy-init-properties-local"> |
| <mkdir dir="${build.ivy.dir}" /> |
| <mkdir dir="${build.ivy.lib.dir}" /> |
| <mkdir dir="${build.ivy.report.dir}" /> |
| </target> |
| |
| <target name="ivy-probe-antlib-local"> |
| <condition property="ivy.found.local"> |
| <typefound uri="antlib:org.apache.ivy.ant" name="cleancache" /> |
| </condition> |
| </target> |
| |
| <target name="ivy-init-antlib-local" depends="ivy-init-dirs-local,ivy-download-local,ivy-probe-antlib-local" unless="ivy.found.local"> |
| <typedef uri="antlib:org.apache.ivy.ant" onerror="fail" loaderRef="ivyLoader"> |
| <classpath> |
| <pathelement location="${ivy.jar}" /> |
| </classpath> |
| </typedef> |
| <fail> |
| <condition> |
| <not> |
| <typefound uri="antlib:org.apache.ivy.ant" name="cleancache" /> |
| </not> |
| </condition> |
| You need Apache Ivy 2.0 or later from http://ant.apache.org/ |
| It could not be loaded from ${ivy_repo_url} |
| </fail> |
| </target> |
| |
| <target name="ivy-init-local" depends="ivy-init-antlib-local"> |
| <ivy:configure settingsid="${ant.project.name}.ivy.settings" file="${ivysettings.xml}" override="true" /> |
| </target> |
| |
| <target name="ivy-retrieve" depends="ivy-resolve" description="Retrieve Ivy-managed artifacts for the compile/test configurations"> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" /> |
| <ivy:cachepath pathid="contrib-classpath" conf="common" /> |
| </target> |
| |
| <target name="ivy-resolve" depends="ivy-init-local"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" /> |
| </target> |
| |
| <target name="ivy-resolve-javadoc" depends="ivy-init-local"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="javadoc" /> |
| </target> |
| |
| <target name="ivy-resolve-checkstyle" depends="ivy-init-local"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="checkstyle" /> |
| </target> |
| |
| <target name="ivy-retrieve-checkstyle" depends="ivy-resolve-checkstyle" description="Retrieve Ivy-managed artifacts for the checkstyle configurations"> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" /> |
| <ivy:cachepath pathid="checkstyle-classpath" conf="checkstyle" /> |
| </target> |
| |
| <target name="ivy-resolve-test" depends="ivy-init-local"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="test" /> |
| </target> |
| |
| <target name="ivy-resolve-common" depends="ivy-init-local"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common" /> |
| </target> |
| |
| <target name="ivy-resolve-jdiff" depends="ivy-init-local"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="jdiff" /> |
| </target> |
| |
| <target name="ivy-retrieve-jdiff" depends="ivy-resolve-jdiff" description="Retrieve Ivy-managed artifacts for the javadoc configurations"> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" /> |
| <ivy:cachepath pathid="jdiff-classpath" conf="jdiff" /> |
| </target> |
| |
| <target name="ivy-retrieve-javadoc" depends="ivy-resolve-javadoc" description="Retrieve Ivy-managed artifacts for the javadoc configurations"> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" /> |
| <ivy:cachepath pathid="javadoc-classpath" conf="javadoc" /> |
| </target> |
| |
| <target name="ivy-retrieve-test" depends="ivy-resolve-test" description="Retrieve Ivy-managed artifacts for the test configurations"> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" /> |
| <ivy:cachepath pathid="test.classpath" conf="test" /> |
| </target> |
| |
| <target name="ivy-retrieve-common" depends="ivy-resolve-common" description="Retrieve Ivy-managed artifacts for the compile configurations"> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" /> |
| <ivy:cachepath pathid="ivy-common.classpath" conf="common" /> |
| </target> |
| |
| <target name="ivy-report" depends="ivy-resolve-releaseaudit" description="Generate"> |
| <ivy:report todir="${build.ivy.report.dir}" settingsRef="${ant.project.name}.ivy.settings" /> |
| <echo> |
| Reports generated:${build.ivy.report.dir} |
| </echo> |
| </target> |
| |
| |
| <target name="init" depends=""> |
| |
| <mkdir dir="${build.dir}" /> |
| <mkdir dir="${build.classes}" /> |
| <mkdir dir="${build.dir}/test" /> |
| |
| </target> |
| |
| <target name="main" depends="init,compile,jar" description="Main target"> |
| <echo> |
| Building the .jar files. |
| </echo> |
| </target> |
| |
| <target name="compile" depends="compile-src,jar" description="Compile"> |
| </target> |
| |
| <target name="compile-src" depends="init" description="Compile"> |
| <javac srcdir="src/java" destdir="${build.classes}" debug="${javac.debug}"> |
| <compilerarg value="-Xlint" /> |
| <include name="edu/berkeley/chukwa_xtrace/**" /> |
| <classpath refid="xtr-classpath" /> |
| </javac> |
| </target> |
| |
| |
| <target name="jar" depends="compile-src" description="Create chukwa-xtrace.jar"> |
| <jar jarfile="${build.dir}/chukwa-xtrace.jar" basedir="${build.classes}" includes="edu/berkeley/chukwa_xtrace/**/*.class"> |
| <fileset dir="${basedir}/src/java"> |
| <include name="edu/berkeley/chukwa_xtrace/*.java" /> |
| </fileset> |
| </jar> |
| |
| <copy file="${build.dir}/chukwa-xtrace.jar" tofile="${basedir}/chukwa-xtrace.jar" /> |
| </target> |
| |
| <path id="xtr-classpath"> |
| <pathelement location="${build.classes}" /> |
| <pathelement location="${test.build.classes}" /> |
| <pathelement location="${chukwa.root.build.classes}" /> |
| <fileset dir="${basedir}/lib"> |
| <include name="**/*.jar" /> |
| <exclude name="**/excluded/" /> |
| </fileset> |
| <fileset dir="../../build/"> |
| <include name="chukwa*.jar" /> |
| <exclude name="**/excluded/" /> |
| </fileset> |
| <fileset dir="../../hadoopjars/"> |
| <include name="hadoop*.jar" /> |
| <exclude name="**/excluded/" /> |
| </fileset> |
| <fileset dir="../../build/ivy/lib/chukwa/common/"> |
| <include name="**/*.jar" /> |
| <exclude name="**/excluded/" /> |
| </fileset> |
| </path> |
| |
| <target name="compile-test" depends="init,compile,jar" description="Test target"> |
| <echo>*** Building Test Sources ***</echo> |
| <echo>*** ${build.classes} ***</echo> |
| <mkdir dir="${test.log.dir}"/> |
| <mkdir dir="${test.build.dir}" /> |
| <mkdir dir="${test.log.dir}" /> |
| <mkdir dir="${test.build.classes}" /> |
| |
| <javac srcdir="test/src/java" destdir="${test.build.classes}" debug="${javac.debug}"> |
| <compilerarg value="-Xlint" /> |
| <include name="edu/berkeley/chukwa_xtrace/**" /> |
| <classpath refid="xtr-classpath" /> |
| |
| </javac> |
| |
| </target> |
| |
| <target name="test" depends="init,compile-test" description="chukwa-xtrace tests"> |
| <delete dir="${test.log.dir}"/> |
| <mkdir dir="${test.log.dir}"/> |
| <echo>*** ${test.build.classes} *** ${chukwa.root.build.dir} ***</echo> |
| <junit showoutput="${test.output}" printsummary="yes" haltonfailure="no" fork="yes" |
| maxmemory="256m" |
| dir="${basedir}" |
| timeout="${test.timeout}" |
| errorProperty="tests.failed" |
| failureProperty="tests.failed"> |
| <sysproperty key="chukwa.root.build.dir" value="${chukwa.root.build.dir}" /> |
| <sysproperty key="chukwa-xtr.build.dir" value="${build.dir}" /> |
| <sysproperty key="hod.server" value="" /> |
| <sysproperty key="hadoop.log.dir" value="${test.log.dir}"/> |
| |
| <classpath> |
| <pathelement location="${build.classes}" /> |
| <pathelement location="${test.build.classes}" /> |
| <path refid="xtr-classpath"/> |
| </classpath> |
| |
| <formatter type="${test.junit.output.format}" /> |
| |
| |
| <batchtest fork="yes" todir="${test.log.dir}" unless="testcase"> |
| <fileset dir="${test.src.dir}"> |
| <include name="**/${test.include}.java" /> |
| <exclude name="**/${test.exclude}.java" /> |
| </fileset> |
| </batchtest> |
| <batchtest todir="${test.log.dir}" if="testcase"> |
| <fileset dir="${test.src.dir}" includes="**/${testcase}.java"> |
| </fileset> |
| </batchtest> |
| </junit> |
| <fail if="tests.failed">Tests failed!</fail> |
| |
| |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Clean. Delete the build files, and their directories --> |
| <!-- ================================================================== --> |
| <target name="clean" depends="init" description="Clean. Delete the build files, and their directories"> |
| <delete dir="${build.dir}" /> |
| <delete dir="${build.ivy.lib.dir}/${ant.project.home}" /> |
| <delete dir="build" /> |
| <delete file="${ivy.jar}" /> |
| <delete dir="${docs.src}/build" /> |
| <delete dir="${test.build.dir}" /> |
| <delete dir="${test.log.dir}" /> |
| <delete dir="${test.build.classes}" /> |
| <delete file="${basedir}/chukwa-xtr.jar" /> |
| </target> |
| |
| |
| <!-- ================================================================== --> |
| <!-- Perform audit activities for the release --> |
| <!-- ================================================================== --> |
| <target name="releaseaudit" depends="ivy-retrieve-releaseaudit" description="Release Audit activities"> |
| <java classname="${rat.reporting.classname}" fork="true"> |
| <classpath refid="releaseaudit-classpath" /> |
| <arg value="${build.dir}/${final.name}" /> |
| </java> |
| </target> |
| |
| <target name="ivy-retrieve-releaseaudit" depends="ivy-resolve-releaseaudit" description="Retrieve Ivy-managed artifacts for the compile configurations"> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" /> |
| <ivy:cachepath pathid="releaseaudit-classpath" conf="releaseaudit" /> |
| </target> |
| |
| <target name="ivy-resolve-releaseaudit" depends="ivy-init-local"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="releaseaudit" /> |
| </target> |
| |
| </project> |