blob: dccbecbf4ff828b3854d234665158c177e5e153f [file] [log] [blame]
<!--
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-all"
xmlns:artifact="urn:maven-artifact-ant"
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="ant-task.version" value="2.0.10" />
<property name="pig.pom" value="${basedir}/ivy/pig.pom" />
<property name="pigsmoke.pom" value="${basedir}/ivy/pigsmoke.pom" />
<property name="pigunit.pom" value="${basedir}/ivy/pigunit.pom" />
<property name="pig.version" value="0.10.1" />
<property name="version" value="${pig.version}-SNAPSHOT" />
<property name="final.name" value="${name}-${version}" />
<property name="year" value="2007-2012" />
<!-- 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="tar.dist.dir" value="${build.dir}/tar/${final.name}" />
<property name="rpm.dist.dir" value="${build.dir}/rpm/${final.name}" />
<!-- property name="build.encoding" value="ISO-8859-1" / -->
<property name="build.encoding" value="UTF8" />
<property name="automaton.jarfile" value="automaton.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 -Xlint:-deprecation" />
<!-- artifact jar file names -->
<property name="artifact.pig-h2.jar" value="${final.name}-h2.jar"/>
<!-- 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.stage.jarfile" value="${build.dir}/${final.name}.stage.jar" />
<property name="output.jarfile.withouthadoop" value="${build.dir}/${final.name}-withouthadoop.jar" />
<property name="output.stage.jarfile.withouthadoop" value="${build.dir}/${final.name}-withouthadoop.stage.jar" />
<property name="output.jarfile.core" value="${build.dir}/${final.name}-core.jar" />
<property name="output.jarfile.core-h2" value="${build.dir}/${artifact.pig-h2.jar}" />
<property name="output.jarfile.sources" value="${build.dir}/${final.name}-sources.jar" />
<property name="output.jarfile.javadoc" value="${build.dir}/${final.name}-javadoc.jar" />
<!-- Maintain old pig.jar in top level directory. -->
<property name="output.jarfile.backcompat.withouthadoop" value="${basedir}/${name}-withouthadoop.jar" />
<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="7200000" />
<property name="test.junit.output.format" value="plain" />
<property name="test.commit.file" value="${test.src.dir}/commit-tests"/>
<property name="test.unit.file" value="${test.src.dir}/unit-tests"/>
<property name="test.smoke.file" value="${test.src.dir}/smoke-tests"/>
<property name="test.all.file" value="${test.src.dir}/all-tests"/>
<property name="test.exclude.file" value="${test.src.dir}/excluded-tests"/>
<property name="test.exclude.file.23" value="${test.src.dir}/excluded-tests-23"/>
<property name="pigunit.jarfile" value="pigunit.jar" />
<property name="smoke.tests.jarfile" value="${build.dir}/${final.name}-smoketests.jar" />
<property name="test.pigunit.src.dir" value="${test.src.dir}/org/apache/pig/test/pigunit" />
<property name="commons-lang.jarfile" value="commons-lang-2.4.jar" />
<property name="test.pigunit.file" value="${test.src.dir}/pigunit-tests"/>
<!-- test configuration, use ${user.home}/build.properties to configure values -->
<property name="ssh.gateway" value="" />
<property name="hod.server" 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"/>
<!-- e2e test properties -->
<property name="test.e2e.dir" value="${basedir}/test/e2e/pig"/>
<!-- 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" />
<!-- Antlr Parser properties -->
<property name="grammar.name" value="Query"/>
<property name="grammar.name.lower" value="query"/>
<property name="grammar.package" value="org.apache.pig.parser"/>
<property name="grammar.package.dir" value="org/apache/pig/parser"/>
<property name="grammar.src.dir" value="${src.dir}/${grammar.package.dir}"/>
<!-- rats properties -->
<property name="rat.reporting.classname" value="rat.Report"/>
<!-- javadoc properties -->
<property name="javadoc.link.java" value="http://download.oracle.com/javase/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>
<condition property="staging">
<equals arg1="${repo}" arg2="staging"/>
</condition>
<!-- IVY properteis set here -->
<property name="ivy.repo.dir" value="${user.home}/ivyrepo" />
<property name="ivy.dir" location="ivy" />
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
<!--propertyregex property="hadoopversion"
input="${hadoop-core.version}"
regexp="\d+\.(\d+)\.\d+"
select="\1" /-->
<property name="hadoopversion" value="20" />
<condition property="isHadoop23">
<equals arg1="${hadoopversion}" arg2="23"/>
</condition>
<property name="src.shims.dir" value="${basedir}/shims/src/hadoop${hadoopversion}" />
<property name="src.shims.test.dir" value="${basedir}/shims/test/hadoop${hadoopversion}" />
<property name="hadoop.jar" value="hadoop-core-${hadoop-core.version}.jar" />
<property name="asfrepo" value="https://repository.apache.org"/>
<property name="asfsnapshotrepo" value="${asfrepo}/content/repositories/snapshots"/>
<property name="mvnrepo" value="http://repo2.maven.org/maven2"/>
<property name="asfstagingrepo" value="${asfrepo}/service/local/staging/deploy/maven2"/>
<property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
<property name="ant_task.jar" location="${ivy.dir}/maven-ant-tasks-${ant-task.version}.jar"/>
<property name="ant_task_repo_url"
value="${mvnrepo}/org/apache/maven/maven-ant-tasks/${ant-task.version}/maven-ant-tasks-${ant-task.version}.jar"/>
<property name="ivy_repo_url" value="${mvnrepo}/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="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="pom.xml" location="${build.ivy.maven.dir}/pom.xml"/>
<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}-core.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](-[classifier]).[ext]"/>
<!--this is how artifacts that get built are named-->
<property name="ivy.publish.pattern" value="[artifact]-[revision].[ext]"/>
<property name="pig.jar" value="${output.jarfile}"/>
<property name="pig-core.jar" value="${output.jarfile.core}"/>
<property name="pig-sources.jar" location="${build.dir}/${final.name}-sources.jar" />
<property name="pig-javadoc.jar" location="${build.dir}/${final.name}-javadoc.jar" />
<!-- 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.9.1"/>
<property name="jdiff.stable.javadoc" value="http://hadoop.apache.org/${name}/docs/r${jdiff.stable}/api/"/>
<!-- Packaging properties -->
<property name="package.release" value="1"/>
<property name="package.prefix" value="/usr"/>
<property name="package.conf.dir" value="/etc/pig"/>
<property name="package.log.dir" value="/var/log/pig"/>
<property name="package.buildroot" value="/tmp/pig_package_build_${user.name}"/>
<property name="package.build.dir" value="/tmp/pig_package_build_${user.name}/BUILD"/>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<!-- setup the classpath -->
<path id="classpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
<fileset file="${ivy.lib.dir}/${zookeeper.jarfile}"/>
<fileset dir="${ivy.lib.dir}" includes="*.jar"/>
</path>
<!-- javadoc-classpath -->
<path id="javadoc-classpath">
<fileset file="${lib.dir}/${automaton.jarfile}" />
<path refid="javadoc.classpath"/>
</path>
<path id="test.classpath">
<pathelement location="${build.classes}"/>
<pathelement location="${test.src.dir}"/>
<pathelement location="contrib/piggybank/java/piggybank.jar"/>
<path refid="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}" />
<move file="${ivy.lib.dir}/javacc-${javacc.version}.jar" tofile="${javacc.home}/javacc.jar"/>
<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}" />
<delete file="${output.jarfile.backcompat}" />
<delete file="${output.jarfile.backcompat.withouthadoop}" />
</target>
<target name="very-clean" unless="offline" depends="ivy-clean-cache,clean"
description="Clean build artifacts and flush Ivy cache" />
<target name="clean-piggybank" description="Cleanup piggybank">
<ant target="clean" dir="contrib/piggybank/java" inheritAll="false"/>
</target>
<target name="clean-zebra" description="Cleanup Zebra">
<ant target="clean" dir="contrib/zebra" inheritAll="false"/>
</target>
<target name="clean-penny" description="Cleanup Penny">
<ant target="clean" dir="contrib/penny/java" inheritAll="false"/>
</target>
<target name="clean-tutorial" description="Cleanup Tutorial">
<ant target="clean" dir="tutorial" inheritAll="false"/>
</target>
<target name="clean-test-e2e" description="Cleanup e2e tests">
<ant target="clean" dir="test/e2e/harness" inheritAll="false"/>
<ant target="clean" dir="test/e2e/pig" inheritAll="false"/>
<ant target="clean" dir="test/e2e/pig/udfs/java" inheritAll="false"/>
</target>
<target name="eclipse-files" depends="compile, ivy-buildJar"
description="Generate files for Eclipse">
<pathconvert property="eclipse.project">
<path path="${basedir}"/>
<regexpmapper from="^.*/([^/]+)$$" to="\1" handledirsep="yes"/>
</pathconvert>
<copy todir="." overwrite="true">
<fileset dir=".eclipse.templates">
<exclude name="**/README.txt"/>
</fileset>
<filterset>
<filter token="PROJECT" value="${eclipse.project}"/>
</filterset>
</copy>
</target>
<!-- ================================================================== -->
<!-- Java Compiler Compiler, generate Parsers -->
<!-- ================================================================== -->
<target name="cc-compile" depends="init, ivy-compile" description="Create and Compile Parser">
<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}" />
</target>
<target name="gen" depends="genTreeParser"
description="generates lexer and parser code from an ANTLR grammar">
<!-- Move generated Java code to the correct package directory. -->
<move todir="${src.gen.dir}${grammar.package.dir}">
<fileset dir="${src.gen.dir}" includes="*.java"/>
</move>
<!-- Copy generated .token files to current directory. -->
<copy todir=".">
<fileset dir="${src.gen.dir}" includes="*.tokens"/>
</copy>
</target>
<target name="genLexer" depends="prepare, init, ivy-compile"
unless="lexerGrammarProcessed"
description="generates lexer class from an ANTLR grammar">
<java classname="org.antlr.Tool"
classpathref="classpath" fork="true" failonerror="true">
<arg line="-o ${src.gen.dir}/${grammar.package.dir} ${src.dir}/${grammar.package.dir}/${grammar.name}Lexer.g"/>
</java>
</target>
<target name="genParser" depends="genLexer"
unless="parserGrammarProcessed"
description="generates token parser class from an ANTLR grammar">
<java classname="org.antlr.Tool"
classpathref="classpath" fork="true" failonerror="true">
<arg line="-o ${src.gen.dir}/${grammar.package.dir} ${src.dir}/${grammar.package.dir}/${grammar.name}Parser.g"/>
</java>
</target>
<target name="genTreeParser" depends="genParser"
unless="treeGrammarProcessed"
description="generates tree parser class from an ANTLR grammar">
<java classname="org.antlr.Tool"
classpathref="classpath" fork="true" failonerror="true">
<arg line="-o ${src.gen.dir}/${grammar.package.dir} ${src.dir}/${grammar.package.dir}/AstPrinter.g ${src.dir}/${grammar.package.dir}/AliasMasker.g ${src.dir}/${grammar.package.dir}/AstValidator.g ${src.dir}/${grammar.package.dir}/LogicalPlanGenerator.g"/>
</java>
</target>
<target name="prepare">
<uptodate property="lexerGrammarProcessed" srcfile="${grammar.src.dir}/${grammar.name}Lexer.g">
<mapper type="merge" to="${src.gen.dir}/${grammar.package.dir}/${grammar.name}Lexer.java"/>
</uptodate><!--
<uptodate property="parserGrammarProcessed" srcfile="${grammar.src.dir}/${grammar.name}Parser.g">
<mapper type="merge" to="${src.gen.dir}/${grammar.package.dir}/${grammar.name}Parser.java"/>
</uptodate>
<uptodate property="treeGrammarProcessed" srcfile="${grammar.src.dir}/${grammar.name}Tree.g">
<mapper type="merge" to="${src.gen.dir}/${gramar.package.dir}/${grammar.name}Tree.java"/>
</uptodate>-->
<!--mkdir dir="build/classes"/-->
<mkdir dir="${src.gen.dir}/${grammar.package.dir}"/>
</target>
<!-- ================================================================== -->
<!-- Build sources -->
<!-- ================================================================== -->
<target name="compile" depends="cc-compile, gen" 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;${src.shims.dir}" />
<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;${src.shims.dir}" />
<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};${src.shims.test.dir}" />
<param name="dist" value="${test.build.classes}" />
<param name="cp" value="test.classpath" />
<!-- don't compile PigTestLoader -->
<param name="excludes" value="**/PigTestLoader.java **/resources/**" />
</antcall>
<antcall target="compile-sources-all-warnings" inheritRefs="true" inheritall="true">
<param name="sources" value="${test.src.dir};${src.shims.test.dir}" />
<param name="dist" value="${test.build.classes}" />
<param name="cp" value="test.classpath" />
<!-- don't compile PigTestLoader -->
<param name="excludes" value="**/PigTestLoader.java **/resources/**" />
</antcall>
<copy file="${basedir}/test/hbase-site.xml" tofile="${test.build.classes}/hbase-site.xml"/>
<ivy:cachepath pathid="mr-apps-test-ivy.classpath" />
<path id="mr-apps-test.classpath">
<pathelement path="${clover.jar}"/>
<pathelement location="${junit.hadoop.conf}"/> <!--Include hadoop-site.xml for TestFRJoin -->
<path refid="mr-apps-test-ivy.classpath"/>
</path>
<property name="mr-apps-classpath" refid="mr-apps-test.classpath" />
<echo file="${test.build.classes}/mrapp-generated-classpath" message="${mr-apps-classpath}" />
</target>
<!-- This target is for default compilation -->
<target name="compile-sources" unless="all.warnings">
<javac encoding="${build.encoding}" srcdir="${sources}" excludes="${excludes}"
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}" excludes="${excludes}"
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-withouthadoop, 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 &amp;copy; ${year} The Apache Software Foundation">
<packageset dir="${src.dir}" />
<link href="${javadoc.link.java}" />
<classpath>
<path refid="javadoc-classpath" />
<pathelement path="${output.jarfile.core}" />
</classpath>
<group title="pig" packages="org.apache.*" />
</javadoc>
</target>
<target name="javadoc-all" depends="jar-withouthadoop, ivy-javadoc" description="Create documentation including all contrib projects">
<mkdir dir="${build.javadoc}" />
<javadoc overview="${src.dir}/overview.html" packagenames="org.apache.pig*,org.apache.hadoop.zebra*" destdir="${build.javadoc}" author="true" version="true" use="true" windowtitle="${Name} ${version} API" doctitle="${Name} ${version} API" bottom="Copyright &amp;copy; ${year} The Apache Software Foundation">
<packageset dir="${src.dir}" />
<packageset dir="contrib/piggybank/java/src/main/java"/>
<packageset dir="contrib/zebra/src/java"/>
<link href="${javadoc.link.java}" />
<classpath>
<path refid="javadoc-classpath" />
<pathelement path="${output.jarfile}" />
<fileset dir="build">
<include name="**/zebra-*-dev.jar"/>
</fileset>
</classpath>
<group title="pig" packages="org.apache.pig*" />
<group title="contrib: Piggybank" packages="org.apache.pig.piggybank*" />
<group title="contrib: Zebra" packages="org.apache.hadoop.zebra*"/>
</javadoc>
</target>
<!-- ================================================================== -->
<!-- @depricated, Documentation -->
<!-- ================================================================== -->
<target name="docs" depends="forrest.check, javadoc-all" description="Generate forrest-based documentation.
To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line." if="forrest.home">
<exec dir="${docs.dir}" executable="${forrest.home}/bin/forrest" failonerror="true">
</exec>
<copy todir="${build.docs}">
<fileset dir="${docs.dir}/build/site/" />
</copy>
</target>
<target name="forrest.check" unless="forrest.home">
<fail message="'forrest.home' is not defined.
Please pass -Dforrest.home=&lt;base of Apache Forrest installation&gt; to Ant on the command-line." />
</target>
<target name="source-jar" depends="cc-compile">
<jar duplicate="preserve" jarfile="${output.jarfile.sources}" basedir="${src.dir}/" excludes="docs/**, overview.html">
<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.lib.dir}/shock"/>
<fileset dir="${src.lib.dir}/bzip2"/>
</jar>
</target>
<target name="javadoc-jar" depends="cc-compile, javadoc">
<jar duplicate="preserve" jarfile="${output.jarfile.javadoc}" basedir="${build.javadoc}/">
<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>
</jar>
</target>
<!-- ================================================================== -->
<!-- Utility to build pig.jar and pig-withouthadoop.jar -->
<!-- ================================================================== -->
<target name="jar-all" depends="jar,jar-withouthadoop" description="Create pig-all.jar and pig-withouthadoop.jar">
</target>
<target name="include-meta" if="isHadoop23">
<copy todir="${build.classes}/META-INF">
<fileset dir="${src.dir}/META-INF" includes="**"/>
</copy>
<move file="${output.jarfile}" tofile="${output.stage.jarfile}"/>
<sleep seconds="1"/>
<jar jarfile="${output.jarfile}">
<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="${output.stage.jarfile}"/>
<fileset dir="${build.classes}" includes="META-INF/**" />
</jar>
</target>
<!-- ================================================================== -->
<!-- Make pig.jar -->
<!-- ================================================================== -->
<!-- TODO we should also exclude test here... -->
<!-- ================================================================== -->
<target name="jar" depends="compile" description="Create pig-all.jar">
<antcall target="jarWithSvn" inheritRefs="true" inheritall="true"/>
<antcall target="jarWithOutSvn" inheritRefs="true" inheritall="true"/>
</target>
<scriptdef name="propertyreset" language="javascript"
description="Allows to assign @{property} new value">
<attribute name="name"/>
<attribute name="value"/>
project.setProperty(attributes.get("name"), attributes.get("value"));
</scriptdef>
<target name="mvn-jar" description="Create pig.jar for maven deploy for Hadoop2/23 and Hadoop1/20">
<propertyreset name="hadoopversion" value="23" />
<propertyreset name="isHadoop" value="true" />
<propertyreset name="src.shims.dir" value="${basedir}/shims/src/hadoop${hadoopversion}" />
<antcall target="clean" inheritRefs="true" inheritall="true"/>
<antcall target="jar" inheritRefs="true" inheritall="true"/>
<!-- Move and rename pig jar for Hadoop2/23 to a different location before compiling for Hadoop1/20 -->
<move file="${output.jarfile.core}" tofile="${basedir}/${artifact.pig-h2.jar}"/>
<antcall target="clean" inheritRefs="true" inheritall="true"/>
<propertyreset name="hadoopversion" value="20" />
<propertyreset name="isHadoop" value="" />
<propertyreset name="src.shims.dir" value="${basedir}/shims/src/hadoop${hadoopversion}" />
<antcall target="jar" inheritRefs="true" inheritall="true"/>
<move file="${basedir}/${artifact.pig-h2.jar}" tofile="${output.jarfile.core-h2}"/>
</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>
<fileset file="${basedir}/src/pig-default.properties" />
<fileset file="${basedir}/src/main/jruby/pigudf.rb" />
</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}/${automaton.jarfile}" />
<zipgroupfileset dir="${ivy.lib.dir}">
<include name="hadoop-core-${hadoop-core.version}.jar" />
<include name="hadoop-*-${hadoop-common.version}*.jar" />
<include name="antlr-runtime-${antlr.version}.jar" />
<include name="ST4-${stringtemplate.version}.jar" />
<include name="junit-${junit.version}.jar" />
<include name="jsch-${jsch.version}.jar" />
<include name="jline-${jline.version}.jar" />
<include name="jackson-mapper-asl-${jackson.version}.jar" />
<include name="jackson-core-asl-${jackson.version}.jar" />
<include name="joda-time-${joda-time.version}.jar" />
<include name="guava-${guava.version}.jar" />
<include name="avro-${avro.version}.jar"/>
<include name="hbase-${hbase.version}.jar" />
<include name="commons*.jar"/>
<include name="log4j*.jar"/>
<include name="jsp-api*.jar"/>
<include name="zookeeper*.jar"/>
</zipgroupfileset>
<fileset file="${basedir}/src/pig-default.properties" />
<fileset file="${basedir}/src/main/jruby/pigudf.rb" />
</jar>
<antcall target="include-meta" inheritRefs="true" inheritall="true"/>
<copy file="${output.jarfile}" tofile="${output.jarfile.backcompat}"/>
</target>
<target name="smoketests-jar" depends="pigunit-jar"
description="Creating jar file for smoke tests">
<echo> *** Creating smoke tests jar for pigunit ***</echo>
<jar jarfile="${smoke.tests.jarfile}" basedir="${test.build.classes}"
includes="org/apache/pig/test/pigunit/**/*">
<fileset dir="${basedir}" includes="test/data/pigunit/**/*"/>
<manifest>
<section name="org/apache/pig/test/pigunit">
<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>
</target>
<!-- ================================================================== -->
<!-- Make pig-withouthadoop.jar -->
<!-- ================================================================== -->
<target name="jar-withouthadoop" depends="compile" description="Create pig jar withouthadoop">
<antcall target="jar-withouthadoopWithSvn" inheritRefs="true" inheritall="true"/>
<antcall target="jar-withouthadoopWithOutSvn" inheritRefs="true" inheritall="true"/>
</target>
<target name="jar-withouthadoopWithSvn" if="svn.revision">
<antcall target="buildJar-withouthadoop" inheritRefs="true" inheritall="true">
<param name="svnString" value="${svn.revision}" />
</antcall>
</target>
<target name="jar-withouthadoopWithOutSvn" unless="svn.revision">
<antcall target="buildJar-withouthadoop" inheritRefs="true" inheritall="true">
<param name="svnString" value=": unknown" />
</antcall>
</target>
<target name="buildJar-withouthadoop" 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>
<fileset file="${basedir}/src/pig-default.properties" />
<fileset file="${basedir}/src/main/jruby/pigudf.rb" />
</jar>
<!-- @depricated -->
<jar jarfile="${output.jarfile.withouthadoop}" 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}/${automaton.jarfile}" />
<zipgroupfileset dir="${ivy.lib.dir}">
<include name="antlr-runtime-${antlr.version}.jar" />
<include name="ST4-${stringtemplate.version}.jar" />
<include name="jline-${jline.version}.jar" />
<include name="jackson-mapper-asl-${jackson.version}.jar" />
<include name="jackson-core-asl-${jackson.version}.jar" />
<include name="guava-${guava.version}.jar" />
</zipgroupfileset>
<fileset file="${basedir}/src/pig-default.properties" />
<fileset file="${basedir}/src/main/jruby/pigudf.rb" />
</jar>
<copy file="${output.jarfile.withouthadoop}" tofile="${output.jarfile.backcompat.withouthadoop}"/>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<target name="test-core" depends="compile-test,jar-withouthadoop" description="Run full set of unit tests">
<macro-test-runner test.file="${test.all.file}" />
</target>
<target name="test-commit" depends="compile-test,jar-withouthadoop" description="Run approximate 10-minute set of unit tests prior to commiting">
<macro-test-runner test.file="${test.commit.file}" />
</target>
<target name="test-unit" depends="compile-test,jar-withouthadoop" description="Run all true unit tests">
<macro-test-runner test.file="${test.unit.file}" />
</target>
<target name="test-smoke" depends="compile-test,jar-withouthadoop" description="Run 30 min smoke tests">
<macro-test-runner test.file="${test.smoke.file}" />
</target>
<macrodef name="macro-test-runner">
<attribute name="test.file" />
<sequential>
<delete dir="${test.log.dir}"/>
<mkdir dir="${test.log.dir}"/>
<tempfile property="junit.tmp.dir" prefix="pig_junit_tmp" destDir="${java.io.tmpdir}" />
<mkdir dir="${junit.tmp.dir}/"/>
<mkdir dir="${junit.hadoop.conf}"/>
<junit showoutput="${test.output}" printsummary="yes" haltonfailure="no" fork="yes" maxmemory="1024m" 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="java.io.tmpdir" value="${junit.tmp.dir}" />
<!-- <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.withouthadoop}" />
<pathelement location="${test.build.classes}" />
<pathelement location="${junit.hadoop.conf}" />
<pathelement location="." />
<pathelement path="${clover.jar}"/>
<path refid="test.classpath"/>
</classpath>
<formatter type="${test.junit.output.format}" />
<batchtest fork="yes" todir="${test.log.dir}" unless="testcase">
<fileset dir="test">
<patternset>
<includesfile name="@{test.file}"/>
<excludesfile name="${test.exclude.file}" if="test.exclude.file"/>
<excludesfile name="${test.exclude.file.23}" if="isHadoop23" />
</patternset>
<exclude name="**/${exclude.testcase}.java" if="exclude.testcase" />
</fileset>
</batchtest>
<batchtest fork="yes" todir="${test.log.dir}" if="testcase">
<fileset dir="test" includes="**/${testcase}.java"/>
</batchtest>
<assertions>
<enable />
</assertions>
</junit>
<delete dir="${junit.tmp.dir}/"/>
<fail if="tests.failed">Tests failed!</fail>
</sequential>
</macrodef>
<target name="test" description="to call the test-core and test-contrib target">
<antcall target="test-core" inheritRefs="true" inheritall="true"/>
<!-- temporarily disabling call to zebra tests
<antcall target="test-contrib-internal" inheritRefs="true" inheritall="true"/>
-->
</target>
<target name="test-contrib-internal" unless="testcase">
<antcall target="test-contrib" inheritRefs="true" inheritall="true"/>
</target>
<target name="test-contrib" depends="compile-test" description="to call contrib tests">
<subant target="pigtest" buildpath="contrib/zebra" antfile="build.xml"/>
</target>
<!-- ================================================================== -->
<!-- End to end tests -->
<!-- ================================================================== -->
<target name="test-e2e" depends="jar, jar-withouthadoop, piggybank" description="run end-to-end tests">
<ant dir="${test.e2e.dir}"/>
</target>
<target name="test-e2e-deploy" depends="jar, jar-withouthadoop" description="deploy end-to-end tests to existing cluster">
<ant dir="${test.e2e.dir}" target="deploy"/>
</target>
<target name="test-e2e-undeploy" depends="jar, jar-withouthadoop" description="undeploy end-to-end tests from existing cluster">
<ant dir="${test.e2e.dir}" target="undeploy"/>
</target>
<target name="test-e2e-local" depends="jar, jar-withouthadoop, piggybank" description="run end-to-end tests in local mode">
<ant dir="${test.e2e.dir}" target="test-local"/>
</target>
<target name="test-e2e-deploy-local" depends="jar, jar-withouthadoop" description="create files needed by local mode end-to-end tests">
<ant dir="${test.e2e.dir}" target="deploy-local"/>
</target>
<!-- ================================================================== -->
<!-- Pigunit -->
<!-- ================================================================== -->
<target depends="compile-test" name="pigunit-jar" description="create the pigunit jar file">
<echo> *** Creating pigunit.jar ***</echo>
<jar destfile="${pigunit.jarfile}">
<fileset dir="${test.build.classes}">
<include name="**/org/apache/pig/pigunit/**"/>
<include name="**/org/apache/pig/test/Util.**"/>
</fileset>
<zipfileset src="${ivy.lib.dir}/${commons-lang.jarfile}" />
</jar>
</target>
<target name="test-pigunit" depends="compile-test,jar-withouthadoop, pigunit-jar" description="Run tests that test PigUnit">
<macro-test-runner test.file="${test.pigunit.file}" />
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<target name="package-release" depends="docs, api-report" description="Create a Pig release for rpm/deb distribution">
<mkdir dir="${rpm.dist.dir}" />
<mkdir dir="${rpm.dist.dir}/etc/pig" />
<mkdir dir="${rpm.dist.dir}/share/pig/scripts" />
<mkdir dir="${rpm.dist.dir}/share/pig/templates/conf" />
<mkdir dir="${rpm.dist.dir}/share/pig/lib" />
<mkdir dir="${rpm.dist.dir}/share/doc/pig" />
<mkdir dir="${rpm.dist.dir}/share/doc/pig/api" />
<mkdir dir="${rpm.dist.dir}/share/doc/pig/jdiff"/>
<mkdir dir="${rpm.dist.dir}/share/doc/pig/license" />
<copy todir="${rpm.dist.dir}/share/pig/lib">
<fileset dir="${ivy.lib.dir}" includes="jython*.jar"/>
</copy>
<copy file="${output.jarfile.backcompat.withouthadoop}" tofile="${rpm.dist.dir}/share/pig/${final.name}-withouthadoop.jar" />
<copy todir="${rpm.dist.dir}/bin">
<fileset dir="bin" />
</copy>
<copy todir="${rpm.dist.dir}/share/doc/pig">
<fileset dir="${build.docs}" />
</copy>
<copy todir="${rpm.dist.dir}/etc/pig" file="conf/pig.properties"/>
<copy todir="${rpm.dist.dir}/etc/pig" file="conf/log4j.properties.template"/>
<copy todir="${rpm.dist.dir}/share/pig/test" includeEmptyDirs="true">
<fileset dir="${test.src.dir}" />
</copy>
<copy todir="${rpm.dist.dir}/share/pig/tutorial" includeEmptyDirs="true">
<fileset dir="tutorial" />
</copy>
<copy todir="${rpm.dist.dir}/share/pig/contrib" includeEmptyDirs="true">
<fileset dir="contrib" />
</copy>
<copy todir="${rpm.dist.dir}/share/doc/pig">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${rpm.dist.dir}/share/doc/pig/license">
<fileset dir="license" />
</copy>
<copy todir="${rpm.dist.dir}/share/pig/templates/conf">
<fileset dir="src/packages/templates/conf"/>
</copy>
<copy todir="${rpm.dist.dir}/sbin">
<fileset dir="src/packages">
<include name="*.sh"/>
</fileset>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${rpm.dist.dir}/bin" />
<fileset dir="${rpm.dist.dir}/sbin" />
</chmod>
</target>
<target name="package" depends="docs, api-report, jar" description="Create a Pig tar release">
<mkdir dir="${tar.dist.dir}" />
<mkdir dir="${tar.dist.dir}/lib" />
<mkdir dir="${tar.dist.dir}/conf" />
<mkdir dir="${tar.dist.dir}/scripts" />
<mkdir dir="${tar.dist.dir}/docs" />
<mkdir dir="${tar.dist.dir}/docs/api" />
<mkdir dir="${tar.dist.dir}/docs/jdiff"/>
<mkdir dir="${tar.dist.dir}/license" />
<copy todir="${tar.dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="${lib.dir}"/>
</copy>
<copy todir="${tar.dist.dir}/lib">
<fileset dir="${ivy.lib.dir}" includes="jython*.jar"/>
</copy>
<copy file="${output.jarfile.backcompat.withouthadoop}" tofile="${tar.dist.dir}/${final.name}-withouthadoop.jar" />
<copy file="${output.jarfile.backcompat}" tofile="${tar.dist.dir}/${final.name}.jar" />
<copy todir="${tar.dist.dir}/" file="ivy.xml" />
<copy todir="${tar.dist.dir}/ivy">
<fileset dir="ivy" />
</copy>
<copy todir="${tar.dist.dir}/bin">
<fileset dir="bin" />
</copy>
<copy todir="${tar.dist.dir}/docs">
<fileset dir="${build.docs}" />
</copy>
<copy todir="${tar.dist.dir}/conf" file="conf/pig.properties"/>
<copy todir="${tar.dist.dir}/conf" file="conf/log4j.properties.template"/>
<copy todir="${tar.dist.dir}/src" includeEmptyDirs="true">
<fileset dir="${src.dir}" />
</copy>
<copy todir="${tar.dist.dir}/shims" includeEmptyDirs="true">
<fileset dir="${basedir}/shims" />
</copy>
<copy todir="${tar.dist.dir}/lib-src" includeEmptyDirs="true">
<fileset dir="${src.lib.dir}" />
</copy>
<copy todir="${tar.dist.dir}/test" includeEmptyDirs="true">
<fileset dir="${test.src.dir}" />
</copy>
<copy todir="${tar.dist.dir}/tutorial" includeEmptyDirs="true">
<fileset dir="tutorial" />
</copy>
<copy todir="${tar.dist.dir}/contrib" includeEmptyDirs="true">
<fileset dir="contrib" />
</copy>
<copy todir="${tar.dist.dir}/" file="build.xml" />
<copy todir="${tar.dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${tar.dist.dir}/license">
<fileset dir="license" />
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${tar.dist.dir}/bin" />
</chmod>
</target>
<!-- ================================================================== -->
<!-- Make release packages -->
<!-- ================================================================== -->
<target name="tar" depends="package" description="Source distribution">
<tar compression="gzip" longfile="gnu" destfile="${build.dir}/${final.name}.tar.gz">
<tarfileset dir="${build.dir}/tar/" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}/tar" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</tar>
</target>
<target name="tar-release" depends="package-release" description="Create release tarball">
<tar compression="gzip" longfile="gnu" destfile="${rpm.dist.dir}/${final.name}.tar.gz">
<tarfileset dir="${build.dir}/rpm" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}/rpm" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</tar>
</target>
<target name="rpm" depends="tar-release" description="Make rpm package">
<mkdir dir="${package.buildroot}/BUILD" />
<mkdir dir="${package.buildroot}/RPMS" />
<mkdir dir="${package.buildroot}/SRPMS" />
<mkdir dir="${package.buildroot}/SOURCES" />
<mkdir dir="${package.buildroot}/SPECS" />
<copy todir="${package.buildroot}/SOURCES">
<fileset dir="${rpm.dist.dir}">
<include name="${final.name}.tar.gz" />
</fileset>
</copy>
<copy todir="${package.buildroot}/SOURCES">
<fileset dir="${build.dir}">
<include name="${final.name}-withouthadoop.jar" />
</fileset>
</copy>
<copy file="${src.dir}/packages/rpm/spec/pig.spec" todir="${package.buildroot}/SPECS">
<filterchain>
<replacetokens>
<token key="final.name" value="${final.name}" />
<token key="version" value="${pig.version}" />
<token key="package.release" value="${package.release}" />
<token key="package.build.dir" value="${package.build.dir}" />
<token key="package.prefix" value="${package.prefix}" />
<token key="package.conf.dir" value="${package.conf.dir}" />
<token key="package.log.dir" value="${package.log.dir}" />
</replacetokens>
</filterchain>
</copy>
<rpm specFile="pig.spec" command="-bb --target ${os.arch}" topDir="${package.buildroot}" cleanBuildDir="true" failOnError="true"/>
<copy todir="${build.dir}/" flatten="true">
<fileset dir="${package.buildroot}/RPMS">
<include name="**/${name}*.rpm" />
</fileset>
<fileset dir="${package.buildroot}/SRPMS">
<include name="**/${name}*.rpm" />
</fileset>
</copy>
<delete dir="${package.buildroot}" quiet="true" verbose="false"/>
</target>
<target name="deb" depends="package-release" description="Make deb package">
<taskdef name="deb"
classname="org.vafer.jdeb.ant.DebAntTask">
<classpath refid="classpath" />
</taskdef>
<mkdir dir="${package.build.dir}/pig.control" />
<copy todir="${package.build.dir}/pig.control">
<fileset dir="${src.dir}/packages/deb/pig.control">
<exclude name="control" />
</fileset>
</copy>
<copy file="${build.dir}/${final.name}-withouthadoop.jar" tofile="${rpm.dist.dir}/share/pig/${final.name}-core.jar" overwrite="true" />
<copy file="${src.dir}/packages/deb/pig.control/control" todir="${package.build.dir}/pig.control">
<filterchain>
<replacetokens>
<token key="final.name" value="${final.name}" />
<token key="version" value="${pig.version}" />
<token key="package.release" value="${package.release}" />
<token key="package.build.dir" value="${package.build.dir}" />
<token key="package.prefix" value="${package.prefix}" />
<token key="package.conf.dir" value="${package.conf.dir}" />
<token key="package.log.dir" value="${package.log.dir}" />
</replacetokens>
</filterchain>
</copy>
<deb destfile="${package.buildroot}/${name}_${pig.version}-${package.release}_${os.arch}.deb" control="${package.build.dir}/pig.control">
<tarfileset dir="${rpm.dist.dir}" filemode="644" prefix="/usr">
<exclude name="bin/*" />
<exclude name="conf" />
<exclude name="conf/*" />
<exclude name="etc/**" />
<include name="**" />
</tarfileset>
<tarfileset dir="${rpm.dist.dir}" filemode="755" prefix="/usr">
<include name="bin/*" />
<include name="sbin/*" />
</tarfileset>
<tarfileset dir="${rpm.dist.dir}/etc/pig" filemode="644" prefix="/etc/pig">
<include name="**" />
</tarfileset>
</deb>
<copy todir="${build.dir}/" flatten="true">
<fileset dir="${package.buildroot}">
<include name="**/${name}*.deb" />
</fileset>
</copy>
<delete dir="${package.buildroot}" quiet="true" verbose="false"/>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<target name="src-release" depends="clean, clean-piggybank, clean-zebra, clean-penny, clean-test-e2e, clean-tutorial" description="Source distribution">
<mkdir dir="${build.dir}"/>
<tar compression="gzip" longfile="gnu"
destfile="${build.dir}/${final.name}-src.tar.gz">
<tarfileset dir="${basedir}" mode="644" prefix="${final.name}-src">
<include name="bin/**"/>
<include name="conf/**"/>
<include name="contrib/**"/>
<include name="ivy/**"/>
<exclude name="ivy/*.jar"/>
<include name="lib/**"/>
<include name="lib-src/**"/>
<include name="license/**"/>
<include name="shims/**"/>
<include name="src/**"/>
<include name="test/**"/>
<exclude name="test/**/*.jar"/>
<include name="tutorial/**"/>
<include name="*.txt"/>
<include name="*.xml"/>
<include name="doap_Pig.rdf"/>
<include name="KEYS"/>
<include name="autocomplete"/>
</tarfileset>
<tarfileset dir="" mode="755" prefix="${final.name}-src-${pig.version}">
<include 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.exclude.file" value="${test.src.dir}/findbugsExcludeFile.xml"/>
<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" timeout="2400000"
excludeFilter="${findbugs.exclude.file}" jvmargs="-Xmx1024M">
<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>
<target name="ant-task-download" description="To download mvn-ant-task" unless="offline">
<get src="${ant_task_repo_url}" dest="${ant_task.jar}" usetimestamp="true"/>
</target>
<target name="mvn-taskdef" depends="ant-task-download">
<path id="mvn-ant-task.classpath" path="${ant_task.jar}"/>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant"
classpathref="mvn-ant-task.classpath"/>
</target>
<target name="mvn-install" depends="mvn-taskdef,jar, set-version, source-jar,
javadoc-jar, pigunit-jar, smoketests-jar"
description="To install pig to local filesystem's m2 cache">
<artifact:pom file="${pig.pom}" id="pig"/>
<artifact:install file="${pig-core.jar}">
<pom refid="pig"/>
<attach file="${output.jarfile.sources}" classifier="sources" />
<attach file="${output.jarfile.javadoc}" classifier="javadoc" />
</artifact:install>
<artifact:pom file="${pigunit.pom}" id="pigunit"/>
<artifact:install file="${pigunit.jarfile}">
<pom refid="pigunit"/>
</artifact:install>
<artifact:pom file="${pigsmoke.pom}" id="pigsmoke"/>
<artifact:install file="${smoke.tests.jarfile}">
<pom refid="pigsmoke"/>
</artifact:install>
</target>
<target name="mvn-deploy" depends="mvn-taskdef, mvn-jar, source-jar, javadoc-jar,
smoketests-jar, pigunit-jar, set-version, signanddeploy, simpledeploy"
description="To deploy pig jar to apache snapshot's repository">
</target>
<target name="signanddeploy" if="staging" depends="sign">
<artifact:pom file="${pig.pom}" id="pig"/>
<artifact:install-provider artifactId="wagon-http" version="${wagon-http.version}"/>
<artifact:deploy file="${pig-core.jar}">
<remoteRepository id="apache.staging.https" url="${asfstagingrepo}"/>
<pom refid="pig"/>
<attach file="${pig-core.jar}.asc" type="jar.asc"/>
<attach file="${pig.pom}.asc" type="pom.asc"/>
<attach file="${output.jarfile.core-h2}.asc" type="jar.asc" classifier="h2"/>
<attach file="${output.jarfile.core-h2}" classifier="h2" />
<attach file="${output.jarfile.sources}.asc" type="jar.asc" classifier="sources"/>
<attach file="${output.jarfile.sources}" classifier="sources" />
<attach file="${output.jarfile.javadoc}.asc" type="jar.asc" classifier="javadoc"/>
<attach file="${output.jarfile.javadoc}" classifier="javadoc" />
</artifact:deploy>
</target>
<target name="simpledeploy" unless="staging">
<artifact:pom file="${pig.pom}" id="pig"/>
<artifact:install-provider artifactId="wagon-http" version="${wagon-http.version}"/>
<artifact:deploy file="${pig-core.jar}">
<remoteRepository id="apache.snapshots.https" url="${asfsnapshotrepo}"/>
<pom refid="pig"/>
<attach file="${output.jarfile.core-h2}" classifier="h2" />
<attach file="${pig-sources.jar}" classifier="sources" />
<attach file="${pig-javadoc.jar}" classifier="javadoc" />
</artifact:deploy>
<artifact:pom file="${pigunit.pom}" id="pigunit"/>
<artifact:deploy file="${pigunit.jarfile}">
<remoteRepository id="apache.snapshots.https" url="${asfsnapshotrepo}"/>
<pom refid="pigunit"/>
</artifact:deploy>
<artifact:pom file="${pigsmoke.pom}" id="pigsmoke"/>
<artifact:deploy file="${smoke.tests.jarfile}">
<remoteRepository id="apache.snapshots.https" url="${asfsnapshotrepo}"/>
<pom refid="pigsmoke"/>
</artifact:deploy>
</target>
<target name="sign" depends="clean-sign" if="staging">
<input message="password:>" addproperty="gpg.passphrase">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
<macrodef name="sign-artifact" description="Signs the artifact">
<attribute name="input.file"/>
<attribute name="output.file" default="@{input.file}.asc"/>
<attribute name="gpg.passphrase"/>
<sequential>
<echo>Signing @{input.file} Sig File: @{output.file}</echo>
<exec executable="gpg" >
<arg value="--armor"/>
<arg value="--output"/>
<arg value="@{output.file}"/>
<arg value="--passphrase"/>
<arg value="@{gpg.passphrase}"/>
<arg value="--detach-sig"/>
<arg value="@{input.file}"/>
</exec>
</sequential>
</macrodef>
<sign-artifact input.file="${pig-core.jar}"
output.file="${pig-core.jar}.asc" gpg.passphrase="${gpg.passphrase}"/>
<sign-artifact input.file="${output.jarfile.core-h2}"
output.file="${output.jarfile.core-h2}.asc" gpg.passphrase="${gpg.passphrase}"/>
<sign-artifact input.file="${output.jarfile.sources}"
output.file="${output.jarfile.sources}.asc" gpg.passphrase="${gpg.passphrase}"/>
<sign-artifact input.file="${output.jarfile.javadoc}"
output.file="${output.jarfile.javadoc}.asc" gpg.passphrase="${gpg.passphrase}"/>
<sign-artifact input.file="${pig.pom}"
output.file="${pig.pom}.asc" gpg.passphrase="${gpg.passphrase}"/>
</target>
<target name="clean-sign" description="Clean. Delete .asc files">
<delete>
<fileset dir="." includes="**/**/*.asc"/>
</delete>
</target>
<target name="set-version">
<delete file="${basedir}/ivy/pig.pom"/>
<copy file="${basedir}/ivy/pig-template.xml" tofile="${basedir}/ivy/pig.pom"/>
<copy file="${basedir}/ivy/pigunit-template.xml" tofile="${basedir}/ivy/pigunit.pom"/>
<copy file="${basedir}/ivy/pigsmoke-template.xml" tofile="${basedir}/ivy/pigsmoke.pom"/>
<replaceregexp byline="true">
<regexp pattern="@version"/>
<substitution expression="${version}"/>
<fileset dir="${basedir}/ivy">
<include name="pig.pom"/>
<include name="pigunit.pom"/>
<include name="pigsmoke.pom"/>
</fileset>
</replaceregexp>
</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}/tar/${final.name}"/>
</java>
</target>
<!--target name="checkstyle" depends="checkstyle.check, set-checkstyle-classpath" if="checkstyle.home" -->
<target name="checkstyle" depends="jar, 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=&lt;base of checkstyle installation&gt;
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>
-->
<path id="checkstyle-classpath">
<path refid="checkstyle.classpath"/>
<fileset dir="${ivy.lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="findbugs.check" depends="check-for-findbugs" unless="findbugs.present">
<fail message="'findbugs.home' is not defined. Please pass -Dfindbugs.home=&lt;base of Findbugs installation&gt;
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=&lt;location of patch file&gt;
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="${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="${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=&lt;base of clover installation&gt; -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=&lt;base of clover installation&gt;
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-all, 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" unless="offline">
<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"/>
</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="ivy-clean-cache" depends="ivy-init-antlib"
description="Clean the Ivy cache">
<ivy:cleancache />
</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-core.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"/>
<target name="piggybank" depends="jar">
<ant antfile="contrib/piggybank/java/build.xml" inheritAll="false"/>
</target>
</project>