blob: 4e45554402f21a558ca51bb70b8c6a03897d982a [file] [log] [blame]
<?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-helloworld-example-csharp" basedir="." default="build">
<description>HelloWorld Example CSharp</description>
<property name="etch.home" location="${basedir}/../../.."/>
<property name="etch.version" value="@EtchVersion@"/>
<property name="etch.longversion" value="@EtchLongVersion@"/>
<property name="etch-csharp-runtime-name" value="ApacheEtchCsharp.dll"/>
<property name="etch-ant-plugin.jar" location="${etch.home}/lib/apache-etch-ant-plugin-${etch.longversion}.jar"/>
<property name="etch-csharp-runtime.dll" location="${etch.home}/binding-csharp/lib/${etch-csharp-runtime-name}"/>
<property name="src" location="${basedir}/csharp/src"/>
<property name="example-base" location="${basedir}/.." />
<property name="src-main-etch" location="${example-base}/etch"/>
<property name="src-main-csharp" location="${src}/main"/>
<property name="target" location="${basedir}/target"/>
<property name="generated-sources" location="${target}/generated-sources"/>
<property name="gensrc-main-etch-csharp" location="${generated-sources}/csharp"/>
<property name="classes" location="${target}/classes"/>
<property name="bin" location="${target}/bin"/>
<condition property="BUILD.csharp" >
<os family="windows" />
</condition>
<taskdef
resource="org/apache/etch/tools/ant/etch.xml"
classpath="${etch-ant-plugin.jar}"/>
<taskdef resource="org/apache/ant/dotnet/antlib.xml" classpath="${etch.home}/lib/ant-dotnet-1.1.jar" />
<target name="build" depends="build-csharp, done"/>
<target name="done">
<echo>
Build CSharp Complete!
======================
To run csharp example:
> cd csharp\target\bin
> start helloworldListener.exe
> start helloworldClient.exe
You can mix and match the various clients and listeners.
</echo>
</target>
<target name="build-csharp" depends="gensrc-csharp" if="BUILD.csharp" >
<csc
debug="true"
warnLevel="1"
unsafe="false"
targetType="exe"
incremental="false"
mainClass = "org.apache.etch.examples.helloworld.MainHelloWorldClient"
destFile="${bin}/HelloWorldClient.exe">
<src dir="${src-main-csharp}/HelloWorldClientProj" includes="**/*.cs"/>
<src dir="${src-main-csharp}/etch.examples.helloworld" includes="**/*.cs"/>
<src dir="${gensrc-main-etch-csharp}" includes="**/*.cs"/>
<reference file="${etch-csharp-runtime.dll}"/>
</csc>
<csc
debug="true"
warnLevel="1"
unsafe="false"
targetType="exe"
incremental="false"
mainClass = "org.apache.etch.examples.helloworld.MainHelloWorldListener"
destFile="${bin}/HelloWorldListener.exe">
<src dir="${src-main-csharp}/HelloWorldListenerProj" includes="**/*.cs"/>
<src dir="${src-main-csharp}/etch.examples.helloworld" includes="**/*.cs"/>
<src dir="${gensrc-main-etch-csharp}" includes="**/*.cs"/>
<reference file="${etch-csharp-runtime.dll}"/>
</csc>
<copy todir="${bin}" file="${etch-csharp-runtime.dll}"/>
</target>
<target name="gensrc" depends="gensrc-csharp"/>
<target name="gensrc-csharp" depends="init">
<echo>Generating CSharp Sources...</echo>
<etch
home="${etch.home}"
binding="csharp"
quiet="true"
outputDir="${gensrc-main-etch-csharp}"
file="${src-main-etch}/HelloWorld.etch"/>
</target>
<target name="init">
<mkdir dir="${target}"/>
<mkdir dir="${generated-sources}"/>
<mkdir dir="${gensrc-main-etch-csharp}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${bin}"/>
</target>
<target name="clean">
<delete dir="${target}"/>
</target>
</project>