configurationengine/build.xml
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
equal deleted inserted replaced
-1:000000000000 0:2e8eeb919028
       
     1 <!--****************************************************************************
       
     2  * Configuration Engine (ConE) main build file
       
     3  * This ant build.xml will build, install and test ConE and its plugins
       
     4  ****************************************************************************-->
       
     5 <project name="ConE"
       
     6          default="install">
       
     7   <property file="common.properties" />
       
     8   <property file="linux.properties" />
       
     9   <property file="windows.properties" />
       
    10   <property environment="env" />
       
    11   <!--
       
    12     Build properties, intended to be overridden from the command line
       
    13     where necessary.
       
    14 
       
    15     E.g. ant install -Dbuild.build_path=C:/my/install/path -Dbuild.plugin_package=symbian
       
    16     -->
       
    17   <property name="build.plugin_package"
       
    18             value="common" />
       
    19   <property name="build.base_path"
       
    20             value="build" />
       
    21   <property name="build.cone_install_path"
       
    22             value="${build.base_path}/cone" />
       
    23   <property name="build.bat_export_path"
       
    24             value="${build.base_path}/bat" />
       
    25   <property name="build.cone_pack_path"
       
    26             value="${build.base_path}/dist" />
       
    27   <property name="build.bat_pack_path"
       
    28             value="${build.base_path}/dist" />
       
    29   <property name="build.cone_install_path_abs"
       
    30             location="${build.cone_install_path}" />
       
    31   <property name="build.bat_export_path_abs"
       
    32             location="${build.bat_export_path}" />
       
    33   <property name="build.cone_pack_path_abs"
       
    34             location="${build.cone_pack_path}" />
       
    35   <property name="build.bat_pack_path_abs"
       
    36             location="${build.bat_pack_path}" />
       
    37   <property name="os.linux"
       
    38             value="Linux" />
       
    39   <property name="os.windows"
       
    40             value="Windows 2003, Windows XP, Windows vista" />
       
    41   <condition property="os_is_linux">
       
    42     <os name="${os.linux}" />
       
    43   </condition>
       
    44   <target name="info">
       
    45     <echoproperties />
       
    46   </target>
       
    47   <!-- Aliases -->
       
    48   <target name="install"
       
    49           depends="install-cone" />
       
    50   <target name="develop"
       
    51           depends="develop-cone" />
       
    52   <target name="test"
       
    53           depends="run-bat" />
       
    54   <target name="doc"
       
    55           depends="doc-all" />
       
    56   <target name="clean">
       
    57     <delete dir="${build.cone_install_path_abs}" />
       
    58     <delete dir="${build.bat_export_path_abs}" />
       
    59     <delete dir="${build.cone_pack_path_abs}" />
       
    60     <delete dir="${build.bat_pack_path_abs}" />
       
    61   </target>
       
    62   <target name="svnversion">
       
    63     <!--
       
    64         Call the revision update script without the revision argument
       
    65         so that the revision is reverted back to "" (this should make
       
    66         it so that the working copy has no modifications and the
       
    67         revision will be e.g. "1234" instead of "1234M".
       
    68         -->
       
    69     <echo>Revert SVN revision in source/cone/__init__.py</echo>
       
    70     <exec executable="python">
       
    71       <arg value="update_svn_revision.py" />
       
    72       <arg value="source/cone/__init__.py" />
       
    73     </exec>
       
    74     <echo>Determine current working copy revision</echo>
       
    75     <exec executable="svnversion"
       
    76           failifexecutionfails="false">
       
    77       <redirector outputproperty="svn.version" />
       
    78     </exec>
       
    79     <echo>SVN revision: ${svn.version}</echo>
       
    80   </target>
       
    81   <target name="svninitupdate"
       
    82           depends="svnversion">
       
    83     <echo>Update SVN revision in __init__.py</echo>
       
    84     <exec executable="python">
       
    85       <arg value="update_svn_revision.py" />
       
    86       <arg value="source/cone/__init__.py" />
       
    87       <arg value="${svn.version}" />
       
    88     </exec>
       
    89   </target>
       
    90   <target name="install-cone"
       
    91           depends="svninitupdate">
       
    92     <!--
       
    93         <echo>$${build.cone_install_path}:     ${build.cone_install_path}</echo>
       
    94         <echo>$${build.cone_install_path_abs}: ${build.cone_install_path_abs}</echo>
       
    95         -->
       
    96     <!-- Run the install script in build-scripts/ -->
       
    97     <exec executable="python"
       
    98           dir="${common.build_scripts_dir}"
       
    99           failonerror="true">
       
   100       <arg line='install_cone.py --target-dir="${build.cone_install_path_abs}" --plugin-package="${build.plugin_package}"' />
       
   101     </exec>
       
   102     <!-- Revert the SVN revision so that it doesn't mark the working copy as modified needlessly -->
       
   103     <echo>Revert SVN revision in source/cone/__init__.py</echo>
       
   104     <exec executable="python">
       
   105       <arg value="update_svn_revision.py" />
       
   106       <arg value="source/cone/__init__.py" />
       
   107     </exec>
       
   108   </target>
       
   109   <!--
       
   110     Target for installing ConE so that it supports two Python versions.
       
   111     
       
   112     Depends on two properties: build.dualversioninstall.path1 and
       
   113     build.dualversioninstall.path2 that must be set to the values of the PATH
       
   114     environment that contains the locations of the two Python installations.
       
   115     -->
       
   116   <target name="install-cone-dualversion"
       
   117           depends="svninitupdate">
       
   118     <!-- Run the install script using the first Python version-->
       
   119     <echo>Installing with first Python version (PATH=${build.dualversioninstall.path1})</echo>
       
   120     <exec executable="python"
       
   121           dir="${common.build_scripts_dir}"
       
   122           failonerror="true">
       
   123       <env key="PATH"
       
   124            value="${build.dualversioninstall.path1}" />
       
   125       <arg line='install_cone.py --target-dir="${build.cone_install_path_abs}" --plugin-package="${build.plugin_package}"' />
       
   126     </exec>
       
   127     <!-- Run the install script using the second Python version-->
       
   128     <echo>Installing with second Python version (PATH=${build.dualversioninstall.path2})</echo>
       
   129     <exec executable="python"
       
   130           dir="${common.build_scripts_dir}"
       
   131           failonerror="true">
       
   132       <env key="PATH"
       
   133            value="${build.dualversioninstall.path2}" />
       
   134       <arg line='install_cone.py --target-dir="${build.cone_install_path_abs}" --plugin-package="${build.plugin_package}"' />
       
   135     </exec>
       
   136     <!-- Revert the SVN revision so that it doesn't mark the working copy as modified needlessly -->
       
   137     <echo>Revert SVN revision in source/cone/__init__.py</echo>
       
   138     <exec executable="python">
       
   139       <arg value="update_svn_revision.py" />
       
   140       <arg value="source/cone/__init__.py" />
       
   141     </exec>
       
   142   </target>
       
   143   <target name="develop-cone">
       
   144     <!-- Run the install script in build-scripts/ -->
       
   145     <exec executable="python"
       
   146           dir="${common.build_scripts_dir}"
       
   147           failonerror="true">
       
   148       <arg line='install_cone.py --target-dir="${build.cone_install_path_abs}" --plugin-package="${build.plugin_package}" --install-type develop' />
       
   149     </exec>
       
   150   </target>
       
   151   <!--
       
   152     Internal pack target for packing the ConE installation.
       
   153     The actual dependencies to cone-install and cone-install-dualversion are
       
   154     specified in the actual targets below.
       
   155     -->
       
   156   <target name="_pack">
       
   157     <!--
       
   158         <echo>$${build.cone_pack_path}:     ${build.cone_pack_path}</echo>
       
   159         <echo>$${build.cone_pack_path_abs}: ${build.cone_pack_path_abs}</echo>
       
   160         -->
       
   161     <echo message="Creating zip file" />
       
   162     <mkdir dir="${build.cone_pack_path_abs}" />
       
   163     <tstamp>
       
   164       <format property="lastbuild"
       
   165               pattern="yyyyMMddHHmmss" />
       
   166     </tstamp>
       
   167     <zip destfile="${build.cone_pack_path_abs}/ConE-${common.version}-${build.plugin_package}-${lastbuild}-${svn.version}.zip">
       
   168       <fileset dir="${build.cone_install_path_abs}" />
       
   169     </zip>
       
   170   </target>
       
   171   <!-- Actual pack targets -->
       
   172   <target name="pack"
       
   173           depends="install-cone">
       
   174     <antcall target="_pack" />
       
   175   </target>
       
   176   <target name="pack-dualversion"
       
   177           depends="install-cone-dualversion">
       
   178     <antcall target="_pack" />
       
   179   </target>
       
   180   <target name="export-bat">
       
   181     <!--
       
   182         <echo>$${build.bat_export_path}:     ${build.bat_export_path}</echo>
       
   183         <echo>$${build.bat_export_path_abs}: ${build.bat_export_path_abs}</echo>
       
   184         -->
       
   185     <!-- Run the export script in build-scripts/ -->
       
   186     <exec executable="python"
       
   187           dir="${common.build_scripts_dir}"
       
   188           failonerror="true">
       
   189       <arg value="export_bat.py" />
       
   190       <arg value='--target-dir="${build.bat_export_path_abs}"' />
       
   191       <arg value='--plugin-package="${build.plugin_package}"' />
       
   192     </exec>
       
   193   </target>
       
   194   <target name="pack-bat"
       
   195           depends="export-bat">
       
   196     <echo message="Creating zip file" />
       
   197     <mkdir dir="${build.bat_pack_path_abs}" />
       
   198     <zip destfile="${build.bat_pack_path_abs}/ConE-BAT-${build.plugin_package}.zip">
       
   199       <fileset dir="${build.bat_export_path_abs}" />
       
   200     </zip>
       
   201   </target>
       
   202   <target name="run-bat"
       
   203           depends="install-cone,export-bat">
       
   204     <echo message="Moving ConE installation under BAT..." />
       
   205     <move todir="${build.bat_export_path_abs}/cone">
       
   206       <fileset dir="${build.cone_install_path_abs}" />
       
   207     </move>
       
   208     <echo message="Running tests..." />
       
   209     <exec executable="python"
       
   210           dir="${build.bat_export_path_abs}">
       
   211       <arg value="runtests.py" />
       
   212     </exec>
       
   213   </target>
       
   214   <target name="run-all-tests">
       
   215     <echo message="Run all tests" />
       
   216     <echo message="OS: ${os.name}" />
       
   217     <echo message="Python version: ${pythonversion}" />
       
   218     <subant buildpath="."
       
   219             target="run-all-tests-linux" />
       
   220     <subant buildpath="."
       
   221             target="run-all-tests-windows" />
       
   222   </target>
       
   223   <target name="run-all-tests-linux"
       
   224           if="os_is_linux">
       
   225     <echo message="Change Python version" />
       
   226     <echo message="ln -s -f /usr/bin/${pythonversion} ${os.linux.userbin}/python" />
       
   227     <exec executable="ln">
       
   228       <arg value="-s" />
       
   229       <arg value="-f" />
       
   230       <arg value="/usr/bin/${pythonversion}" />
       
   231       <arg value="${os.linux.userbin}/python" />
       
   232     </exec>
       
   233     <echo message="Python version:" />
       
   234     <exec executable="sh"
       
   235           dir="./source">
       
   236       <env key="PATH"
       
   237            path="${os.linux.userbin}:${env.PATH}" />
       
   238       <arg value="-c" />
       
   239       <arg value="python --version" />
       
   240     </exec>
       
   241     <echo message="Run tests" />
       
   242     <exec executable="sh"
       
   243           dir="./source">
       
   244       <env key="PATH"
       
   245            path="${os.linux.userbin}:${env.PATH}" />
       
   246       <arg value="-c" />
       
   247       <arg value="python runtests.py --with-nose" />
       
   248     </exec>
       
   249   </target>
       
   250   <target name="run-all-tests-windows"
       
   251           unless="os_is_linux">
       
   252     <echo message="Change Python version" />
       
   253     <echo message="Python version:" />
       
   254     <exec executable="cmd">
       
   255       <env key="PATH"
       
   256            path="${os.windows.pythonlocationbase}${pythonversion};${os.windows.pythonlocationbase}${pythonversion}/Scripts;${env.PATH}" />
       
   257       <arg value="/c" />
       
   258       <arg value="python --version" />
       
   259     </exec>
       
   260     <echo message="Run tests" />
       
   261     <exec executable="cmd"
       
   262           dir="./source">
       
   263       <env key="PATH"
       
   264            path="${os.windows.pythonlocationbase}${pythonversion};${os.windows.pythonlocationbase}${pythonversion}/Scripts;${env.PATH}" />
       
   265       <arg value="/c" />
       
   266       <arg value="python runtests.py --with-nose" />
       
   267     </exec>
       
   268   </target>
       
   269   <import file="generatedoc-build.xml" />
       
   270 </project>