Skip to content

Commit

Permalink
moving common settings and tasks into build-common.xml and adding a b…
Browse files Browse the repository at this point in the history
…uild.version param
  • Loading branch information
Bill Graham committed Jan 24, 2013
1 parent 6526e48 commit f1fb0aa
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 71 deletions.
38 changes: 38 additions & 0 deletions build-common.xml
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="common">
<!--
Common build file for properties or tasks that should be shared across sub-project build files.
-->

<!-- When making a versioned release, create a branch and change the build.version below -->
<property name="build.version" value = "SNAPSHOT" />

<!-- some common defaults -->
<property name="hadoop-connector.jar"
value = "${basedir}/../hadoop-connector/build/hadoop-connector/jar/hadoop-vertica-${build.version}.jar" />

<!-- These require targets could be done better with a single macro -->
<target name="requirehadoopdir">
<fail message="Property &quot;hadoop.dir&quot; needs to be set to a value">
<condition>
<or>
<equals arg1="${hadoop.dir}" arg2=""/>
<not><isset property="hadoop.dir"/></not>
<not><available file="${hadoop.dir}" type="dir"/></not>
</or>
</condition>
</fail>
</target>

<target name="requirepigjar">
<fail message="Property &quot;pig.jar&quot; needs to be set to a valid jar file">
<condition>
<or>
<equals arg1="${pig.jar}" arg2=""/>
<not><isset property="pig.jar"/></not>
<not><available file="${pig.jar}" type="file"/></not>
</or>
</condition>
</fail>
</target>
</project>
18 changes: 4 additions & 14 deletions hadoop-connector/build.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar" name="hadoop-connector">
<include file="../build-common.xml"/>

<property environment="env"/>
<!--Required parameters. You have to specify these on the ANT command line -->
<!--JUNIT jars should be in the lib path. For e.g. specify using -lib -->
Expand All @@ -17,7 +19,7 @@

<property name="build.dir" location="${basedir}/build" />
<property name="dist" value="${build.dir}/hadoop-connector/jar"/>
<property name="jar.file" location="${dist}/${jar.name}.jar" />
<property name="jar.file" location="${dist}/${jar.name}-${build.version}.jar" />
<property name="build.classes" location="${build.dir}/hadoop-connector/classes"/>
<property name="build.test.classes" location="${build.dir}/hadoop-connector/tests" />
<property name="junit.output.dir" value="${build.dir}/hadoop-connector/junit"/>
Expand Down Expand Up @@ -61,19 +63,7 @@

<target depends="clean" name="cleanall"/>

<target name="requirehadoopdir">
<fail message="Property &quot;hadoop.dir&quot; needs to be set to a value">
<condition>
<or>
<equals arg1="${hadoop.dir}" arg2=""/>
<not><isset property="hadoop.dir"/></not>
<not><available file="${hadoop.dir}" type="dir"/></not>
</or>
</condition>
</fail>
</target>

<target depends="requirehadoopdir,init" name="compile">
<target depends="common.requirehadoopdir,init" name="compile">
<echo>hadoop.dir: ${hadoop.dir}</echo>
<echo></echo>
<mkdir dir="${build.classes}"/>
Expand Down
19 changes: 4 additions & 15 deletions hadoop-example/build.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar" name="hadoop-example">
<include file="../build-common.xml"/>

<property environment="env"/>
<!--Required parameters. You have to specify these on the ANT command line -->
<!--JUNIT jars should be in the lib path. For e.g. specify using -lib -->
<property name="vertica.jar" value = "" />
<property name="hadoop-connector.jar" value = "${basedir}/../hadoop-connector/build/hadoop-connector/jar/hadoop-vertica.jar" />
<property name="hadoop.dir" value="" />
<property name="doc.dir" value="" />

Expand All @@ -18,7 +19,7 @@

<property name="build.dir" location="${basedir}/build" />
<property name="dist" value="${build.dir}/hadoop-example/jar"/>
<property name="jar.file" location="${dist}/${jar.name}.jar" />
<property name="jar.file" location="${dist}/${jar.name}-${build.version}.jar" />
<property name="build.classes" location="${build.dir}/hadoop-example/" />

<!-- Lesson: You can add location of jar files here -->
Expand Down Expand Up @@ -48,19 +49,7 @@

<target depends="clean" name="cleanall"/>

<target name="requirehadoopdir">
<fail message="Property &quot;hadoop.dir&quot; needs to be set to a valid directory">
<condition>
<or>
<equals arg1="${hadoop.dir}" arg2=""/>
<not><isset property="hadoop.dir"/></not>
<not><available file="${hadoop.dir}" type="dir"/></not>
</or>
</condition>
</fail>
</target>

<target depends="requirehadoopdir,init" name="compile">
<target depends="common.requirehadoopdir,init" name="compile">
<mkdir dir="${build.classes}"/>
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="${build.classes}"
Expand Down
32 changes: 4 additions & 28 deletions pig-connector/build.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar" name="pig-vertica">
<include file="../build-common.xml"/>

<property environment="env"/>
<!--Required parameters. You have to specify these on the ANT command line -->
<!--JUNIT jars should be in the lib path. For e.g. specify using -lib -->
<property name="vertica.jar" value = "" />
<property name="hadoop-connector.jar" value = "${basedir}/../hadoop-connector/build/hadoop-connector/jar/hadoop-vertica.jar" />
<property name="doc.dir" value="" />

<property name="jar.name" value="pig-vertica" />
Expand All @@ -17,7 +18,7 @@

<property name="build.dir" location="${basedir}/build" />
<property name="dist" value="${build.dir}/pig-connector/jar"/>
<property name="jar.file" location="${dist}/${jar.name}.jar" />
<property name="jar.file" location="${dist}/${jar.name}-${build.version}.jar" />
<property name="build.classes" location="${build.dir}/pig-connector/classes"/>

<!-- Lesson: You can add location of jar files here -->
Expand Down Expand Up @@ -49,32 +50,7 @@
<delete dir="${doc.dir}/pig-connector"/>
</target>


<target name="requirehadoopdir">
<fail message="Property &quot;hadoop.dir&quot; needs to be set to a valid directory">
<condition>
<or>
<equals arg1="${hadoop.dir}" arg2=""/>
<not><isset property="hadoop.dir"/></not>
<not><available file="${hadoop.dir}" type="dir"/></not>
</or>
</condition>
</fail>
</target>

<target name="requirepigjar">
<fail message="Property &quot;pig.jar&quot; needs to be set to a valid jar file">
<condition>
<or>
<equals arg1="${pig.jar}" arg2=""/>
<not><isset property="pig.jar"/></not>
<not><available file="${pig.jar}" type="file"/></not>
</or>
</condition>
</fail>
</target>

<target depends="requirehadoopdir, requirepigjar, init" name="compile">
<target depends="common.requirehadoopdir,common.requirepigjar,init" name="compile">
<fail unless="hadoop.dir">Property hadoop.dir must be set.</fail>
<fail unless="pig.jar">Property pig.jar must be set.</fail>
<echo>hadoop.dir : ${hadoop.dir}</echo>
Expand Down
18 changes: 4 additions & 14 deletions squeal/build.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar" name="squeal">
<include file="../build-common.xml"/>

<property environment="env"/>
<!--Required parameters. You have to specify these on the ANT command line -->
<!--JUNIT jars should be in the lib path. For e.g. specify using -lib -->
Expand All @@ -24,7 +26,7 @@
<property name="build.dir" location="${basedir}/build" />
<property name="build.classes" location="${build.dir}/squeal/classes"/>
<property name="dist" value="${build.dir}/squeal/jar"/>
<property name="jar.file" location="${dist}/${jar.name}.jar" />
<property name="jar.file" location="${dist}/${jar.name}-${build.version}.jar" />

<!-- Lesson: You can add location of jar files here -->
<path id="compile.classpath">
Expand Down Expand Up @@ -74,19 +76,7 @@
</fail>
</target>

<target name="requirepigjar">
<fail message="Property &quot;pig.jar&quot; needs to be set to a valid jar file">
<condition>
<or>
<equals arg1="${pig.jar}" arg2=""/>
<not><isset property="pig.jar"/></not>
<not><available file="${pig.jar}" type="file"/></not>
</or>
</condition>
</fail>
</target>

<target depends="requirehadoopdir,requirepigjar,init" name="compile">
<target depends="common.requirehadoopdir,common.requirepigjar,init" name="compile">
<echo>hadoop.dir : ${hadoop.dir}</echo>
<echo>pig.jar : ${pig.jar}</echo>
<mkdir dir="${build.classes}"/>
Expand Down

0 comments on commit f1fb0aa

Please sign in to comment.