| <!-- |
| 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="Pig" default="jar" xmlns:ivy="antlib:org.apache.ivy.ant"> |
| <!-- Load all the default properties, and any the user wants --> |
| <!-- to contribute (without having to type -D or edit this file --> |
| <property file="${user.home}/build.properties" /> |
| <property file="${basedir}/build.properties" /> |
| |
| <!-- name and version properties --> |
| <property name="name" value="pig" /> |
| <property name="Name" value="Pig" /> |
| <property name="version" value="0.5.0-dev" /> |
| <property name="final.name" value="${name}-${version}" /> |
| <condition property="isWindows"> |
| <os family="windows"/> |
| </condition> |
| |
| <!-- source properties --> |
| <property name="lib.dir" value="${basedir}/lib/" /> |
| <property name="src.dir" value="${basedir}/src/" /> |
| <property name="src.lib.dir" value="${basedir}/lib-src/" /> |
| <property name="src.gen.dir" value="${basedir}/src-gen/" /> |
| <property name="docs.dir" value="${basedir}/src/docs/" /> |
| |
| |
| <!-- build properties --> |
| <property name="build.dir" value="${basedir}/build" /> |
| <property name="build.classes" value="${build.dir}/classes" /> |
| <property name="build.docs" value="${build.dir}/docs" /> |
| <property name="build.javadoc" value="${build.docs}/api" /> |
| <property name="dist.dir" value="${build.dir}/${final.name}" /> |
| <!-- property name="build.encoding" value="ISO-8859-1" / --> |
| <property name="build.encoding" value="UTF8" /> |
| <!-- TODO with only one version of hadoop in the lib folder we do not need that anymore --> |
| <property name="hadoop.jarfile" value="hadoop20.jar" /> |
| <property name="hbase.jarfile" value="hbase-0.18.1.jar" /> |
| <property name="hbase.test.jarfile" value="hbase-0.18.1-test.jar" /> |
| |
| <!-- javac properties --> |
| <property name="javac.debug" value="on" /> |
| <property name="javac.optimize" value="on" /> |
| <property name="javac.deprecation" value="off" /> |
| <property name="javac.version" value="1.5" /> |
| <property name="javac.args" value="" /> |
| <!-- default warnings option --> |
| <property name="javac.args.warnings" value="-Xmaxwarns 1000000" /> |
| <!-- warnings option if all.warnings property is set on cmdline --> |
| <property name="javac.args.all.warnings" value="-Xmaxwarns 1000000 -Xlint" /> |
| |
| <!-- jar names. TODO we might want to use the svn reversion name in the name in case it is a dev version --> |
| <property name="output.jarfile" value="${build.dir}/${final.name}.jar" /> |
| <property name="output.jarfile.core" value="${build.dir}/${final.name}-core.jar" /> |
| <property name="output.jarfile.sources" value="${build.dir}/${final.name}-sources.jar" /> |
| <!-- Maintain old pig.jar in top level directory. --> |
| <property name="output.jarfile.backcompat" value="${basedir}/${name}.jar" /> |
| |
| <!-- test properties --> |
| <property name="test.src.dir" value="${basedir}/test" /> |
| <property name="test.build.dir" value="${build.dir}/test" /> |
| <property name="test.build.classes" value="${test.build.dir}/classes" /> |
| <property name="test.log.dir" value="${test.build.dir}/logs" /> |
| <property name="test.timeout" value="2700000" /> |
| <property name="test.junit.output.format" value="plain" /> |
| |
| <!-- test configuration, use ${user.home}/build.properties to configure values --> |
| <property name="ssh.gateway" value="" /> |
| <property name="hod.server" value="" /> |
| <property name="junit.hadoop.conf" value="" /> |
| <property name="test.log.dir" value="${basedir}/test/logs"/> |
| <property name="junit.hadoop.conf" value="${user.home}/pigtest/conf/"/> |
| <property name="test.output" value="no"/> |
| |
| <!-- javacc properties --> |
| <property name="src.gen.query.parser.dir" value="${src.gen.dir}/org/apache/pig/impl/logicalLayer/parser" /> |
| <property name="src.gen.script.parser.dir" value="${src.gen.dir}/org/apache/pig/tools/pigscript/parser" /> |
| <property name="src.gen.param.parser.dir" value="${src.gen.dir}/org/apache/pig/tools/parameters" /> |
| <property name="src.gen.dot.parser.dir" value="${test.src.dir}/org/apache/pig/test/utils/dotGraph/parser" /> |
| <property name="src.gen.textdata.parser.dir" value="${src.gen.dir}/org/apache/pig/data/parser" /> |
| |
| <!-- rats properties --> |
| <property name="rat.reporting.classname" value="rat.Report"/> |
| |
| <!-- javadoc properties --> |
| <property name="javadoc.link.java" value="http://java.sun.com/j2se/1.5.0/docs/api/" /> |
| |
| <!-- test patch properties --> |
| <property name="scratch.dir" value="${user.home}/tmp"/> |
| <property name="svn.cmd" value="svn"/> |
| <property name="grep.cmd" value="grep"/> |
| <property name="patch.cmd" value="patch"/> |
| <property name="make.cmd" value="make"/> |
| <property name="test_patch_sh" value="${test.src.dir}/bin/test-patch.sh"/> |
| |
| <property name="clover.db.dir" location="${build.dir}/test/clover/db"/> |
| <property name="clover.report.dir" location="${build.dir}/test/clover/reports"/> |
| <property name="clover.jar" location="${clover.home}/lib/clover.jar"/> |
| <available property="clover.present" file="${clover.jar}" /> |
| <!-- check if clover reports should be generated --> |
| <condition property="clover.enabled"> |
| <and> |
| <isset property="run.clover"/> |
| <isset property="clover.present"/> |
| </and> |
| </condition> |
| |
| <!-- IVY properteis set here --> |
| <property name="ivy.dir" location="ivy" /> |
| <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="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" /> |
| <property name="ivy.org" value="org.apache.pig"/> |
| <property name="build.dir" location="build" /> |
| <property name="dist.dir" value="${build.dir}/${final.name}"/> |
| <property name="build.ivy.dir" location="${build.dir}/ivy" /> |
| <property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" /> |
| <property name="ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}"/> |
| <property name="build.ivy.report.dir" location="${build.ivy.dir}/report" /> |
| <property name="build.ivy.maven.dir" location="${build.ivy.dir}/maven" /> |
| <property name="build.ivy.maven.pom" location="${build.ivy.maven.dir}/pig-${version}.pom" /> |
| <property name="build.ivy.maven.jar" location="${build.ivy.maven.dir}/pig-${version}.jar" /> |
| <property name="javacc.home" location="${ivy.lib.dir}" /> |
| |
| <!--this is the naming policy for artifacts we want pulled down--> |
| <property name="ivy.artifact.retrieve.pattern" value="${ant.project.name}/[artifact]-[revision].[ext]"/> |
| |
| <!--this is how artifacts that get built are named--> |
| <property name="ivy.publish.pattern" value="pig-[revision].[ext]"/> |
| <property name="pig.jar" value="${output.jarfile.core}"/> |
| |
| |
| <!-- jdiff properties --> |
| <property name="jdiff.jar" value="${ivy.lib.dir}/jdiff-${jdiff.version}.jar"/> |
| <property name="xerces.jar" value="${ivy.lib.dir}/xerces-${xerces.version}.jar"/> |
| <property name="jdiff.build.dir" value="${build.docs}/jdiff"/> |
| <property name="jdiff.xml.dir" value="${lib.dir}/jdiff"/> |
| <property name="jdiff.stable" value="0.3.1"/> |
| <property name="jdiff.stable.javadoc" value="http://hadoop.apache.org/${name}/docs/r${jdiff.stable}/api/"/> |
| |
| <!-- ====================================================== --> |
| <!-- Stuff needed by all targets --> |
| <!-- ====================================================== --> |
| <!-- setup the classpath --> |
| <path id="classpath"> |
| <path refid="compile.classpath"/> |
| <fileset file="${lib.dir}/${hadoop.jarfile}" /> |
| <fileset file="${lib.dir}/${hbase.jarfile}" /> |
| <fileset file="${lib.dir}/${hbase.test.jarfile}" /> |
| <!-- <fileset file="${lib.dir}/commons-collections-3.2.jar" /> --> |
| </path> |
| |
| <!-- javadoc-classpath --> |
| <path id="javadoc-classpath"> |
| <fileset file="${lib.dir}/${hbase.jarfile}" /> |
| <fileset file="${lib.dir}/${hbase.test.jarfile}" /> |
| <path refid="javadoc.classpath"/> |
| </path> |
| |
| <path id="test.classpath"> |
| <pathelement location="${build.classes}"/> |
| <pathelement location="${test.src.dir}"/> |
| <path refid="classpath"/> |
| <path refid="test-classpath"/> |
| </path> |
| |
| <target name="init" depends="ivy-compile" > |
| <mkdir dir="${src.gen.query.parser.dir}" /> |
| <mkdir dir="${src.gen.script.parser.dir}" /> |
| <mkdir dir="${src.gen.param.parser.dir}" /> |
| <mkdir dir="${dist.dir}" /> |
| <mkdir dir="${build.classes}" /> |
| <mkdir dir="${test.build.classes}" /> |
| <mkdir dir="${src.gen.dot.parser.dir}" /> |
| <mkdir dir="${src.gen.textdata.parser.dir}" /> |
| <tstamp> |
| <format property="timestamp" pattern="MMM dd yyyy, HH:mm:ss" /> |
| </tstamp> |
| <svnversion outputproperty="svn.revision"/> |
| </target> |
| |
| <macrodef name="svnversion"> |
| <!-- the path needs to be small content otherwise it will take AGES ! --> |
| <attribute name="wcpath" default="${basedir}" /> |
| <attribute name="outputproperty" /> |
| <sequential> |
| <exec executable="svnversion" outputproperty="@{outputproperty}" failonerror="false" failifexecutionfails="false" > |
| <arg value="@{wcpath}" /> |
| <redirector> |
| <outputfilterchain> |
| <tokenfilter> |
| <!-- version can be xxxx, xxxx:yyyy, xxxxM, xxxxS or xxxx:yyyyMS , ... just get the working copy one --> |
| <replaceregex pattern="((\d+).*)" replace="\2" /> |
| </tokenfilter> |
| </outputfilterchain> |
| </redirector> |
| </exec> |
| </sequential> |
| </macrodef> |
| |
| |
| <!-- ================================================================== --> |
| <!-- Clean. Delete the build files, and their directories --> |
| <!-- ================================================================== --> |
| <target name="clean" description="Cleanup build artifacts"> |
| <delete dir="${src.gen.dir}" /> |
| <delete dir="${docs.dir}/build" /> |
| <delete file="${jdiff.xml.dir}\${name}_${version}.xml" /> |
| <delete dir="${build.dir}" /> |
| <delete dir="${src.gen.dot.parser.dir}" /> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Java Compiler Compiler, generate Parsers --> |
| <!-- ================================================================== --> |
| <target name="cc-compile" depends="init, ivy-compile" description="Create and Compile Parser"> |
| <move file="${ivy.lib.dir}/javacc-${javacc.version}.jar" tofile="${javacc.home}/javacc.jar"/> |
| <jjtree target="${src.dir}/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt" outputdirectory="${src.gen.query.parser.dir}" javacchome="${javacc.home}" /> |
| <javacc target="${src.gen.query.parser.dir}/QueryParser.jj" outputdirectory="${src.gen.query.parser.dir}" javacchome="${javacc.home}" /> |
| <javacc target="${src.dir}/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj" outputdirectory="${src.gen.script.parser.dir}" javacchome="${javacc.home}" /> |
| <javacc target="${src.dir}/org/apache/pig/tools/parameters/PigFileParser.jj" outputdirectory="${src.gen.param.parser.dir}" javacchome="${javacc.home}" /> |
| <javacc target="${src.dir}/org/apache/pig/tools/parameters/ParamLoader.jj" outputdirectory="${src.gen.param.parser.dir}" javacchome="${javacc.home}" /> |
| <jjtree target="${test.src.dir}/org/apache/pig/test/utils/dotGraph/DOTParser.jjt" outputdirectory="${src.gen.dot.parser.dir}" javacchome="${javacc.home}" /> |
| <javacc target="${src.gen.dot.parser.dir}/DOTParser.jj" outputdirectory="${src.gen.dot.parser.dir}" javacchome="${javacc.home}" /> |
| <jjtree target="${src.dir}/org/apache/pig/data/parser/TextDataParser.jjt" outputdirectory="${src.gen.textdata.parser.dir}/" javacchome="${javacc.home}" /> |
| <javacc target="${src.gen.textdata.parser.dir}/TextDataParser.jj" outputdirectory="${src.gen.textdata.parser.dir}" javacchome="${javacc.home}" /> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Build sources --> |
| <!-- ================================================================== --> |
| <target name="compile" depends="cc-compile" description="Compile all artifacts"> |
| <echo>*** Building Main Sources ***</echo> |
| <echo>*** To compile with all warnings enabled, supply -Dall.warnings=1 on command line ***</echo> |
| <echo>*** If all.warnings property is supplied, compile-sources-all-warnings target will be executed ***</echo> |
| <echo>*** Else, compile-sources (which only warns about deprecations) target will be executed ***</echo> |
| |
| <antcall target="compile-sources" inheritRefs="true" inheritall="true"> |
| <param name="sources" value="${src.dir};${src.gen.dir};${src.lib.dir}/shock;${src.lib.dir}/bzip2" /> |
| <param name="dist" value="${build.classes}" /> |
| <param name="cp" value="classpath" /> |
| </antcall> |
| |
| <antcall target="compile-sources-all-warnings" inheritRefs="true" inheritall="true"> |
| <param name="sources" value="${src.dir};${src.gen.dir};${src.lib.dir}/shock;${src.lib.dir}/bzip2" /> |
| <param name="dist" value="${build.classes}" /> |
| <param name="cp" value="classpath" /> |
| </antcall> |
| |
| </target> |
| |
| <target name="compile-test" depends="compile, ivy-test"> |
| <echo>*** Building Test Sources ***</echo> |
| <echo>*** To compile with all warnings enabled, supply -Dall.warnings=1 on command line ***</echo> |
| <echo>*** If all.warnings property is supplied, compile-sources-all-warnings target will be executed ***</echo> |
| <echo>*** Else, compile-sources (which only warns about deprecations) target will be executed ***</echo> |
| |
| <antcall target="compile-sources" inheritRefs="true" inheritall="true"> |
| <param name="sources" value="${test.src.dir}" /> |
| <param name="dist" value="${test.build.classes}" /> |
| <param name="cp" value="test.classpath" /> |
| </antcall> |
| |
| <antcall target="compile-sources-all-warnings" inheritRefs="true" inheritall="true"> |
| <param name="sources" value="${test.src.dir}" /> |
| <param name="dist" value="${test.build.classes}" /> |
| <param name="cp" value="test.classpath" /> |
| </antcall> |
| |
| </target> |
| |
| <!-- This target is for default compilation --> |
| <target name="compile-sources" unless="all.warnings"> |
| <javac encoding="${build.encoding}" srcdir="${sources}" |
| includes="**/*.java" destdir="${dist}" debug="${javac.debug}" |
| optimize="${javac.optimize}" target="${javac.version}" |
| source="${javac.version}" deprecation="${javac.deprecation}"> |
| <compilerarg line="${javac.args} ${javac.args.warnings}"/> |
| <classpath refid="${cp}" /> |
| </javac> |
| <copy file="${src.dir}/org/apache/pig/tools/grunt/autocomplete" todir="${build.classes}/org/apache/pig/tools/grunt"/> |
| <copy file="${src.dir}/org/apache/pig/tools/grunt/autocomplete_aliases" todir="${build.classes}/org/apache/pig/tools/grunt"/> |
| </target> |
| |
| <!-- this target is for compilation with all warnings enabled --> |
| <target name="compile-sources-all-warnings" if="all.warnings"> |
| <javac encoding="${build.encoding}" srcdir="${sources}" |
| includes="**/*.java" destdir="${dist}" debug="${javac.debug}" |
| optimize="${javac.optimize}" target="${javac.version}" |
| source="${javac.version}" deprecation="${javac.deprecation}"> |
| <compilerarg line="${javac.args} ${javac.args.all.warnings} "/> |
| <classpath refid="${cp}" /> |
| </javac> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Documentation --> |
| <!-- ================================================================== --> |
| <target name="javadoc" depends="jar, ivy-javadoc" description="Create documentation"> |
| <mkdir dir="${build.javadoc}" /> |
| <javadoc overview="${src.dir}/overview.html" packagenames="org.apache.pig.*" destdir="${build.javadoc}" author="true" version="true" use="true" windowtitle="${Name} ${version} API" doctitle="${Name} ${version} API" bottom="Copyright &copy; ${year} The Apache Software Foundation"> |
| <packageset dir="${src.dir}" /> |
| <link href="${javadoc.link.java}" /> |
| <classpath> |
| <path refid="javadoc-classpath" /> |
| <pathelement path="${output.jarfile}" /> |
| </classpath> |
| <group title="pig" packages="org.apache.*" /> |
| </javadoc> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- @depricated, Documentation --> |
| <!-- ================================================================== --> |
| <target name="docs" depends="forrest.check, javadoc" description="Generate forrest-based documentation. |
| To use, specify -Dforrest.home=<base of Apache Forrest installation> on the command line." if="forrest.home"> |
| <exec dir="${docs.dir}" executable="${forrest.home}/bin/forrest" |
| failonerror="true"> |
| <env key="JAVA_HOME" value="${java5.home}"/> |
| </exec> |
| <copy todir="${build.docs}"> |
| <fileset dir="${docs.dir}/build/site/" /> |
| </copy> |
| </target> |
| |
| <target name="forrest.check" unless="forrest.home" depends="java5.check"> |
| <fail message="'forrest.home' is not defined. |
| Please pass -Dforrest.home=<base of Apache Forrest installation> to Ant on the command-line." /> |
| </target> |
| |
| <target name="java5.check" unless="java5.home"> |
| <fail message="'java5.home' is not defined. Forrest requires Java 5. |
| Please pass -Djava5.home=<base of Java 5 distribution> to Ant on the command-line." /> |
| </target> |
| |
| <target name="source-jar" depends="cc-compile"> |
| <jar duplicate="preserve" jarfile="${output.jarfile.sources}" basedir="${src.dir}"> |
| <manifest> |
| <section name="org/apache/pig"> |
| <attribute name="Implementation-Vendor" value="Apache" /> |
| <attribute name="Implementation-Title" value="Pig" /> |
| <attribute name="Implementation-Version" value="${version}" /> |
| </section> |
| </manifest> |
| <fileset dir="${src.gen.dir}"/> |
| <fileset dir="${src.lib.dir}/shock"/> |
| <fileset dir="${src.lib.dir}/bzip2"/> |
| </jar> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Make pig.jar --> |
| <!-- ================================================================== --> |
| <!-- TODO we should also exculte test here... --> |
| <!-- ================================================================== --> |
| <target name="jar" depends="compile" description="Create pig jar"> |
| <antcall target="jarWithSvn" inheritRefs="true" inheritall="true"/> |
| <antcall target="jarWithOutSvn" inheritRefs="true" inheritall="true"/> |
| </target> |
| |
| <target name="jarWithSvn" if="svn.revision"> |
| <antcall target="buildJar" inheritRefs="true" inheritall="true"> |
| <param name="svnString" value="${svn.revision}" /> |
| </antcall> |
| </target> |
| |
| <target name="jarWithOutSvn" unless="svn.revision"> |
| <antcall target="buildJar" inheritRefs="true" inheritall="true"> |
| <param name="svnString" value=": unknown" /> |
| </antcall> |
| </target> |
| |
| <target name="buildJar" depends="ivy-buildJar"> |
| <echo>svnString ${svnString}</echo> |
| <jar jarfile="${output.jarfile.core}" basedir="${build.classes}"> |
| <manifest> |
| <attribute name="Main-Class" value="org.apache.pig.Main" /> |
| <section name="org/apache/pig"> |
| <attribute name="Implementation-Vendor" value="Apache" /> |
| <attribute name="Implementation-Title" value="Pig" /> |
| <attribute name="Implementation-Version" value="${version}" /> |
| <attribute name="Build-TimeStamp" value="${timestamp}" /> |
| <attribute name="Svn-Revision" value="${svnString}" /> |
| </section> |
| </manifest> |
| </jar> |
| <!-- @depricated --> |
| <jar jarfile="${output.jarfile}" basedir="${build.classes}"> |
| <manifest> |
| <attribute name="Main-Class" value="org.apache.pig.Main" /> |
| <section name="org/apache/pig"> |
| <attribute name="Implementation-Vendor" value="Apache" /> |
| <attribute name="Implementation-Title" value="Pig" /> |
| <attribute name="Implementation-Version" value="${version}" /> |
| <attribute name="Build-TimeStamp" value="${timestamp}" /> |
| <attribute name="Svn-Revision" value="${svnString}" /> |
| </section> |
| </manifest> |
| <zipfileset src="${lib.dir}/${hadoop.jarfile}" /> |
| <zipfileset src="${ivy.lib.dir}/junit-${junit.version}.jar" /> |
| <zipfileset src="${ivy.lib.dir}/jsch-${jsch.version}.jar" /> |
| <zipfileset src="${ivy.lib.dir}/jline-${jline.version}.jar" /> |
| </jar> |
| <copy file="${output.jarfile}" tofile="${output.jarfile.backcompat}"/> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Run unit tests --> |
| <!-- ================================================================== --> |
| <target name="test-core" depends="compile-test,jar"> |
| <delete dir="${test.log.dir}"/> |
| <mkdir dir="${test.log.dir}"/> |
| <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="ssh.gateway" value="${ssh.gateway}" /> |
| <sysproperty key="hod.server" value="${hod.server}" /> |
| <!-- <sysproperty key="hod.command" value="${hod.command}"/> |
| <sysproperty key="hod.param" value="${hod.param}"/> --> |
| <sysproperty key="hadoop.log.dir" value="${test.log.dir}"/> |
| <classpath> |
| <pathelement location="${output.jarfile}" /> |
| <pathelement location="${test.build.classes}" /> |
| <pathelement location="${junit.hadoop.conf}" /> |
| <pathelement path="${clover.jar}"/> |
| <path refid="classpath"/> |
| </classpath> |
| <formatter type="${test.junit.output.format}" /> |
| |
| |
| <batchtest fork="yes" todir="${test.log.dir}" unless="testcase"> |
| <fileset dir="test"> |
| <include name="**/*Test*.java" /> |
| <!-- Excluced because they are end-to-end, don't work yet. --> |
| <!-- |
| <exclude name="**/TestFilterOpNumeric.java" /> |
| <exclude name="**/TestPigFile.java" /> |
| <exclude name="**/TestStoreOld.java" /> |
| --> |
| <!-- Excluded under Windows.--> |
| <exclude name="**/TestHBaseStorage.java" if="isWindows" /> |
| <!-- Excluced because we don't want to run them --> |
| <exclude name="**/TestHBaseStorage.java" /> |
| <exclude name="**/PigExecTestCase.java" /> |
| <exclude name="**/TypeCheckingTestUtil.java" /> |
| <exclude name="**/TypeGraphPrinter.java" /> |
| <exclude name="**/LogicalPlanTester.java" /> |
| <exclude name="**/TestHelper.java" /> |
| <exclude name="**/TestLargeFile.java" /> |
| <exclude name="**/TestOrderBy.java" /> |
| <exclude name="**/TestOrderBy2.java" /> |
| <exclude name="**/TestPi.java" /> |
| <exclude name="**/nightly/**" /> |
| </fileset> |
| </batchtest> |
| <batchtest fork="yes" todir="${test.log.dir}" if="testcase"> |
| <fileset dir="test" includes="**/${testcase}.java"/> |
| </batchtest> |
| </junit> |
| <fail if="tests.failed">Tests failed!</fail> |
| </target> |
| |
| <target name="test" description="to call the test-core and test-contrib target"> |
| <antcall target="test-core" inheritRefs="true" inheritall="true"/> |
| <antcall target="test-contrib" inheritRefs="true" inheritall="true"/> |
| </target> |
| |
| <target name="test-contrib" description="to call contrib tests"> |
| <!--#### test-contrib is yet to be implemented #### --> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- D I S T R I B U T I O N --> |
| <!-- ================================================================== --> |
| <target name="package" depends="docs, api-report" description="Create a Pig release"> |
| <mkdir dir="${dist.dir}" /> |
| <mkdir dir="${dist.dir}/lib" /> |
| <mkdir dir="${dist.dir}/scripts" /> |
| <mkdir dir="${dist.dir}/docs" /> |
| <mkdir dir="${dist.dir}/docs/api" /> |
| <mkdir dir="${dist.dir}/docs/jdiff"/> |
| <mkdir dir="${dist.dir}/license" /> |
| |
| <copy todir="${dist.dir}/lib" includeEmptyDirs="false"> |
| <fileset dir="${ivy.lib.dir}"/> |
| <fileset dir="${lib.dir}"/> |
| </copy> |
| |
| <copy file="${output.jarfile.backcompat}" tofile="${dist.dir}/${final.name}-core.jar" /> |
| |
| <copy todir="${dist.dir}/" file="ivy.xml" /> |
| |
| <copy todir="${dist.dir}/ivy"> |
| <fileset dir="ivy" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/bin"> |
| <fileset dir="bin" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/docs"> |
| <fileset dir="${build.docs}" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/src" includeEmptyDirs="true"> |
| <fileset dir="${src.dir}" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/lib-src" includeEmptyDirs="true"> |
| <fileset dir="${src.lib.dir}" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/test" includeEmptyDirs="true"> |
| <fileset dir="${test.src.dir}" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/tutorial" includeEmptyDirs="true"> |
| <fileset dir="tutorial" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/contrib" includeEmptyDirs="true"> |
| <fileset dir="contrib" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/" file="build.xml" /> |
| |
| <copy todir="${dist.dir}"> |
| <fileset dir="."> |
| <include name="*.txt" /> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}/license"> |
| <fileset dir="license" /> |
| </copy> |
| |
| <chmod perm="ugo+x" type="file"> |
| <fileset dir="${dist.dir}/bin" /> |
| </chmod> |
| |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Make release tarball --> |
| <!-- ================================================================== --> |
| <target name="tar" depends="package" description="Create release tarball"> |
| <tar compression="gzip" longfile="gnu" destfile="${build.dir}/${final.name}.tar.gz"> |
| <tarfileset dir="${build.dir}" mode="664"> |
| <exclude name="${final.name}/bin/*" /> |
| <include name="${final.name}/**" /> |
| </tarfileset> |
| <tarfileset dir="${build.dir}" mode="755"> |
| <include name="${final.name}/bin/*" /> |
| </tarfileset> |
| </tar> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Findbugs --> |
| <!-- ================================================================== --> |
| |
| <property name="findbugs.home" value=""/> |
| <target name="findbugs" depends="check-for-findbugs, jar" if="findbugs.present" description="Run findbugs if present"> |
| <property name="findbugs.out.dir" value="${test.build.dir}/findbugs"/> |
| <property name="findbugs.report.htmlfile" value="${findbugs.out.dir}/pig-findbugs-report.html"/> |
| <property name="findbugs.report.xmlfile" value="${findbugs.out.dir}/pig-findbugs-report.xml"/> |
| <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" |
| classpath="${findbugs.home}/lib/findbugs-ant.jar" /> |
| <mkdir dir="${findbugs.out.dir}"/> |
| <findbugs home="${findbugs.home}" output="xml:withMessages" |
| outputFile="${findbugs.report.xmlfile}" effort="max" jvmargs="-Xmx512M"> |
| <auxClasspath> |
| <fileset dir="${lib.dir}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </auxClasspath> |
| <sourcePath path="${src.dir}"/> |
| <class location="${output.jarfile.core}" /> |
| </findbugs> |
| <xslt style="${findbugs.home}/src/xsl/default.xsl" in="${findbugs.report.xmlfile}" |
| out="${findbugs.report.htmlfile}"/> |
| </target> |
| |
| <target name="check-for-findbugs"> |
| <available property="findbugs.present" file="${findbugs.home}/lib/findbugs.jar" /> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Perform audit activities for the release --> |
| <!-- ================================================================== --> |
| <target name="releaseaudit" depends="ivy-releaseaudit, package" 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="checkstyle" depends="checkstyle.check, set-checkstyle-classpath" if="checkstyle.home" --> |
| <target name="checkstyle" depends="ivy-checkstyle" description="Run optional third-party tool targets"> |
| <taskdef resource="checkstyletask.properties"> |
| <classpath refid="checkstyle.classpath"/> |
| <!-- <classpath refid="checkstyle-classpath"/> --> |
| </taskdef> |
| <mkdir dir="${test.build.dir}"/> |
| <checkstyle config="${test.src.dir}/checkstyle.xml" failOnViolation="false"> |
| <fileset dir="${src.dir}" includes="**/*.java" excludes="**/generated/**"/> |
| <formatter type="xml" toFile="${test.build.dir}/checkstyle-errors.xml"/> |
| </checkstyle> |
| <xslt style="${test.src.dir}/checkstyle-noframes-sorted.xsl" in="${test.build.dir}/checkstyle-errors.xml" |
| out="${test.build.dir}/checkstyle-errors.html"/> |
| </target> |
| |
| <target name="checkstyle.check" unless="checkstyle.home"> |
| <fail message="'checkstyle.home' is not defined. Please pass -Dcheckstyle.home=<base of checkstyle installation> |
| to Ant on the command-line." /> |
| </target> |
| |
| <target name="set-checkstyle-classpath"> |
| <path id="checkstyle-classpath"> |
| <fileset dir="${checkstyle.home}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| </target> |
| |
| <target name="findbugs.check" depends="check-for-findbugs" unless="findbugs.present"> |
| <fail message="'findbugs.home' is not defined. Please pass -Dfindbugs.home=<base of Findbugs installation> |
| to Ant on the command-line." /> |
| </target> |
| |
| <target name="patch.check" unless="patch.file"> |
| <fail message="'patch.file' is not defined. Please pass -Dpatch.file=<location of patch file> |
| to Ant on the command-line." /> |
| </target> |
| |
| <target name="test-patch" depends="patch.check,findbugs.check,forrest.check"> |
| <exec executable="bash" failonerror="true"> |
| <arg value="${test_patch_sh}"/> |
| <arg value="DEVELOPER"/> |
| <arg value="${patch.file}"/> |
| <arg value="${scratch.dir}"/> |
| <arg value="${svn.cmd}"/> |
| <arg value="${grep.cmd}"/> |
| <arg value="${patch.cmd}"/> |
| <arg value="${findbugs.home}"/> |
| <arg value="${forrest.home}"/> |
| <arg value="${basedir}"/> |
| <arg value="${java5.home}"/> |
| <arg value="${ant.project.name}"/> |
| </exec> |
| </target> |
| |
| <target name="hudson-test-patch" depends="findbugs.check,forrest.check"> |
| <exec executable="bash" failonerror="true"> |
| <arg value="${test_patch_sh}"/> |
| <arg value="HUDSON"/> |
| <arg value="${scratch.dir}"/> |
| <arg value="${support.dir}"/> |
| <arg value="${ps.cmd}"/> |
| <arg value="${wget.cmd}"/> |
| <arg value="${jiracli.cmd}"/> |
| <arg value="${svn.cmd}"/> |
| <arg value="${grep.cmd}"/> |
| <arg value="${patch.cmd}"/> |
| <arg value="${findbugs.home}"/> |
| <arg value="${forrest.home}"/> |
| <arg value="${eclipse.home}"/> |
| <arg value="${python.home}"/> |
| <arg value="${basedir}"/> |
| <arg value="${trigger.url}"/> |
| <arg value="${jira.passwd}"/> |
| <arg value="${java5.home}"/> |
| <arg value="${curl.cmd}"/> |
| <arg value="${defect}"/> |
| <arg value="${ant.project.name}"/> |
| </exec> |
| </target> |
| |
| <target name="clover" depends="clover.setup, clover.info" description="Instrument the Unit tests using Clover. |
| To use, specify -Dclover.home=<base of clover installation> -Drun.clover=true on the command line."/> |
| |
| <target name="clover.setup" if="clover.enabled"> |
| <taskdef resource="cloverlib.xml" classpath="${clover.jar}"/> |
| <mkdir dir="${clover.db.dir}"/> |
| <clover-setup initString="${clover.db.dir}/pig_coverage.db"> |
| <fileset dir="src" includes="**/*.java"/> |
| </clover-setup> |
| </target> |
| |
| <target name="clover.info" unless="clover.present"> |
| <echo> |
| Clover not found. Code coverage reports disabled. |
| </echo> |
| </target> |
| |
| <target name="clover.check"> |
| <fail unless="clover.present"> |
| ################################################################## |
| Clover not found. |
| Please specify -Dclover.home=<base of clover installation> |
| on the command line. |
| ################################################################## |
| </fail> |
| </target> |
| |
| <target name="generate-clover-reports" depends="clover.check, clover"> |
| <mkdir dir="${clover.report.dir}"/> |
| <clover-report> |
| <current outfile="${clover.report.dir}" title="${final.name}"> |
| <format type="html"/> |
| </current> |
| </clover-report> |
| <clover-report> |
| <current outfile="${clover.report.dir}/clover.xml" title="${final.name}"> |
| <format type="xml"/> |
| </current> |
| </clover-report> |
| </target> |
| |
| <target name="api-xml" depends="ivy-jdiff, javadoc, write-null"> |
| <javadoc> |
| <doclet name="jdiff.JDiff" |
| path="${jdiff.jar}:${xerces.jar}"> |
| <param name="-apidir" value="${jdiff.xml.dir}"/> |
| <param name="-apiname" value="${name} ${version}"/> |
| </doclet> |
| <packageset dir="${src.dir}"/> |
| <classpath> |
| <path refid="javadoc-classpath" /> |
| <pathelement path="${output.jarfile}" /> |
| </classpath> |
| </javadoc> |
| </target> |
| <target name="write-null"> |
| <exec executable="touch"> |
| <arg value="${build.dir}/Null.java"/> |
| </exec> |
| </target> |
| |
| <target name="api-report" depends="api-xml"> |
| <mkdir dir="${jdiff.build.dir}"/> |
| <javadoc sourcepath="${src.dir}" |
| destdir="${jdiff.build.dir}" |
| sourceFiles="${build.dir}/Null.java"> |
| <doclet name="jdiff.JDiff" path="${jdiff.jar}:${xerces.jar}"> |
| <param name="-oldapi" value="${name} ${jdiff.stable}"/> |
| <param name="-newapi" value="${name} ${version}"/> |
| <param name="-oldapidir" value="${jdiff.xml.dir}"/> |
| <param name="-newapidir" value="${jdiff.xml.dir}"/> |
| <param name="-javadocold" value="${jdiff.stable.javadoc}"/> |
| <param name="-javadocnew" value="../../api/"/> |
| <param name="-stats"/> |
| </doclet> |
| <classpath> |
| <path refid="javadoc-classpath" /> |
| <pathelement path="${output.jarfile}" /> |
| </classpath> |
| </javadoc> |
| </target> |
| |
| <target name="ivy-init-dirs"> |
| <mkdir dir="${build.ivy.dir}" /> |
| <mkdir dir="${build.ivy.lib.dir}" /> |
| <mkdir dir="${build.ivy.report.dir}" /> |
| <mkdir dir="${build.ivy.maven.dir}" /> |
| </target> |
| |
| <target name="ivy-probe-antlib" > |
| <condition property="ivy.found"> |
| <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/> |
| </condition> |
| </target> |
| |
| <target name="ivy-download" description="To download ivy"> |
| <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/> |
| </target> |
| |
| <!-- |
| To avoid Ivy leaking things across big projects, always load Ivy in the same classloader. |
| Also note how we skip loading Ivy if it is already there, just to make sure all is well. |
| --> |
| <target name="ivy-init-antlib" depends="ivy-download,ivy-init-dirs,ivy-probe-antlib" unless="ivy.found"> |
| <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" depends="ivy-init-antlib" > |
| <!--Configure Ivy by reading in the settings file |
| If anyone has already read in a settings file into this settings ID, it gets priority |
| --> |
| <ivy:configure settingsid="${ant.project.name}.ivy.settings" file="${ivysettings.xml}" override='false'/> |
| </target> |
| |
| <target name="ivy-compile" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for compile configuration"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="compile"/> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
| pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="compile"/> |
| <ivy:cachepath pathid="compile.classpath" conf="compile"/> |
| </target> |
| |
| <target name="ivy-test" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for test configuration"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="test"/> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
| pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="test"/> |
| <ivy:cachepath pathid="test-classpath" conf="test"/> |
| </target> |
| |
| <target name="ivy-javadoc" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for javadoc configuration"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="javadoc"/> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
| pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="javadoc"/> |
| <ivy:cachepath pathid="javadoc.classpath" conf="javadoc"/> |
| </target> |
| |
| <target name="ivy-releaseaudit" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for releaseaudit configuration"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="releaseaudit"/> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
| pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="releaseaudit"/> |
| <ivy:cachepath pathid="releaseaudit.classpath" conf="releaseaudit"/> |
| </target> |
| |
| <target name="ivy-checkstyle" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for checkstyle configuration"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="checkstyle"/> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
| pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="checkstyle"/> |
| <ivy:cachepath pathid="checkstyle.classpath" conf="checkstyle"/> |
| </target> |
| |
| <target name="ivy-buildJar" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for buildJar configuration"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="buildJar"/> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
| pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="buildJar"/> |
| <ivy:cachepath pathid="buildJar.classpath" conf="buildJar"/> |
| </target> |
| |
| <target name="ivy-jdiff" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for jdiff configuration"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="jdiff"/> |
| <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
| pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="jdiff"/> |
| <ivy:cachepath pathid="jdiff.classpath" conf="jdiff"/> |
| </target> |
| |
| <target name="ivy-resolve" depends="ivy-init"> |
| <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="runtime"/> |
| </target> |
| |
| <target name="assert-pig-jar-exists" depends="ivy-init"> |
| <fail> |
| <condition > |
| <not> |
| <available file="${pig.jar}" /> |
| </not> |
| </condition> |
| Not found: ${pig.jar} |
| Please run the target "jar" in the main build file |
| </fail> |
| </target> |
| |
| <target name="ready-to-publish" depends="jar, assert-pig-jar-exists, ivy-resolve"/> |
| |
| <target name="ivy-publish-local" depends="ready-to-publish,ivy-resolve"> |
| <ivy:publish settingsRef="${ant.project.name}.ivy.settings" |
| resolver="local" pubrevision="${version}" overwrite="true" |
| artifactspattern="${build.dir}/${ivy.publish.pattern}"/> |
| </target> |
| |
| <!-- this is here for curiosity, to see how well the makepom task works |
| Answer: it depends whether you want transitive dependencies excluded or not |
| --> |
| <target name="makepom" depends="ivy-resolve"> |
| <ivy:makepom settingsRef="${ant.project.name}.ivy.settings" |
| ivyfile="ivy.xml" |
| pomfile="${build.ivy.maven.dir}/generated.pom"> |
| <ivy:mapping conf="default" scope="default"/> |
| <ivy:mapping conf="master" scope="master"/> |
| <ivy:mapping conf="runtime" scope="runtime"/> |
| </ivy:makepom> |
| </target> |
| |
| <target name="copy-jar-to-maven" depends="ready-to-publish"> |
| <copy file="${pig.jar}" tofile="${build.ivy.maven.jar}"/> |
| <checksum file="${build.ivy.maven.jar}" algorithm="md5"/> |
| </target> |
| |
| <target name="copypom" depends="ivy-init-dirs"> |
| <presetdef name="expandingcopy"> |
| <copy overwrite="true"> |
| <filterchain> |
| <expandproperties/> |
| </filterchain> |
| </copy> |
| </presetdef> |
| <expandingcopy file="ivy/pig.pom" tofile="${build.ivy.maven.pom}"/> |
| <checksum file="${build.ivy.maven.pom}" algorithm="md5"/> |
| </target> |
| |
| <target name="maven-artifacts" depends="copy-jar-to-maven, copypom" /> |
| |
| <target name="published" depends="ivy-publish-local, maven-artifacts"/> |
| |
| </project> |