build.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <!--
  2. Licensed to Cloudera, Inc. under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. Cloudera, Inc. licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!-- Ant build file for beeswax server -->
  17. <project name="beeswax" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">
  18. <property name="src.dir" location="src" />
  19. <property name="lib.dir" location="${build.dir}/lib" />
  20. <property name="javac.debug" value="on"/>
  21. <property name="javac.optimize" value="on"/>
  22. <property name="javac.deprecation" value="on"/>
  23. <property name="javac.args.warnings" value="-Xlint:unchecked"/>
  24. <property name="javac.args" value=""/>
  25. <path id="build.classpath">
  26. <fileset dir="${hadoop.home}">
  27. <include name="hadoop*core*.jar" />
  28. </fileset>
  29. <!-- TODO(philip): This could be pruned down. -->
  30. <fileset dir="${hive.lib}">
  31. <include name="*.jar" />
  32. </fileset>
  33. <!--fileset dir="${lib.dir}/default">
  34. <include name="**/*.jar" />
  35. </fileset-->
  36. </path>
  37. <target name="init">
  38. <mkdir dir="${build.dir}/classes" />
  39. <mkdir dir="${build.dir}/test-classes" />
  40. </target>
  41. <target name="build" depends="init">
  42. <echo message="HDR: ${hadoop.home}"/>
  43. <javac
  44. srcdir="gen-java"
  45. destdir="${build.dir}/classes"
  46. debug="${javac.debug}"
  47. optimize="${javac.optimize}"
  48. deprecation="${javac.deprecation}">
  49. <classpath refid="build.classpath" />
  50. <compilerarg line="${javac.args}" />
  51. </javac>
  52. <javac
  53. srcdir="src"
  54. destdir="${build.dir}/classes"
  55. debug="${javac.debug}"
  56. optimize="${javac.optimize}"
  57. deprecation="${javac.deprecation}">
  58. <classpath refid="build.classpath" />
  59. <compilerarg line="${javac.args} ${javac.args.warnings}" />
  60. </javac>
  61. </target>
  62. <target name="jar" depends="build">
  63. <copy todir="${build.dir}/out">
  64. <fileset dir="${src.dir}" includes="META-INF/*" />
  65. </copy>
  66. <mkdir dir="${build.dir}/jar"/>
  67. <jar destfile="${build.dir}/jar/BeeswaxServer.jar" basedir="${build.dir}/classes">
  68. <manifest>
  69. <attribute name="Main-Class" value="com.cloudera.beeswax.Server"/>
  70. </manifest>
  71. </jar>
  72. </target>
  73. <target name="test-build" depends="init" description="Compile sample code used in testing.">
  74. <javac
  75. srcdir="test"
  76. destdir="${build.dir}/test-classes"
  77. debug="${javac.debug}"
  78. optimize="${javac.optimize}"
  79. deprecation="${javac.deprecation}">
  80. <classpath refid="build.classpath" />
  81. <compilerarg line="${javac.args}" />
  82. </javac>
  83. </target>
  84. <target name="test-jar" depends="test-build">
  85. <copy todir="${build.dir}/out">
  86. <fileset dir="${src.dir}" includes="META-INF/*" />
  87. </copy>
  88. <mkdir dir="${build.dir}/jar"/>
  89. <jar destfile="${build.dir}/jar/BeeswaxTest.jar" basedir="${build.dir}/test-classes" />
  90. </target>
  91. <target name="clean">
  92. <delete dir="${build.dir}" />
  93. </target>
  94. <target name="run">
  95. <java classname="com.cloudera.beeswax.Server" failonerror="true" fork="yes">
  96. <env key="JAVA_HOME" value="${java.home}" />
  97. <env key="HADOOP_HOME" value="${HADOOP_HOME}"/>
  98. <classpath refid="build.classpath"/>
  99. <classpath path="${build.dir}/classes" />
  100. <classpath path="${hadoop.dir}/conf" />
  101. </java>
  102. </target>
  103. <!-- START GENERIC IVY TARGETS -->
  104. <property name="ivy.install.version" value="2.0.0-beta1" />
  105. <condition property="ivy.home" value="${env.IVY_HOME}">
  106. <isset property="env.IVY_HOME" />
  107. </condition>
  108. <property name="ivy.home" value="${user.home}/.ivy_beeswax" />
  109. <property name="ivy.jar.dir" value="${ivy.home}/lib" />
  110. <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
  111. <target name="download-ivy" unless="offline">
  112. <mkdir dir="${ivy.jar.dir}"/>
  113. <!-- download Ivy from web site so that it can be used even without any special installation -->
  114. <get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/ivy.jar"
  115. dest="${ivy.jar.file}" usetimestamp="true"/>
  116. </target>
  117. <target name="init-ivy" depends="download-ivy">
  118. <!-- try to load ivy here from ivy home, in case the user has not already dropped
  119. it into ant's lib dir (note that the latter copy will always take precedence).
  120. We will not fail as long as local lib dir exists (it may be empty) and
  121. ivy is in at least one of ant's lib dir or the local lib dir. -->
  122. <path id="ivy.lib.path">
  123. <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
  124. </path>
  125. <taskdef resource="org/apache/ivy/ant/antlib.xml"
  126. uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
  127. </target>
  128. <target name="resolve" description="--> retrieve dependencies with ivy" depends="init-ivy">
  129. <mkdir dir="${lib.dir}"/>
  130. <ivy:retrieve pattern="${lib.dir}/[conf]/[module]/[revision]/[type]/[artifact].[ext]" />
  131. </target>
  132. <!-- END GENERIC IVY TARGETS -->
  133. </project>