blob: 1cc4f780444a225c49a5f663128dd01b75b9d78b [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Ant build file for MRQL
-->
<project name="MRQL"
basedir="."
default="mapreduce">
<property name="HOME" value="${user.home}"/>
<property file="conf/mrql-env.sh"/>
<property file="conf/mrql-ant-env.sh"/>
<path id="classpath">
<pathelement location="${JLINE_JAR}"/>
<pathelement location="${JFLEX_JAR}"/>
<pathelement location="${CUP_JAR}"/>
<pathelement path="${MRQL_CLASSPATH}"/>
</path>
<target name="mapreduce"
depends="common"
description="Build the MRQL MapReduce jar">
<fileset id="mr.gen.path" dir="src/main/java/MapReduce" includes="*.gen"/>
<pathconvert pathsep=" " property="mr.gen.files" refid="mr.gen.path"/>
<java classname="org.apache.mrql.gen.Main">
<classpath refid="classpath"/>
<arg line="${mr.gen.files}"/>
<arg line="-o"/>
<arg file="tmp"/>
</java>
<javac srcdir="src/main/java:tmp" destdir="classes" classpathref="classpath"
includeantruntime="false">
<exclude name="BSP/*"/>
<exclude name="spark/*"/>
</javac>
<jar destfile="lib/mrql-mr-${MRQL_VERSION}.jar" basedir="classes">
<zipfileset includes="**/*" src="${JLINE_JAR}"/>
<zipfileset includes="**/*.class" src="${CUP_JAR}"/>
<zipfileset includes="**/*.class" src="${JFLEX_JAR}"/>
</jar>
</target>
<target name="bsp"
depends="common"
description="Build the MRQL BSP jar">
<fileset id="bsp.gen.path" dir="src/main/java/BSP" includes="*.gen"/>
<pathconvert pathsep=" " property="bsp.gen.files" refid="bsp.gen.path"/>
<java classname="org.apache.mrql.gen.Main">
<classpath refid="classpath"/>
<arg line="${bsp.gen.files}"/>
<arg line="-o"/>
<arg file="tmp"/>
</java>
<javac srcdir="src/main/java:tmp" destdir="classes" classpathref="classpath"
includeantruntime="false">
<exclude name="MapReduce/*"/>
<exclude name="spark/*"/>
</javac>
<jar destfile="lib/mrql-bsp-${MRQL_VERSION}.jar" basedir="classes">
<zipfileset includes="**/*" src="${JLINE_JAR}"/>
<zipfileset includes="**/*.class" src="${CUP_JAR}"/>
<zipfileset includes="**/*.class" src="${JFLEX_JAR}"/>
</jar>
</target>
<target name="spark"
depends="common"
description="Build the MRQL Spark jar">
<fileset id="spark.gen.path" dir="src/main/java/spark" includes="*.gen"/>
<pathconvert pathsep=" " property="spark.gen.files" refid="spark.gen.path"/>
<java classname="org.apache.mrql.gen.Main">
<classpath refid="classpath"/>
<arg line="${spark.gen.files}"/>
<arg line="-o"/>
<arg file="tmp"/>
</java>
<javac srcdir="src/main/java:tmp" destdir="classes" classpathref="classpath"
includeantruntime="false">
<exclude name="MapReduce/*"/>
<exclude name="BSP/*"/>
</javac>
<jar destfile="lib/mrql-spark-${MRQL_VERSION}.jar" basedir="classes">
<zipfileset includes="**/*" src="${JLINE_JAR}"/>
<zipfileset includes="**/*.class" src="${CUP_JAR}"/>
<zipfileset includes="**/*.class" src="${JFLEX_JAR}"/>
</jar>
</target>
<target name="common"
depends="clean_build,gen,mrql_parser,json_parser"
description="Translate the GEN files and generate the parsers">
<fileset id="gen.path" dir="src/main/java/core" includes="*.gen"/>
<pathconvert pathsep=" " property="gen.files" refid="gen.path"/>
<java classname="org.apache.mrql.gen.Main">
<classpath refid="classpath"/>
<arg line="${gen.files}"/>
<arg line="-o"/>
<arg file="tmp"/>
</java>
</target>
<target name="clean_build"
description="Clean the build directories">
<delete dir="classes"/>
<delete dir="tmp"/>
<mkdir dir="lib"/>
<mkdir dir="classes"/>
<mkdir dir="tmp"/>
<mkdir dir="tests/results"/>
<mkdir dir="tests/results/mr-memory"/>
<mkdir dir="tests/results/bsp-memory"/>
<mkdir dir="tests/results/hadoop"/>
<mkdir dir="tests/results/bsp"/>
<mkdir dir="tests/results/spark"/>
</target>
<target name="gen"
description="Generate the Gen tool">
<java jar="${JFLEX_JAR}" fork='true'>
<arg line="--quiet --nobak"/>
<arg file="src/main/java/gen/gen.lex"/>
<arg line="-d"/>
<arg file="tmp"/>
</java>
<java jar="${CUP_JAR}" fork='true'>
<arg line="-nosummary"/>
<arg line="-symbols GenSym"/>
<arg line="-parser GenParser"/>
<arg file="src/main/java/gen/gen.cup"/>
</java>
<move todir="tmp">
<filelist dir=".">
<file name="GenSym.java"/>
<file name="GenParser.java"/>
</filelist>
</move>
<javac srcdir="src/main/java/gen:tmp" destdir="classes" classpathref="classpath"
includeantruntime="false">
</javac>
</target>
<target name="mrql_parser"
description="Generate the MRQL scanner and parser">
<java jar="${JFLEX_JAR}" fork='true'>
<arg line="--quiet --nobak"/>
<arg file="src/main/java/core/mrql.lex"/>
<arg line="-d"/>
<arg file="tmp"/>
</java>
<java classname="org.apache.mrql.gen.Main">
<classpath refid="classpath"/>
<arg file="src/main/java/core/mrql.cgen"/>
<arg line="-o"/>
<arg file="tmp/mrql.cup"/>
</java>
<java jar="${CUP_JAR}" fork='true'>
<arg line="-nosummary"/>
<arg line="-parser MRQLParser"/>
<arg file="tmp/mrql.cup"/>
</java>
<move todir="tmp">
<filelist dir=".">
<file name="sym.java"/>
<file name="MRQLParser.java"/>
</filelist>
</move>
</target>
<target name="json_parser"
description="Generate the JSON scanner and parser">
<java jar="${JFLEX_JAR}" fork='true'>
<arg line="--quiet --nobak"/>
<arg file="src/main/java/core/JSON.lex"/>
<arg line="-d"/>
<arg file="tmp"/>
</java>
<java jar="${CUP_JAR}" fork='true'>
<arg line="-nosummary"/>
<arg line="-parser JSONParser"/>
<arg line="-symbols jsym"/>
<arg file="src/main/java/core/JSON.cup"/>
</java>
<move todir="tmp">
<filelist dir=".">
<file name="jsym.java"/>
<file name="JSONParser.java"/>
</filelist>
</move>
</target>
<path id="mrql-classpath">
<pathelement location="lib/mrql-mr-${MRQL_VERSION}.jar"/>
<path refid="classpath"/>
</path>
<path id="bsp-classpath">
<pathelement location="lib/mrql-bsp-${MRQL_VERSION}.jar"/>
<path refid="classpath"/>
</path>
<path id="spark-classpath">
<pathelement location="lib/mrql-spark-${MRQL_VERSION}.jar"/>
<path refid="classpath"/>
</path>
<target name="validate"
description="Validate all test queries"
depends="validate_hadoop,validate_hama,validate_spark"/>
<target name="validate_hadoop"
description="Validate all test queries on Hadoop">
<echo message="Evaluating test queries in memory (Map-Reduce mode):"/>
<java classname="org.apache.mrql.Test" fork="yes">
<classpath refid="mrql-classpath"/>
<arg file="tests/queries"/>
<arg file="tests/results/mr-memory"/>
<arg file="tests/error_log.txt"/>
</java>
<echo message="Evaluating test queries in Hadoop local mode:"/>
<java classname="org.apache.mrql.Test" fork="yes" error="/dev/null">
<classpath refid="mrql-classpath"/>
<arg line="-local"/>
<arg file="tests/queries"/>
<arg file="tests/results/hadoop"/>
<arg file="tests/error_log.txt"/>
</java>
</target>
<target name="validate_hama"
description="Validate all test queries on Hama">
<echo message="Evaluating test queries in memory (BSP mode):"/>
<java classname="org.apache.mrql.Test" fork="yes">
<classpath refid="bsp-classpath"/>
<arg file="tests/queries"/>
<arg file="tests/results/bsp-memory"/>
<arg file="tests/error_log.txt"/>
</java>
<echo message="Evaluating test queries in Hama local mode:"/>
<java classname="org.apache.mrql.Test" fork="yes" error="/dev/null">
<classpath refid="bsp-classpath"/>
<arg line="-local"/>
<arg file="tests/queries"/>
<arg file="tests/results/bsp"/>
<arg file="tests/error_log.txt"/>
</java>
</target>
<target name="validate_spark"
description="Validate all test queries on Spark">
<echo message="Evaluating test queries in Spark local mode:"/>
<java classname="org.apache.mrql.Test" fork="yes" error="/dev/null">
<classpath refid="spark-classpath"/>
<arg line="-local"/>
<arg file="tests/queries"/>
<arg file="tests/results/spark"/>
<arg file="tests/error_log.txt"/>
</java>
</target>
<target name="clean_tests"
description="Clean test results">
<delete>
<fileset dir="tests/results" includes="*/*"/>
</delete>
</target>
<target name="clean"
description="Clean build artifacts">
<delete dir="classes"/>
<delete dir="tmp"/>
<delete dir="mrql-tmp"/>
<delete>
<fileset dir="." includes="**/*~"/>
</delete>
</target>
</project>