| <?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="etch-tests" basedir="." default="help"> |
| <description>Functional Tests</description> |
| <property name="Etch.basedir" location="${basedir}/.." /> |
| <import file="${Etch.basedir}/build-support/etch.includes.xml" /> |
| <target name="help"><echo>Please select a target...</echo></target> |
| |
| <!-- import etch task --> |
| <taskdef |
| onerror="report" |
| resource="org/apache/etch/tools/ant/etch.xml" |
| classpath="${Etch.HOME}/lib/${etch-ant-task.jar}" /> |
| |
| <!-- set properties --> |
| <property name="target" location="${basedir}/target" /> |
| <property name="src" location="${basedir}/src" /> |
| <property name="bin" location="${target}/bin" /> |
| <property name="generated-sources" location="${target}/generated-sources/" /> |
| <property name="classes" location="${target}/classes" /> |
| <property name="test-results" location="${target}/test-results" /> |
| <property name="nunit-results" location="${target}/nunit-results" /> |
| |
| <!-- macros --> |
| <macrodef name="etch-test"> |
| <attribute name="home" default="${Etch.HOME}" /> |
| <attribute name="binding" /> |
| <attribute name="file" /> |
| <attribute name="what" default="both, intf" /> |
| <attribute name="outputDir" default="${generated-sources}/main/etch/@{binding}" /> |
| <attribute name="templateOutputDir" default="${src}/main/@{binding}" /> |
| <element name="etchelements" implicit="true" optional="true" /> |
| <sequential> |
| <etch home="@{home}" binding="@{binding}" outputDir="@{outputDir}" what="@{what}" file="@{file}" > |
| <etchelements /> |
| </etch> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="generate-sources"> |
| <attribute name="binding" /> |
| <sequential> |
| |
| <!-- generate sources --> |
| <mkdir dir="${generated-sources}/main/etch/@{binding}" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Async.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Bar.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Baz.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/BigIdl.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Closing.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Cuae.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Foo.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Inheritance.etch" /> |
| <etch-test binding="@{binding}" what="all,force" file="${src}/main/etch/Test1.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Test2.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Test3.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Test4.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Test6.etch" /> |
| <etch-test binding="@{binding}" what="all,force" file="${src}/main/etch/TestIncludes.etch" /> |
| <etch-test binding="@{binding}" file="${src}/main/etch/Types.etch" /> |
| |
| <!-- negative tests --> |
| <!-- <etch-test binding="@{binding}" file="${src}/main/etch/Test5.etch" /> --> |
| <!-- <etch-test binding="@{binding}" file="${src}/main/etch/TestReservedWords.etch" /> --> |
| |
| </sequential> |
| </macrodef> |
| |
| <!-- initialize --> |
| <target name="init" > |
| <mkdir dir="${target}" /> |
| <mkdir dir="${bin}" /> |
| <mkdir dir="${generated-sources}" /> |
| <mkdir dir="${classes}" /> |
| <mkdir dir="${test-results}" /> |
| <mkdir dir="${nunit-results}" /> |
| </target> |
| |
| <!-- ############ --> |
| <!-- binding-java --> |
| <!-- ############ --> |
| <target name="build-java-if" depends="build-java-then, build-java-else" > |
| </target> |
| <target name="build-java-then" depends="build-java" if="is-binding-java-available" > |
| <echo message="binding-java available" /> |
| </target> |
| <target name="build-java-else" unless="is-binding-java-available" > |
| <echo message="No binding-java available" /> |
| </target> |
| |
| <target name="test-java-if" depends="test-java-then, test-java-else" > |
| </target> |
| <target name="test-java-then" depends="test-java" if="is-binding-java-available" > |
| <echo message="binding-java available" /> |
| </target> |
| <target name="test-java-else" unless="is-binding-java-available" > |
| <echo message="No binding-java available" /> |
| </target> |
| |
| <!-- binding-java build --> |
| <target name="generate-java" if="is-binding-java-available"> |
| <generate-sources binding="java" /> |
| </target> |
| |
| <!-- binding-java clover --> |
| <target name="init-java-sources-for-clover" depends="init-java-sources-for-clover-if, init-java-sources-for-clover-then"> |
| </target> |
| <target name="init-java-sources-for-clover-if" > |
| <condition property="do-init-java-sources-for-clover"> |
| <and> |
| <isset property="is-binding-java-available" /> |
| <isset property="Clover.enabled" /> |
| </and> |
| </condition> |
| </target> |
| <target name="init-java-sources-for-clover-then" if="do-init-java-sources-for-clover"> |
| <initialize-clover suffix="etchtests" > |
| <fileset dir="${src}/main/java" > |
| <include name="**/*.java" /> |
| </fileset> |
| <fileset dir="${generated-sources}/main/etch/java" > |
| <include name="**/*.java" /> |
| <exclude name="**/*BigIdl*.java" /> |
| </fileset> |
| <testsources dir="${src}/test/java" > |
| <include name="**/*.java" /> |
| </testsources> |
| </initialize-clover> |
| </target> |
| |
| <target name="build-java" depends="generate-java, init-java-sources-for-clover" if="is-binding-java-available" > |
| <!-- compile sources --> |
| <mkdir dir="${classes}" /> |
| <javac target="1.5" destdir="${classes}"> |
| <src path="${generated-sources}/main/etch/java" /> |
| <src path="${src}/main/java" /> |
| <src path="${src}/test/java" /> |
| <classpath> |
| <pathelement location="${Etch.HOME}/binding-java/lib/${etch-java-runtime.jar}" /> |
| <pathelement location="${Etch.dependency.junit.jar}" /> |
| <pathelement location="${Etch.HOME}/lib/${etch-compiler.jar}" /> |
| </classpath> |
| </javac> |
| </target> |
| |
| <target name="test-java" depends="build-java" if="is-binding-java-available" > |
| <!-- Run Unit Tests --> |
| <junit printsummary="yes" haltonfailure="no" dir="${classes}" |
| errorProperty="build.tests.fail" failureProperty="build.tests.fail"> |
| <classpath> |
| <pathelement location="${classes}" /> |
| <pathelement location="${Etch.HOME}/binding-java/lib/${etch-java-runtime.jar}" /> |
| <pathelement location="${Etch.dependency.junit.jar}" /> |
| <pathelement location="${Etch.HOME}/lib/${etch-compiler.jar}" /> |
| <!-- TODO: remove if clover not available --> |
| <pathelement location="${Etch.dependency.clover.jar}"/> |
| </classpath> |
| <formatter type="xml"/> |
| <batchtest fork="true" todir="${test-results}"> |
| <fileset dir="${src}/test/java"> |
| <include name="**/Test*.java" /> |
| <!-- TODO debug Test*Xml failures --> |
| <exclude name="**/Test*Xml.java" /> |
| </fileset> |
| </batchtest> |
| </junit> |
| </target> |
| |
| <!-- ############# --> |
| <!-- binding-charp --> |
| <!-- ############# --> |
| <target name="generate-csharp" if="is-binding-csharp-available" > |
| <generate-sources binding="csharp" /> |
| </target> |
| |
| <target name="build-csharp-if" depends="build-csharp-then, build-csharp-else" > |
| </target> |
| <target name="build-csharp-then" depends="build-csharp" if="is-binding-csharp-available" > |
| <echo message="binding-csharp available" /> |
| </target> |
| <target name="build-csharp-else" unless="is-binding-csharp-available" > |
| <echo message="No binding-csharp available" /> |
| </target> |
| |
| <target name="test-csharp-if" depends="test-csharp-then, test-csharp-else" > |
| </target> |
| <target name="test-csharp-then" depends="test-csharp" if="is-binding-csharp-available" > |
| <echo message="binding-csharp available" /> |
| </target> |
| <target name="test-csharp-else" unless="is-binding-csharp-available" > |
| <echo message="No binding-csharp available" /> |
| </target> |
| |
| <!-- binding-charp build--> |
| <target name="build-csharp" depends="generate-csharp, build-tests-csharp-dotnet,build-tests-csharp-mono" /> |
| |
| <target name="build-tests-csharp-dotnet" depends="build-tests-csharp-dotnet-if, build-tests-csharp-dotnet-then"> |
| </target> |
| <target name="build-tests-csharp-dotnet-if"> |
| <condition property="do-build-tests-csharp-dotnet" > |
| <and> |
| <isset property="is-binding-csharp-available" /> |
| <isset property="USE.dotnet" /> |
| </and> |
| </condition> |
| </target> |
| <target name="build-tests-csharp-dotnet-then" if="do-build-tests-csharp-dotnet" > |
| <msbuild buildfile="${src}/test/csharp/TestsProj/TestsProj.csproj"> |
| <property name="Configuration" value="${Etch.build.target}" /> |
| </msbuild> |
| </target> |
| |
| <target name="build-tests-csharp-mono" depends="build-tests-csharp-mono-if, build-tests-csharp-mono-then"> |
| </target> |
| <target name="build-tests-csharp-mono-if"> |
| <condition property="do-build-tests-csharp-mono" > |
| <and> |
| <isset property="is-binding-csharp-available" /> |
| <isset property="USE.mono" /> |
| </and> |
| </condition> |
| </target> |
| <target name="build-tests-csharp-mono-then" if="do-build-tests-csharp-mono" > |
| <echo message="TODO: build w/ mono" /> |
| </target> |
| |
| <target name="test-csharp" depends="build-csharp" if="is-binding-csharp-available" > |
| <mkdir dir="${nunit-results}" /> |
| |
| <nunit xmlout="${nunit-results}/NUnitResults.xml"> |
| <testassembly name="${src}/test/csharp/TestsProj/bin/${Etch.build.target}/Tests.dll" /> |
| </nunit> |
| |
| <xslt style="${Etch.buildSupportDirectory}/NUnitToJUnit.xsl" |
| in="${nunit-results}/NUnitResults.xml" out="${test-results}/TEST-NUnitResults.xml" /> |
| </target> |
| |
| <!-- ########### --> |
| <!-- binding-xml --> |
| <!-- ########### --> |
| <target name="generate-xml" if="is-binding-xml-available" > |
| <generate-sources binding="xml" /> |
| </target> |
| |
| <target name="build-xml-if" depends="build-xml-then, build-xml-else" > |
| </target> |
| <target name="build-xml-then" depends="build-xml" if="is-binding-xml-available" > |
| <echo message="binding-xml available" /> |
| </target> |
| <target name="build-xml-else" unless="is-binding-xml-available" > |
| <echo message="No binding-xml available" /> |
| </target> |
| |
| <target name="test-xml-if" depends="test-xml-then, test-xml-else" > |
| </target> |
| <target name="test-xml-then" depends="test-xml" if="is-binding-xml-available" > |
| <echo message="binding-xml available" /> |
| </target> |
| <target name="test-xml-else" unless="is-binding-xml-available" > |
| <echo message="No binding-xml available" /> |
| </target> |
| |
| <!-- binding-xml build --> |
| <target name="build-xml" depends="generate-xml" if="is-binding-xml-available" > |
| </target> |
| |
| <target name="test-xml" depends="build-xml" if="is-binding-xml-available" > |
| </target> |
| |
| <!-- ########### --> |
| <!-- general --> |
| <!-- ########### --> |
| <!-- build sources --> |
| <target name="build" depends="init, build-java-if, build-csharp-if, build-xml-if" /> |
| |
| <!-- run unit tests --> |
| <target name="test" depends="build, test-java-if, test-csharp-if, test-xml-if" /> |
| |
| <!-- clean --> |
| <target name="clean"> |
| <delete dir="${target}" quiet="true" /> |
| <delete dir="${src}/test/csharp/TestsProj/obj" /> |
| <delete dir="${src}/test/csharp/TestsProj/bin" /> |
| </target> |
| |
| </project> |