blob: 5d8c198b46748d0c270a9ecef29665100aee5c63 [file] [log] [blame]
<?xml version="1.0"?>
<!--
********************************************************************************
Build file for Sketch library
********************************************************************************
Assumes the following directory structure:
<basedir> //this directory
All source files are copied to an intermediate dir structure with the first
targets: "precopy1" and "precopy2".
This means all source dir are untouched.
Build Directories
<basedir>/build //Volatile directory for build process
<basedir>/jarsIn //dependant jars
Intermediate Directories
<basedir>/build/bin //javadoc compiler output and resource destination
<basedir>/build/src //Move all source here
<basedir>/build/jars //Move all dependent jars here
<basedir>/build/scripts //Move all scripts here, this build file will be moved here.
<basedir>/build/javadoc //Javadoc output and javadoc resources
// move all html & related here after the javadoc
// used for creating javaddoc.zip
Output Directories
<basedir>/build/out //Used for creating the distribution zip
<basedir>/build/out/jars //created jars
<basedir>/build/out/zips //javadoc.zip, src.zip
<basedir>/build/out/scripts //startup scripts & build.html
-->
<!-- set basedir -->
<project name="Sketch" default="build" basedir=".">
<description>
Build file for Sketch Library
</description>
<!-- project name properties -->
<property name="TitlePrefix" value="Pig Sketch Library" />
<property name="outputFileNamePrefix" value="sketches-pig" />
<property name="year" value="2012-2015" />
<!-- PROJECT INPUT PATHS, copied to intermediate paths -->
<property name="SrcJavadocPath" value="${basedir}/src/main/javadoc" />
<property name="SrcJavadocResourcePath" value="${basedir}/src/main/javadoc/resources" />
<property name="MavenMainPath" value="${basedir}/src/main/java" />
<property name="MavenTestPath" value="${basedir}/src/test/java" />
<property name="RelJavaPackagePath" value="com/yahoo/sketches" />
<property name="SrcMainCommon" value="${MavenMainPath}/${RelJavaPackagePath}" />
<property name="SrcTestCommon" value="${MavenTestPath}/${RelJavaPackagePath}" />
<!-- PROJECT BUILD PATH & FILE -->
<property name="BuildPath" value="${basedir}/build" />
<property name="BuildFile" value="${basedir}/build.xml" />
<!-- PROJECT INTERMEDIATE PATHS, created in -init -->
<property name="IntMainPath" value="${BuildPath}/${MavenMainPath}" />
<property name="IntTestPath" value="${BuildPath}/${MavenTestPath}" />
<property name="IntBinPath" value="${BuildPath}/bin" />
<property name="IntJavadocPath" value="${BuildPath}/javadoc" />
<property name="IntJavadocResourcesPath" value="${BuildPath}/javadoc/resources" />
<property name="IntScriptsPath" value="${BuildPath}/scripts" />
<property name="IntJarsPath" value="${BuildPath}/jarsIn" />
<!-- PROJECT OUTPUT PATHS, created in -init -->
<property name="OutPath" value="${BuildPath}/out" />
<property name="JarsOutPath" value="${OutPath}/jars" />
<property name="ZipsOutPath" value="${OutPath}/zips" />
<property name="ScriptsOutPath" value="${OutPath}/scripts" />
<!-- OVERVIEW HANDLING -->
<property name="OverviewFileName" value="overview.html" />
<!-- project dependency jar paths -->
<property name="TestNGJar" value="jarsIn/testng-6.8.8.jar" />
<property name="PigJar" value="jarsIn/pig-0.12.1.jar" />
<property name="SketchesCoreJar" value="jarsIn/sketches-core.jar" />
<!-- FILESETS -->
<!-- classpaths -->
<path id="ProjClasspath">
<pathelement location="${TestNGJar}" />
<pathelement location="${PigJar}" />
<pathelement location="${SketchesCoreJar}" />
</path>
<!-- compiler properties -->
<property name="comp.debug" value="on"/>
<property name="comp.source.ver" value="1.8" />
<property name="comp.compiler.ver" value="javac1.8" />
<property name="comp.target.ver" value="1.8" />
<property name="comp.fork" value="true" />
<!-- javadoc properties -->
<property name="jdoc.int.overview" value="${IntJavadocPath}/${OverviewFileName}" /> <!-- copy to here before javadoc -->
<property name="jdoc.windowTitle" value="${TitlePrefix} API" />
<property name="jdoc.use" value="true" />
<property name="jdoc.breakiterator" value="true" />
<property name="jdoc.source.ver" value="1.8" />
<property name="jdoc.verbose" value="false" />
<property name="jdoc.author" value="true" />
<property name="jdoc.version" value="true" />
<property name="jdoc.public" value="true" />
<property name="jdoc.protected" value="true" />
<property name="jdoc.private" value="true" />
<property name="jdoc.header" value="Sketch Library V4" />
<property name="jdoc.docfilessubdirs" value="true" />
<!--
********************************************************************************
proj Targets
********************************************************************************
-->
<!--PRECOPY1 -->
<target name="precopy1"
depends="-init"
description="Copy remote dependant jarsIn to build jar directory" >
<copy file="${PigJar}" todir="${IntJarsPath}" />
<copy file="${TestNGJar}" todir="${IntJarsPath}" />
<copy file="${SketchesCoreJar}" todir="${IntJarsPath}" />
</target>
<!--PRECOPY2 -->
<target name="precopy2"
depends="precopy1"
description="Copy all sources to intermediate directories" >
<!-- Create directories -->
<mkdir dir="${IntMainPath}/${RelJavaPackagePath}" />
<mkdir dir="${IntTestPath}/${RelJavaPackagePath}" />
<!-- Copy sources and directories below as well -->
<copy todir="${IntMainPath}/${RelJavaPackagePath}" >
<fileset dir="${SrcMainCommon}" />
</copy>
<copy todir="${IntTestPath}/${RelJavaPackagePath}" >
<fileset dir="${SrcTestCommon}" />
</copy>
<!-- build file -->
<copy file="${BuildFile}"
todir="${ScriptsOutPath}" />
</target>
<!-- COMPILE -->
<target name="compile"
depends="precopy2"
description="Compile all ${TitlePrefix} Java classes" >
<javac srcdir="${IntMainPath}:${IntTestPath}"
destdir="${IntBinPath}"
source="${comp.source.ver}"
compiler="${comp.compiler.ver}"
target="${comp.target.ver}"
fork="${comp.fork}"
debug="${comp.debug}"
includeantruntime="false" >
<classpath refid="ProjClasspath"/>
<!-- compilerarg value="-Xlint:unchecked" / -->
</javac>
<echo message="Compile Done."/>
</target>
<!-- jar classes -->
<target name="jar_classes"
depends="compile"
description="Pack all class files into a Jar file">
<delete file="${JarsOutPath}/${outputFileNamePrefix}.jar"/>
<jar jarfile="${JarsOutPath}/${outputFileNamePrefix}.jar">
<manifest>
<attribute name="Build-Date" value="${TODAY}"/>
</manifest>
<fileset dir="${IntBinPath}">
<include name="**" />
</fileset>
</jar>
<echo message="Classes jarred" />
</target>
<!-- zip source -->
<target name="zip_src"
depends="precopy2"
description="Pack all source files into a Zip file" >
<delete file="${ZipsOutPath}/${outputFileNamePrefix}_src.zip" />
<zip destfile="${ZipsOutPath}/${outputFileNamePrefix}_src.zip" >
<zipfileset dir="${IntMainPath}" includes="**" prefix="src" />
</zip>
</target>
<!-- Create javadocs & copy javadoc resources -->
<target name="javadoc"
depends="precopy2"
description="Create ${TitlePrefix} javadocs">
<delete dir="${IntJavadocPath}" />
<mkdir dir="${IntJavadocPath}" />
<copy file="${SrcJavadocPath}/${OverviewFileName}" todir="${IntJavadocPath}" />
<javadoc
sourcepath="${IntMainPath}"
destdir="${IntJavadocPath}"
use="${jdoc.use}"
breakiterator="${jdoc.breakiterator}"
source="${jdoc.source.ver}"
verbose="${jdoc.verbose}"
author="${jdoc.author}"
version="${jdoc.version}"
windowtitle="${jdoc.windowTitle}"
overview="${jdoc.int.overview}"
public="${jdoc.public}"
header="${jdoc.header}" >
<classpath refid="ProjClasspath"/>
<arg value="-Xdoclint:all"/>
</javadoc>
<!-- Copy maven resource files to javadoc dir -->
<copy todir="${IntJavadocResourcesPath}" >
<fileset dir="${SrcJavadocResourcePath}" />
</copy>
<!-- View options:
public="${jdoc.public}"
protected="${jdoc.protected}"
private="${jdoc.private}"
-->
</target>
<!-- COPY Misc files to out directories
<target name="copyDocs"
depends="precopy2"
description="Copy Data, scripts, misc to out directories." >
</target> -->
<!-- zip javadoc -->
<target name="zip_javadoc"
depends="javadoc"
description="Pack the javadocs into a Zip file" >
<delete file="${ZipsOutPath}/${outputFileNamePrefix}_javadoc.zip" />
<zip destfile="${ZipsOutPath}/${outputFileNamePrefix}_javadoc.zip" >
<zipfileset dir="${IntJavadocPath}"
includes="**" prefix="javadoc" />
</zip>
</target>
<!-- zip All -->
<target name="zip_All"
depends="precopy2, jar_classes, zip_src, zip_javadoc"
description="Pack the jar and zips into this distribution Zip file">
<delete file="${ZipsOutPath}/${outputFileNamePrefix}.zip" />
<zip destfile="${ZipsOutPath}/${outputFileNamePrefix}.zip" >
<zipfileset dir="${OutPath}"
includes="**" />
</zip>
</target>
<target name="build"
depends="zip_All"
description="Build ${TitlePrefix}">
</target>
<!-- CLEAN -->
<target name="clean" >
<delete dir="${BuildPath}" />
</target>
<!--
*******************************************************************************
Internal Targets
*******************************************************************************
-->
<!-- Internal build target; not for external use -->
<target name="-init">
<!-- set timestamp and print time -->
<tstamp>
<format property="TODAY" pattern="d-MMMM-yyyy.hh:mm:ss aa" locale="en"/>
<format property="DSTAMP" pattern="d-MMMM-yyyy" locale="en"/>
<format property="TSTAMP" pattern="hh:mm:ss aa" locale="en"/>
</tstamp>
<delete dir="${BuildPath}" />
<!-- build directories -->
<mkdir dir="${BuildPath}" />
<mkdir dir="${IntMainPath}" />
<mkdir dir="${IntTestPath}" />
<mkdir dir="${IntBinPath}" />
<mkdir dir="${IntJavadocPath}" />
<mkdir dir="${IntJavadocResourcesPath}" />
<mkdir dir="${IntScriptsPath}" />
<mkdir dir="${IntJarsPath}" />
<mkdir dir="${OutPath}" />
<mkdir dir="${JarsOutPath}" />
<mkdir dir="${ZipsOutPath}" />
<mkdir dir="${ScriptsOutPath}" />
<echo message="Build time: ${TODAY}"/>
<echo message="Initialized" />
</target>
</project>