[120] | 1 | <?xml version="1.0"?> |
---|
| 2 | |
---|
| 3 | <!-- |
---|
| 4 | Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 5 | contributor license agreements. See the NOTICE file distributed with |
---|
| 6 | this work for additional information regarding copyright ownership. |
---|
| 7 | The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 8 | (the "License"); you may not use this file except in compliance with |
---|
| 9 | the License. You may obtain a copy of the License at |
---|
| 10 | |
---|
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 12 | |
---|
| 13 | Unless required by applicable law or agreed to in writing, software |
---|
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 16 | See the License for the specific language governing permissions and |
---|
| 17 | limitations under the License. |
---|
| 18 | --> |
---|
| 19 | |
---|
| 20 | <project name="hod" default="compile"> |
---|
| 21 | <import file="../build-contrib.xml"/> |
---|
| 22 | <target name="compile"> |
---|
| 23 | <mkdir dir="${build.dir}"/> |
---|
| 24 | <copy todir="${build.dir}"> |
---|
| 25 | <fileset dir="${basedir}"> |
---|
| 26 | <exclude name="**/VERSION"/> |
---|
| 27 | </fileset> |
---|
| 28 | </copy> |
---|
| 29 | <exec executable="echo" output="${build.dir}/bin/VERSION"> |
---|
| 30 | <arg line="${version}" /> |
---|
| 31 | </exec> |
---|
| 32 | </target> |
---|
| 33 | <target name="package" depends="compile"> |
---|
| 34 | <mkdir dir="${dist.dir}/contrib/${name}"/> |
---|
| 35 | <copy todir="${dist.dir}/contrib/${name}"> |
---|
| 36 | <fileset dir="${build.dir}"/> |
---|
| 37 | </copy> |
---|
| 38 | <chmod dir="${dist.dir}/contrib/${name}/bin" perm="a+x" includes="*"/> |
---|
| 39 | </target> |
---|
| 40 | |
---|
| 41 | <target name="test" depends="compile" description="Run HOD unit tests"> |
---|
| 42 | <antcall target="python.pathcheck"/> |
---|
| 43 | <antcall target="checkAndRunTests"/> |
---|
| 44 | </target> |
---|
| 45 | |
---|
| 46 | <target name="checkAndRunTests" if="python.home"> |
---|
| 47 | <!-- Check python version now --> |
---|
| 48 | <exec executable="/bin/sh" outputproperty="hodtest.pythonVersion"> |
---|
| 49 | <arg value="-c" /> |
---|
| 50 | <arg value="${python.home}/python -V" /> |
---|
| 51 | </exec> |
---|
| 52 | <condition property="python.versionmatched"> |
---|
| 53 | <!--- Currently check for only 2.5.1 --> |
---|
| 54 | <equals arg1="${hodtest.pythonVersion}" arg2="Python 2.5.1" /> |
---|
| 55 | </condition> |
---|
| 56 | <antcall target="python.versioncheck"/> |
---|
| 57 | <antcall target="runtests"/> |
---|
| 58 | </target> |
---|
| 59 | |
---|
| 60 | <target name="python.pathcheck" unless="python.home"> |
---|
| 61 | <echo message="'python.home' is not defined. Please pass -Dpython.home=<Path to Python> to Ant on the command-line."/> |
---|
| 62 | </target> |
---|
| 63 | |
---|
| 64 | <target name="runtests" if="python.versionmatched"> |
---|
| 65 | <echo message="Using Python at : ${python.home}" /> |
---|
| 66 | <echo message="Version : ${hodtest.pythonVersion}"/> |
---|
| 67 | <exec executable="/bin/sh" resultproperty="hodtest.failedTests"> |
---|
| 68 | <arg value="-c" /> |
---|
| 69 | <arg value="${python.home}/python ${build.dir}/testing/main.py" /> |
---|
| 70 | </exec> |
---|
| 71 | <condition property="hodtest.success"> |
---|
| 72 | <equals arg1="${hodtest.failedTests}" arg2="0"/> |
---|
| 73 | </condition> |
---|
| 74 | <fail message="TestCases failed. ${hodtest.failedTests} failed to run successfully." unless="hodtest.success"/> |
---|
| 75 | </target> |
---|
| 76 | |
---|
| 77 | <target name="python.versioncheck" unless="python.versionmatched"> |
---|
| 78 | <echo message="Need Python version 2.5.1. You specified ${hodtest.pythonVersion}"/> |
---|
| 79 | </target> |
---|
| 80 | |
---|
| 81 | </project> |
---|