| <?xml version="1.0" encoding="UTF-8"?> |
| |
| <!-- |
| |
| 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. |
| |
| --> |
| |
| <project name="Top-Level property definitions" default="echo" basedir=".."> |
| <description> |
| Ant file of common properties to be imported by other ant files. |
| Property "hy.hdk" must be defined before this file is imported. |
| </description> |
| |
| <property file="${user.home}/.harmony-classlib.properties" /> |
| |
| <fail message="Property 'hy.hdk' is not defined"> |
| <condition> |
| <not><isset property="hy.hdk" /></not> |
| </condition> |
| </fail> |
| <property name="hy.jdk" location="${hy.hdk}/jdk" /> |
| <property name="hy.jre" location="${hy.jdk}/jre" /> |
| |
| <!-- Debug or release version --> |
| <property name="hy.cfg" value="debug" /> |
| |
| <!-- Javac properties --> |
| <!-- Explicitly set to ECJ as the default compiler. --> |
| <property name="hy.javac.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" /> |
| <property name="hy.javac.source" value="1.5" /> |
| <property name="hy.javac.target" value="1.5" /> |
| <property name="hy.javac.maxmem" value="384M" /> |
| <property name="hy.javac.debug" value="on" /> |
| <property name="hy.jar.compress" value="true" /> |
| <property name="build.compilerarg" value="-nowarn" /> |
| |
| <!-- Include only stack trace information into release build --> |
| <condition property="hy.javac.debuglevel" value="lines,vars,source" else="lines,source"> |
| <equals arg1="${hy.cfg}" arg2="debug" /> |
| </condition> |
| |
| <!-- During packaging, these files must be copied into the meta-inf dir --> |
| <fileset id="hy.required.metainf-files" dir="${hy.hdk}"> |
| <include name="NOTICE" /> |
| <include name="LICENSE" /> |
| </fileset> |
| |
| <!-- Test run property --> |
| <property name="hy.test.forkmode" value="once" /> |
| <property name="hy.test.timeout" value="900000" /> |
| <property name="hy.test.vmargs" value="" /> |
| |
| <!-- Conditions for operating systems --> |
| <condition property="is.windows"> |
| <os family="Windows" /> |
| </condition> |
| <condition property="is.linux"> |
| <os name="linux" /> |
| </condition> |
| <condition property="is.macosx"> |
| <os name="mac os x" /> |
| </condition> |
| <condition property="is.freebsd"> |
| <os name="freebsd" /> |
| </condition> |
| <condition property="is.aix"> |
| <os name="aix" /> |
| </condition> |
| <condition property="is.unix"> |
| <os family="unix" /> |
| </condition> |
| <condition property="is.zos"> |
| <os name="z/OS" /> |
| </condition> |
| |
| <!-- Normalized operating system family --> |
| <condition property="hy.os.family" value="windows"> |
| <isset property="is.windows" /> |
| </condition> |
| <property name="hy.os.family" value="unix" /> |
| |
| <!-- Normalized operating system name --> |
| |
| <!-- this special case makes sense --> |
| <condition property="hy.os" value="windows"> |
| <isset property="is.windows"/> |
| </condition> |
| <condition property="hy.os" value="linux"> |
| <os name="linux" /> |
| </condition> |
| <condition property="hy.os" value="freebsd"> |
| <os name="freebsd" /> |
| </condition> |
| <condition property="hy.os" value="macosx"> |
| <isset property="is.macosx"/> |
| </condition> |
| <condition property="hy.os" value="aix"> |
| <os name="aix" /> |
| </condition> |
| <condition property="hy.os" value="zos"> |
| <isset property="is.zos"/> |
| </condition> |
| |
| <property name="hy.os" value="${os.name}" /> |
| |
| |
| |
| <!-- Conditions for different architectures --> |
| <condition property="is.x86_64"> |
| <or> |
| <equals arg1="x86_64" arg2="${os.arch}"/> |
| <equals arg1="amd64" arg2="${os.arch}"/> |
| </or> |
| </condition> |
| <condition property="is.x86"> |
| <and> |
| <not> |
| <isset property="is.x86_64" /> |
| </not> |
| <or> |
| <equals arg1="x86" arg2="${os.arch}"/> |
| <equals arg1="i386" arg2="${os.arch}"/> |
| <equals arg1="i686" arg2="${os.arch}"/> |
| </or> |
| </and> |
| </condition> |
| <condition property="is.ia64"> |
| <equals arg1="ia64" arg2="${os.arch}"/> |
| </condition> |
| <condition property="is.ppc32"> |
| <or> |
| <equals arg1="${os.arch}" arg2="ppc32" /> |
| <equals arg1="${os.arch}" arg2="ppc" /> |
| </or> |
| </condition> |
| <condition property="is.ppc64"> |
| <equals arg1="${os.arch}" arg2="ppc64" /> |
| </condition> |
| <condition property="is.s390x"> |
| <equals arg1="${os.arch}" arg2="s390x" /> |
| </condition> |
| <condition property="is.s390"> |
| <equals arg1="${os.arch}" arg2="s390" /> |
| </condition> |
| |
| <condition property="is.64bit"> |
| <or> |
| <isset property="is.ia64" /> |
| <isset property="is.x86_64" /> |
| <isset property="is.ppc64" /> |
| <isset property="is.s390x" /> |
| </or> |
| </condition> |
| <condition property="is.32bit"> |
| <or> |
| <isset property="is.x86" /> |
| <isset property="is.ppc32" /> |
| <isset property="is.s390" /> <!-- 31bit of course --> |
| </or> |
| </condition> |
| <condition property="hy.bits" value="32"> |
| <isset property="is.32bit" /> |
| </condition> |
| <property name="hy.bits" value="64" /> |
| |
| <!-- Normalized architecture name --> |
| <condition property="hy.arch" value="x86_64"> |
| <isset property="is.x86_64" /> |
| </condition> |
| <condition property="hy.arch" value="x86"> |
| <and> |
| <isset property="is.x86" /> |
| <isset property="is.32bit" /> |
| </and> |
| </condition> |
| <condition property="hy.arch" value="ppc32"> |
| <isset property="is.ppc32" /> |
| </condition> |
| <property name="hy.arch" value="${os.arch}" /> |
| |
| <!-- Normalized platform name --> |
| <property name="hy.platform" value="${hy.os}.${hy.arch}"/> |
| <property name="hy.platform.path" value="${hy.os}/${hy.arch}"/> |
| |
| <condition property="exe.suffix" value=".exe"> |
| <isset property="is.windows"/> |
| </condition> |
| <property name="exe.suffix" value="" /> |
| |
| <condition property="shlib.prefix" value=""> |
| <isset property="is.windows"/> |
| </condition> |
| <property name="shlib.prefix" value="lib" /> |
| |
| <condition property="shlib.suffix" value=".dll"> |
| <isset property="is.windows"/> |
| </condition> |
| <condition property="shlib.suffix" value=".dylib"> |
| <isset property="is.macosx"/> |
| </condition> |
| <property name="shlib.suffix" value=".so" /> |
| |
| <condition property="progdb.suffix" value=".pdb"> |
| <isset property="is.windows" /> |
| </condition> |
| |
| <condition property="object.suffix" value=".obj"> |
| <isset property="is.windows" /> |
| </condition> |
| <property name="object.suffix" value=".o" /> |
| |
| <condition property="linklib.suffix" value=".lib"> |
| <isset property="is.windows"/> |
| </condition> |
| <condition property="linklib.suffix" value=".x"> |
| <isset property="is.zos" /> |
| </condition> |
| <condition property="linklib.suffix" value=".dylib"> |
| <isset property="is.macosx"/> |
| </condition> |
| <property name="linklib.suffix" value=".so" /> |
| |
| <condition property="shlib.is.linklib"> |
| <equals arg1="${shlib.suffix}" arg2="${linklib.suffix}"/> |
| </condition> |
| |
| <property name="manifest.suffix" value=".manifest" /> |
| |
| <condition property="make.command" value="nmake.exe"> |
| <isset property="is.windows"/> |
| </condition> |
| <condition property="make.command" value="gmake"> |
| <or> |
| <isset property="is.aix"/> |
| <isset property="is.freebsd"/> |
| <isset property="is.zos"/> |
| </or> |
| </condition> |
| <property name="make.command" value="make" /> |
| |
| <condition property="make.arg" value="/nologo"> |
| <isset property="is.windows"/> |
| </condition> |
| <property name="make.arg" value="" /> |
| |
| <condition property="png.home" value="/usr/local"> |
| <isset property="is.freebsd"/> |
| </condition> |
| <condition property="png.home" value="/opt/local"> |
| <isset property="is.macosx"/> |
| </condition> |
| <property name="png.home" value="/usr" /> |
| |
| <condition property="lcms.home" value="/usr/local"> |
| <isset property="is.freebsd"/> |
| </condition> |
| <condition property="lcms.home" value="/opt/local"> |
| <isset property="is.macosx"/> |
| </condition> |
| <property name="lcms.home" value="/usr" /> |
| |
| <condition property="jpeg.home" value="/usr/local"> |
| <isset property="is.freebsd"/> |
| </condition> |
| <condition property="jpeg.home" value="/opt/local"> |
| <isset property="is.macosx"/> |
| </condition> |
| <property name="jpeg.home" value="/usr" /> |
| |
| <!-- default property for poll-modules macro - i.e. all modules --> |
| <property name="build.module" value="*" /> |
| <property name="exclude.module" value="nothing" /> |
| |
| <!-- flags --> |
| <property name="hy.no.thr" value="false" /> |
| <condition property="hy.skip.thr" value="true"> |
| <not> |
| <equals arg1="${hy.no.thr}" arg2="false" /> |
| </not> |
| </condition> |
| |
| <property name="hy.local.zlib" value="false" /> |
| <condition property="hy.skip.zlib" value="true"> |
| <not> |
| <equals arg1="${hy.local.zlib}" arg2="false" /> |
| </not> |
| </condition> |
| |
| <property name="hy.zip.api" value="false" /> |
| <condition property="hy.skip.zip.api" value="true"> |
| <not> |
| <equals arg1="${hy.zip.api}" arg2="true" /> |
| </not> |
| </condition> |
| |
| <condition property="hy.portlib.stubs" value="true"> |
| <or> |
| <equals arg1="${hy.os}" arg2="aix" /> |
| <equals arg1="${hy.os}" arg2="zos" /> |
| </or> |
| </condition> |
| <property name="hy.portlib.stubs" value="false" /> |
| |
| <condition property="hy.libstdc++.suffix" value=".libstdc++5"> |
| <isset property="use.libstdc++5"/> |
| </condition> |
| <property name="hy.libstdc++.suffix" value="" /> |
| |
| <property name="hy.platform.variant" |
| value="${hy.platform}${hy.libstdc++.suffix}" /> |
| |
| <!-- fileset to represent classes built by a module. --> |
| <fileset id="classes" dir="../../build/classes"> |
| <includesfile name="${hy.hdk}/build/ant/patternsets/${hy.module}.txt" /> |
| </fileset> |
| |
| <!-- fileset for resources of a module. --> |
| <fileset id="resources" dir="src/main/java"> |
| <exclude name="**/*.java" /> |
| </fileset> |
| |
| <!-- fileset for resources of a module with platform-dependent code. --> |
| <fileset id="common.resources" dir="src/main/java/common"> |
| <exclude name="**/*.java" /> |
| </fileset> |
| |
| <!-- test properties --> |
| <property name="tests.output" location="../../build/test_report" /> |
| <property name="tests.hdk.dir" value="${hy.hdk}/build/test/${hy.module}" /> |
| <property name="tests.excludes.hdk.dir" value="${tests.hdk.dir}/excludes" /> |
| <property name="tests.resources.hdk.dir" |
| value="${tests.hdk.dir}/resources" /> |
| |
| <property name="findBugs.report" location="../../build/findbugs_report" /> |
| |
| <target name="echo" depends="svn-prop, svn-info, test-jre-vm-info" |
| description="Display the properties defined by this ant file" > |
| <echo> |
| Harmony release configuration property: |
| |
| hy.cfg = ${hy.cfg} |
| |
| Harmony javac properties: |
| |
| hy.javac.compiler = ${hy.javac.compiler} |
| hy.javac.target = ${hy.javac.target} |
| hy.javac.source = ${hy.javac.source} |
| hy.javac.debug = ${hy.javac.debug} |
| hy.javac.maxmem = ${hy.javac.maxmem} |
| build.compilerarg = ${build.compilerarg} |
| |
| Harmony test properties: |
| |
| hy.test.forkmode = ${hy.test.forkmode} |
| hy.test.timeout = ${hy.test.timeout} |
| hy.test.vm.name = ${hy.test.vm.name} |
| hy.test.vmargs = ${hy.test.vmargs} |
| findbugs.available = ${findbugs.available} |
| |
| Harmony platform properties: |
| |
| hy.os = ${hy.os} |
| hy.os.family = ${hy.os.family} |
| hy.arch = ${hy.arch} |
| hy.bits = ${hy.bits} |
| hy.platform = ${hy.platform} |
| hy.platform.path = ${hy.platform.path} |
| |
| is.windows = ${is.windows} |
| is.unix = ${is.unix} |
| is.linux = ${is.linux} |
| is.freebsd = ${is.freebsd} |
| is.macosx = ${is.macosx} |
| is.aix = ${is.aix} |
| is.zos = ${is.zos} |
| is.32bit = ${is.32bit} |
| is.64bit = ${is.64bit} |
| is.x86 = ${is.x86} |
| is.x86_64 = ${is.x86_64} |
| is.ia64 = ${is.ia64} |
| is.ppc32 = ${is.ppc32} |
| is.ppc64 = ${is.ppc64} |
| is.s390 = ${is.s390} |
| is.s390x = ${is.s390x} |
| |
| exe.suffix = ${exe.suffix} |
| shlib.prefix = ${shlib.prefix} |
| shlib.suffix = ${shlib.suffix} |
| make.command = ${make.command} |
| |
| hy.hdk = ${hy.hdk} |
| hy.jdk = ${hy.jdk} |
| hy.jre = ${hy.jre} |
| |
| The following property is only set if the "svn-prop" target has been |
| called: |
| |
| svn.revision = ${svn.revision} |
| |
| |
| The following property is only set if the "svn-info" target has been |
| called: |
| |
| svn.info = ${svn.info} |
| |
| Ant native properties, for information, but please use Harmony |
| properties in preference to these: |
| |
| os.name = ${os.name} |
| os.arch = ${os.arch} |
| |
| </echo> |
| </target> |
| |
| <target name="svn-prop"> |
| <exec executable="svn"> |
| <arg value="--non-interactive" /> |
| <arg value="info" /> |
| <redirector outputproperty="svn.revision"> |
| <outputfilterchain> |
| <linecontains> |
| <contains value="Revision: " /> |
| </linecontains> |
| <tokenfilter> |
| <replacestring from="Revision: " to=""/> |
| </tokenfilter> |
| </outputfilterchain> |
| </redirector> |
| </exec> |
| </target> |
| |
| <target name="svn-info"> |
| <exec executable="svn" |
| failifexecutionfails="false" |
| resultproperty="svn.rc"> |
| <arg value="info" /> |
| <redirector outputproperty="svn.info.tmp"> |
| <outputfilterchain> |
| <linecontainsregexp> |
| <regexp pattern="Repository Root:|Revision:" /> |
| </linecontainsregexp> |
| <tokenfilter> |
| <replacestring from="Repository Root: " to=""/> |
| <replacestring from="Revision: " to=" "/> |
| </tokenfilter> |
| <striplinebreaks/> |
| </outputfilterchain> |
| </redirector> |
| </exec> |
| <condition property="svn.info" value="${svn.info.tmp}" > |
| <equals arg1="${svn.rc}" arg2="0" /> |
| </condition> |
| <tstamp> |
| <format property="svn.info" pattern="'Unknown revision at' dd-MMM-yyyy hh:mm aa"/> |
| </tstamp> |
| </target> |
| |
| <target name="test-jre-vm-info" depends="-get-test-vm-output"> |
| <echo level="info" message="java -version${line.separator}${test.vm.info.tmp}" /> |
| <!-- Add other runtime names here --> |
| <condition property="hy.test.vm.name" value="ri" > |
| <contains string="${test.vm.info.tmp}" substring="HotSpot"/> |
| </condition> |
| <condition property="hy.test.vm.name" value="jr" > |
| <contains string="${test.vm.info.tmp}" substring="JRockit"/> |
| </condition> |
| <!-- FIXME current behavior relies on the fact that J9 VM doesn't |
| support -version parameter --> |
| <condition property="hy.test.vm.name" value="ibm" else="drl" > |
| <contains string="${test.vm.info.tmp}" substring="IBM" casesensitive="false" /> |
| </condition> |
| <echo level="info" message="hy.test.vm.name = ${hy.test.vm.name}" /> |
| </target> |
| |
| <target name="-get-test-vm-output"> |
| <condition property="test.jre.home" value="${hy.jre}"> |
| <not><isset property="test.jre.home" /></not> |
| </condition> |
| <exec executable="${test.jre.home}/bin/java" failifexecutionfails="false"> |
| <arg value="-version" /> |
| <redirector outputproperty="test.vm.info.tmp"/> |
| </exec> |
| </target> |
| |
| <macrodef name="poll-modules" |
| description="directory-based macros for polling sub-builds"> |
| <attribute name="target" /> |
| <attribute name="dir" default="modules" /> |
| <attribute name="includes" default="${build.module}"/> |
| <attribute name="excludes" default="${exclude.module}"/> |
| <attribute name="antfile" default="*.xml"/> |
| <sequential> |
| <!-- convert dirset pattern to fileset pattern--> |
| <property name="@{dir}.loc" location="@{dir}"/> |
| <pathconvert property="list.@{dir}.@{target}" |
| pathsep="${file.separator}@{antfile}," setonempty="no"> |
| <path> |
| <dirset dir="@{dir}" |
| includes="@{includes}" |
| excludes="@{excludes}"> |
| <exclude name=".*" /> |
| </dirset> |
| </path> |
| <map from="${@{dir}.loc}${file.separator}" to=""/> |
| </pathconvert> |
| <!-- append antfile suffix to last item in the list, if any --> |
| <condition property="poll.@{dir}.@{target}" |
| value="${list.@{dir}.@{target}}${file.separator}@{antfile}" |
| else=""> |
| <isset property="list.@{dir}.@{target}"/> |
| </condition> |
| <poll-build target="@{target}" dir="@{dir}" |
| includes="${poll.@{dir}.@{target}}"/> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="poll-build" |
| description="plain-filter macros for polling sub-builds"> |
| <attribute name="target" /> |
| <attribute name="dir" /> |
| <attribute name="includes" default="**/*.xml"/> |
| <attribute name="excludes" default=""/> |
| <sequential> |
| <echo message="polling @{includes}"/> |
| <subant target="@{target}"> |
| <!-- TODO: modules probably need to work these properties |
| out for themselves in order to reduce coupling --> |
| <property name="hy.test.vm.name" value="${hy.test.vm.name}"/> |
| <property name="depends.oss" value="${depends.oss}"/> |
| <fileset dir="@{dir}" includes="@{includes}" excludes="@{excludes}"> |
| <containsregexp expression="<target[^>]*name="@{target}""/> |
| </fileset> |
| </subant> |
| </sequential> |
| </macrodef> |
| |
| <!-- macros for modules --> |
| <!-- TOFIX move to a shared file in the HDK/build/make directory. --> |
| |
| <macrodef name="make"> |
| <attribute name="dir" /> |
| <attribute name="target" default="" /> |
| <element name="make-elements" optional="true" /> |
| <sequential> |
| <echo>Making "@{target}" in @{dir}</echo> |
| <exec failonerror="true" |
| executable="${make.command}" |
| dir="@{dir}"> |
| <env key="HY_ZIP_API" value="${hy.zip.api}" /> |
| <env key="HY_PORTLIB_STUBS" value="${hy.portlib.stubs}" /> |
| <env key="HY_HDK" value="${hy.hdk}" /> |
| <env key="HY_CFG" value="${hy.cfg}" /> |
| <env key="HY_ARCH" value="${hy.arch}" /> |
| <env key="HY_OS" value="${hy.os}" /> |
| <env key="HY_PLATFORM" value="${hy.platform}" /> |
| <env key="HY_NO_THR" value="${hy.no.thr}" /> |
| <env key="HY_THR_NO_DEPLOY" value="${hy.thr.nodeploy}" /> |
| <env key="HY_LOCAL_ZLIB" value="${hy.local.zlib}" /> |
| <env key="HY_SHLIB_SUFFIX" value="${shlib.suffix}" /> |
| <env key="HY_LINKLIB_SUFFIX" value="${linklib.suffix}" /> |
| <arg line="${make.arg}" /> |
| <arg line="@{target}" /> |
| <make-elements /> |
| </exec> |
| </sequential> |
| </macrodef> |
| |
| |
| <!-- To use with -Dtest.case=... option --> |
| <!-- if ${test.case} is provided in package+class form --> |
| <!-- it is converted to dir+filename form --> |
| <macrodef name="convert-test"> |
| <attribute name="from"/> |
| <attribute name="to"/> |
| <sequential> |
| <pathconvert property="@{to}" setonempty="no"> |
| <path path="${@{from}}"/> |
| <chainedmapper> |
| <filtermapper> |
| <replaceregex pattern="\.java$$"/> |
| </filtermapper> |
| <unpackagemapper from="${basedir}${file.separator}*" to="*.java"/> |
| </chainedmapper> |
| </pathconvert> |
| </sequential> |
| </macrodef> |
| <convert-test from="test.case" to="converted.tc" /> |
| |
| <!-- Concatenate several exclude lists into single list --> |
| <macrodef name="prepare-exclude-list"> |
| <attribute name="moduleName"/> |
| <!-- directory with exclude lists for the module --> |
| <attribute name="dir"/> |
| <!-- name of concatenated list, should be an absolute pathname --> |
| <attribute name="result"/> |
| <sequential> |
| <!-- names of exclude lists, used by prepare-exclude-list macro --> |
| <property name="common.exclude.file" value="exclude.common" /> |
| <property name="common.exclude.interm" value="exclude.interm" /> |
| <property name="platform.exclude.file" |
| value="exclude.${hy.platform}.${hy.test.vm.name}" /> |
| <property name="platform.exclude.interm" |
| value="exclude.${hy.platform}.${hy.test.vm.name}.interm" |
| /> |
| |
| <dirname file="@{result}" property="@{result}.dir" /> |
| <mkdir dir="${@{result}.dir}" /> |
| |
| <echo message="" file="@{result}"/> |
| <concat destfile="@{result}" force="yes" fixlastline="yes" append="true"> |
| <fileset dir="@{dir}"> |
| <include name="${common.exclude.file}"/> |
| <include name="${platform.exclude.file}"/> |
| <include name="${common.exclude.interm}" if="exclude.interm" /> |
| <include name="${platform.exclude.interm}" if="exclude.interm" /> |
| <size value="0" when="more"/> |
| </fileset> |
| </concat> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="ensure-javac"> |
| <sequential> |
| <fail> |
| <condition> |
| <and> |
| <equals arg1="${hy.javac.compiler}" arg2="org.eclipse.jdt.core.JDTCompilerAdapter"/> |
| <not> |
| <available classname="${hy.javac.compiler}"/> |
| </not> |
| </and> |
| </condition> |
| The Eclipse compiler class for Ant could not be found. Please place the ECJ JAR in ANT_HOME/lib. |
| The JAR can be downloaded directly from eclipse.org or copied from COMMON_RESOURCES/depends/jars/ecj_3.x folder after the fetch-depends target for JDKTOOLS has been run. |
| Alternatively, you can switch to another compiler, e.g. specify '-Dhy.javac.compiler=modern' for classic javac. |
| </fail> |
| </sequential> |
| </macrodef> |
| |
| <presetdef name="hy.javac"> |
| <javac target="${hy.javac.target}" source="${hy.javac.source}" |
| compiler="${hy.javac.compiler}" |
| debug="${hy.javac.debug}" debuglevel="${hy.javac.debuglevel}"> |
| <compilerarg line="${build.compilerarg}" /> |
| </javac> |
| </presetdef> |
| |
| <macrodef name="compile-tests"> |
| <attribute name="description" default="" /> |
| <attribute name="destdir" default="bin/test" /> |
| <element name="javac-elements" /> |
| <sequential> |
| <echo message="Compiling @{description}" /> |
| |
| <mkdir dir="@{destdir}" /> |
| |
| <javac destdir="@{destdir}" |
| compiler="${hy.javac.compiler}" |
| memoryMaximumSize="${hy.javac.maxmem}" |
| source="${hy.javac.source}" |
| target="${hy.javac.target}" |
| debug="${hy.javac.debug}"> |
| |
| <javac-elements /> |
| |
| <compilerarg line="${build.compilerarg}" /> |
| |
| <bootclasspath> |
| <fileset dir="${hy.jre}/lib/boot"> |
| <include name="**/*.jar" /> |
| </fileset> |
| </bootclasspath> |
| |
| <classpath location="${hy.hdk}/build/test/support.jar" /> |
| <classpath location="../../build/classes" /> |
| </javac> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="run-hdk-tests"> |
| <attribute name="module" /> |
| <attribute name="jar" /> |
| <element name="junit-elements" optional="true"/> |
| <element name="excludeorinclude" optional="true"/> |
| <sequential> |
| <echo message="Running @{module} Unit Test from @{jar}" /> |
| <echo message="Tested jre: ${test.jre.home}/bin/java" /> |
| <property name="test.module.dir" value="${target.dir}/@{module}" /> |
| <property name="test.excludes.dir" value="${test.module.dir}/excludes" /> |
| <property name="test.resources.dir" value="${test.module.dir}/resources" /> |
| <property name="module.work.dir" location="${work.dir}/@{module}" /> |
| <property name="test.exclude.file" value="${module.work.dir}/test.exclude" /> |
| |
| <property name="module.temp.dir" |
| location="${work.dir}/@{module}/temp" /> |
| <property name="junit.tempdir" |
| location="${module.temp.dir}/ant" /> |
| <property name="junit.java.io.tmpdir" |
| location="${module.temp.dir}/tmpdir" /> |
| <property name="junit.user.home" |
| location="${module.temp.dir}/user" /> |
| |
| <mkdir dir="${tests.output}" /> |
| <mkdir dir="${junit.tempdir}" /> |
| <mkdir dir="${junit.java.io.tmpdir}" /> |
| <mkdir dir="${junit.user.home}" /> |
| |
| <prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" /> |
| <junit fork="yes" |
| forkmode="${hy.test.forkmode}" |
| timeout="${hy.test.timeout}" |
| printsummary="withOutAndErr" |
| errorproperty="test.errors" |
| failureproperty="test.failures" |
| showoutput="on" |
| dir="${work.dir}/@{module}" |
| tempdir="${junit.tempdir}" |
| jvm="${test.jre.home}/bin/java"> |
| |
| <jvmarg line="-Djava.io.tmpdir=${junit.java.io.tmpdir}" /> |
| <jvmarg line="-Duser.home=${junit.user.home}" /> |
| |
| <classpath> |
| <fileset dir="${target.dir}"> |
| <include name="*.jar" /> |
| </fileset> |
| <pathelement path="${test.resources.dir}/" /> |
| <pathelement path="${test.module.dir}/" /> |
| <pathelement location="${test.module.dir}/@{jar}" /> |
| </classpath> |
| |
| <junit-elements /> |
| |
| <batchtest todir="${tests.output}" haltonfailure="no"> |
| <zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8"> |
| <exclude name="Test.class" /> |
| <exclude name="**/*$*" /> |
| |
| <!-- if ${test.case} --> |
| <include name="${converted.tc.class}" if="test.case" /> |
| <!-- unless ${test.case} --> |
| <include name="**/*Test.class" unless="test.case" /> |
| <excludesfile name="${test.exclude.file}" unless="test.case"/> |
| <excludeorinclude/> |
| </zipfileset> |
| </batchtest> |
| |
| <assertions enableSystemAssertions="true"> |
| <enable /> |
| </assertions> |
| |
| <jvmarg line="${hy.test.vmargs}" /> |
| <!-- Used by Support_Exec.execJava() --> |
| <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" /> |
| |
| <formatter type="xml" /> |
| </junit> |
| |
| <delete dir="${module.temp.dir}" |
| includeemptydirs="true" failonerror="false" /> |
| |
| <antcall target="touch-failures-file"> |
| <param name="module" value="@{module}" /> |
| </antcall> |
| <antcall target="touch-errors-file"> |
| <param name="module" value="@{module}" /> |
| </antcall> |
| |
| </sequential> |
| </macrodef> |
| |
| <!-- TOFIX: Can't seem to override the line: |
| <include name="**/*Test.class" unless="test.case" /> |
| so this is just run-hdk-tests without that line --> |
| <macrodef name="run-selected-hdk-tests"> |
| <attribute name="module" /> |
| <attribute name="jar" /> |
| <element name="junit-elements" optional="true"/> |
| <element name="excludeorinclude" optional="true"/> |
| <sequential> |
| <echo message="Running @{module} Unit Test from @{jar}" /> |
| <echo message="Tested jre: ${test.jre.home}/bin/java" /> |
| <property name="test.module.dir" value="${target.dir}/@{module}" /> |
| <property name="test.excludes.dir" value="${test.module.dir}/excludes" /> |
| <property name="test.resources.dir" value="${test.module.dir}/resources" /> |
| <property name="test.exclude.file" value="${work.dir}/@{module}/test.exclude" /> |
| |
| <mkdir dir="${tests.output}" /> |
| |
| <prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" /> |
| <junit fork="yes" |
| forkmode="${hy.test.forkmode}" |
| timeout="${hy.test.timeout}" |
| printsummary="withOutAndErr" |
| errorproperty="test.errors" |
| failureproperty="test.failures" |
| showoutput="on" |
| dir="${work.dir}/@{module}" |
| tempdir="${work.dir}" |
| jvm="${test.jre.home}/bin/java"> |
| |
| <classpath> |
| <fileset dir="${target.dir}"> |
| <include name="*.jar" /> |
| </fileset> |
| <pathelement path="${test.resources.dir}/" /> |
| <pathelement path="${test.module.dir}/" /> |
| <pathelement location="${test.module.dir}/@{jar}" /> |
| </classpath> |
| |
| <junit-elements /> |
| |
| <batchtest todir="${tests.output}" haltonfailure="no"> |
| <zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8"> |
| <exclude name="Test.class" /> |
| <exclude name="**/*$*" /> |
| |
| <!-- if ${test.case} --> |
| <include name="${converted.tc.class}" if="test.case" /> |
| <!-- unless ${test.case} --> |
| <excludesfile name="${test.exclude.file}" unless="test.case"/> |
| <excludeorinclude/> |
| </zipfileset> |
| </batchtest> |
| |
| <assertions enableSystemAssertions="true"> |
| <enable /> |
| </assertions> |
| |
| <jvmarg line="${hy.test.vmargs}" /> |
| <!-- Used by Support_Exec.execJava() --> |
| <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" /> |
| |
| <formatter type="xml" /> |
| </junit> |
| |
| <antcall target="touch-failures-file"> |
| <param name="module" value="@{module}" /> |
| </antcall> |
| <antcall target="touch-errors-file"> |
| <param name="module" value="@{module}" /> |
| </antcall> |
| |
| </sequential> |
| </macrodef> |
| |
| <target name="touch-failures-file" if="test.failures"> |
| <echo file="${tests.output}/test.failures" |
| append="true">${module}${line.separator}</echo> |
| </target> |
| |
| <target name="touch-errors-file" if="test.errors"> |
| <echo file="${tests.output}/test.errors" |
| append="true">${module}${line.separator}</echo> |
| </target> |
| |
| <!-- To use with -Dtest.case=... option --> |
| <!-- if ${test.case} is provided in package+class form --> |
| <!-- it is converted to dir+filename form --> |
| <macrodef name="convert-test-as-class"> |
| <attribute name="from" /> |
| <attribute name="to" /> |
| <sequential> |
| <pathconvert property="@{to}" setonempty="no"> |
| <path path="${@{from}}" /> |
| <chainedmapper> |
| <filtermapper> |
| <replaceregex pattern="\.java$$" /> |
| </filtermapper> |
| <unpackagemapper from="${basedir}${file.separator}*" to="*.class" /> |
| </chainedmapper> |
| </pathconvert> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="make-patternset"> |
| <attribute name="source" default="src/main" /> |
| <attribute name="module" /> |
| <attribute name="file" |
| default="${hy.hdk}/build/ant/patternsets/@{module}.txt" /> |
| <sequential> |
| <dirname file="@{file}" property="@{file}.dir" /> |
| <mkdir dir="${@{file}.dir}" /> |
| <property name="@{source}.loc" location="@{source}"/> |
| |
| <pathconvert targetos="unix" property="@{file}.content" |
| pathsep="${line.separator}"> |
| <fileset dir="${@{source}.loc}" includes="java*/**/*.java" /> |
| <map from="${@{source}.loc}/java/unix/" to="" /> |
| <map from="${@{source}.loc}/java/windows/" to="" /> |
| <map from="${@{source}.loc}/java/common/" to="" /> |
| <map from="${@{source}.loc}/java5/" to="" /> |
| <map from="${@{source}.loc}/java/" to="" /> |
| <compositemapper> |
| <mapper type="regexp" from="^(.*)\.java$$" to="\1.*"/> |
| <mapper type="regexp" from="^(.*)\.java$$" to="\1$*.*"/> |
| </compositemapper> |
| </pathconvert> |
| <echo message="${@{file}.content}${line.separator}" |
| file="@{file}" /> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="delete-patternset"> |
| <attribute name="module" /> |
| <sequential> |
| <delete file="${hy.hdk}/build/ant/patternsets/@{module}.txt" /> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="run-findBugs"> |
| <attribute name="outputFile"/> |
| <attribute name="excludeFilter"/> |
| <attribute name="jarFile"/> |
| <sequential> |
| <!-- Find and define findbugs task --> |
| <property name="findbugs.home" location="${basedir}/../../depends/oss/findbugs-1.3.9"/> |
| <available |
| classname="edu.umd.cs.findbugs.anttask.FindBugsTask" |
| classpath="${findbugs.home}/lib/findbugs-ant.jar" |
| property="findbugs.available"/> |
| <taskdef |
| name="findbugs" |
| classname="edu.umd.cs.findbugs.anttask.FindBugsTask" |
| classpath="${findbugs.home}/lib/findbugs-ant.jar" |
| onerror="ignore"/> |
| <fail message="FindBugs is unavailable" unless="findbugs.available"/> |
| |
| <!-- Run findbugs using the attributes given --> |
| <dirname file="@{outputFile}" property="@{outputFile}.dir" /> |
| <mkdir dir="${@{outputFile}.dir}" /> |
| <findbugs home="${findbugs.home}" |
| output="xml" |
| outputFile="@{outputFile}" |
| excludeFilter="@{excludeFilter}" |
| jvmargs="-Xmx512M" |
| workhard="true"> |
| <auxClasspath> |
| <fileset dir="${hy.jdk}/jre/lib/boot"> |
| <include name="**/*.jar" /> |
| </fileset> |
| </auxClasspath> |
| <sourcePath path="src/main/java" /> |
| <sourcePath path="src/main/java/common" /> |
| <sourcePath path="src/main/java/${hy.os.family}" /> |
| <class location="@{jarFile}" /> |
| </findbugs> |
| </sequential> |
| </macrodef> |
| |
| </project> |