123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <!--****************************************************************************
- Copyright (c) 2012, 2020 IBM Corp.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v2.0
- and Eclipse Distribution License v1.0 which accompany this distribution.
- The Eclipse Public License is available at
- https://www.eclipse.org/legal/epl-2.0/
- and the Eclipse Distribution License is available at
- http://www.eclipse.org/org/documents/edl-v10.php.
- Contributors:
- Ian Craggs - initial API and implementation and/or initial documentation
- *******************************************************************************-->
- <project name="MQTT C Client" default="full">
- <taskdef resource="net/sf/antcontrib/antlib.xml">
- <classpath>
- <pathelement location="/opt/public/cbi/build/3rdPartyJars/ant-contrib.jar" />
- <pathelement location="/usr/share/java/ant-contrib.jar" />
- </classpath>
- </taskdef>
- <property name="output.folder" value="build/output" />
- <loadfile property="version.major" srcFile="version.major"/>
- <loadfile property="version.minor" srcFile="version.minor"/>
- <loadfile property="version.patch" srcFile="version.patch"/>
- <property name="release.version" value="${version.major}.${version.minor}.${version.patch}" />
- <property name="libname" value="mqttv3c" />
- <property name="libname.ssl" value="mqttv3cs" />
- <property name="libname.async" value="mqttv3a" />
- <property name="libname.async.ssl" value="mqttv3as" />
- <property name="ssl" value="yes" />
- <property name="windows.openssl.folder" value="c:\openssl\bin" />
- <property name="test.hostname" value="iot.eclipse.org"/>
- <property name="test.port" value="1883"/>
- <property name="proxy.port" value="18883"/>
- <if>
- <os family="windows"/>
- <then>
- <property name="os.family" value="windows" />
- </then>
- <else>
- <if>
- <os family="mac"/>
- <then>
- <property name="os.family" value="mac" />
- </then>
- <else>
- <property name="os.family" value="unix" />
- </else>
- </if>
- </else>
- </if>
- <echo message="os.family is '${os.family}'" />
- <target name="init">
- <tstamp>
- <format property="buildTimestamp" pattern="yyyyMMddHHmm" />
- </tstamp>
- <fileset id="sync.source.fileset" dir="src">
- <include name="*.c"/>
- <exclude name="MQTTAsync.c"/>
- <exclude name="MQTTVersion.c"/>
- </fileset>
- <pathconvert refid="sync.source.fileset" property="sync.source.files" pathsep=" "/>
- <fileset id="async.source.fileset" dir="src">
- <include name="*.c"/>
- <exclude name="MQTTClient.c"/>
- <exclude name="MQTTVersion.c"/>
- </fileset>
- <pathconvert refid="async.source.fileset" property="async.source.files" pathsep=" "/>
- </target>
- <target name="version" depends="init" description="replace tags with the right levels">
- <property name="build.level" value="${DSTAMP}${TSTAMP}" />
- <copy file="src/VersionInfo.h.in" tofile="src/VersionInfo.h" overwrite="true"/>
- <replace file="src/VersionInfo.h" token="@BUILD_TIMESTAMP@" value="${build.level}" />
- <replace file="src/VersionInfo.h" token="@CLIENT_VERSION@" value="${release.version}" />
- </target>
- <target name="test" >
- <!-- display Python version -->
- <exec executable="python" failonerror="true">
- <arg line="-V"/>
- </exec>
- <exec executable="python" dir="test" spawn="true">
- <arg value="mqttsas2.py" />
- <arg value="${test.hostname}" />
- <arg value="${test.port}" />
- <arg value="${proxy.port}" />
- </exec>
- <if>
- <os family="windows"/>
- <then>
- <foreach target="runAtest" param="aTest" list="test1,test2,test4,test9"/>
- </then>
- <else>
- <foreach target="runAtest" param="aTest" list="test1,test2,test4,test9"/>
- </else>
- </if>
- <foreach target="runSSLtest" param="aTest" list="test3,test5"/>
- </target>
- <target name="runAtest">
- <if>
- <os family="windows"/>
- <then>
- <exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" >
- <arg value="/c" />
- <arg value="${aTest}.exe" />
- <arg value="--connection" />
- <arg value="tcp://${test.hostname}:${test.port}" />
- <arg value="--proxy_connection" />
- <arg value="tcp://localhost:${proxy.port}" />
- <env key="PATH" path="${output.folder}" />
- </exec>
- </then>
- <else>
- <exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" >
- <arg value="--connection" />
- <arg value="tcp://${test.hostname}:${test.port}" />
- <arg value="--proxy_connection" />
- <arg value="tcp://localhost:${proxy.port}" />
- <env key="LD_LIBRARY_PATH" path="${output.folder}" />
- <env key="DYLD_LIBRARY_PATH" path="${output.folder}" />
- </exec>
- </else>
- </if>
- </target>
- <target name="runSSLtest">
- <if>
- <os family="windows"/>
- <then>
- <exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" >
- <arg value="/c" />
- <arg value="${aTest}.exe" />
- <arg value="--hostname" />
- <arg value="${test.hostname}" />
- <env key="PATH" path="${output.folder};${windows.openssl.folder}" />
- </exec>
- </then>
- <else>
- <exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" >
- <arg value="--hostname" />
- <arg value="${test.hostname}" />
- <env key="LD_LIBRARY_PATH" path="${output.folder}" />
- <env key="DYLD_LIBRARY_PATH" path="${output.folder}" />
- </exec>
- </else>
- </if>
- </target>
- <target name="doc" >
- <if>
- <available file="/usr/bin/doxygen"/>
- <then>
- <mkdir dir="${output.folder}/doc"/>
- <exec executable="doxygen" dir="src">
- <arg value="../doc/DoxyfileV3ClientAPI"/>
- </exec>
- <exec executable="doxygen" dir="src">
- <arg value="../doc/DoxyfileV3AsyncAPI"/>
- </exec>
- <zip destfile="${output.folder}/MQTTClient_doc.zip">
- <zipfileset dir="${output.folder}/doc/MQTTClient" />
- </zip>
- <zip destfile="${output.folder}/MQTTAsync_doc.zip">
- <zipfileset dir="${output.folder}/doc/MQTTAsync" prefix="MQTTAsync/"/>
- </zip>
- <delete dir="${output.folder}/doc" />
- </then>
- <else>
- <echo message="doxygen is not available" />
- </else>
- </if>
- </target>
- <target name="build" >
- <if>
- <os family="unix"/>
- <then>
- <delete dir="${output.folder}" />
- <!-- display gcc version -->
- <exec executable="gcc" failonerror="true">
- <arg line="-v"/>
- </exec>
- <if>
- <available file="/usr/bin/make"/>
- <then>
- <exec executable="make" dir="."/>
- </then>
- </if>
- </then>
- </if>
- <if>
- <os family="windows"/>
- <then>
- <delete dir="${output.folder}" />
- <!-- display gcc version -->
- <exec executable="cl" failonerror="true">
- </exec>
- <exec executable="msbuild" dir=".">
- <arg line='"Windows Build\Paho C MQTT APIs.sln"'/>
- <arg line="/p:Configuration=Release"/>
- </exec>
- </then>
- </if>
- </target>
- <target name="package">
- <mkdir dir="${output.folder}/include"/>
- <copy overwrite="true" todir="${output.folder}/include">
- <fileset dir="src" includes="MQTTClient.h,MQTTAsync.h,MQTTClientPersistence.h"/>
- </copy>
- <copy overwrite="true" todir="${output.folder}">
- <fileset dir="." includes="README.md,CONTRIBUTING.md,about.html,notice.html,edl-v10,epl-v20"/>
- </copy>
- <mkdir dir="${output.folder}/lib"/>
- <move overwrite="true" todir="${output.folder}/lib">
- <fileset dir="${output.folder}" includes="*paho*"/>
- </move>
- <mkdir dir="${output.folder}/bin"/>
- <move overwrite="true" todir="${output.folder}/bin">
- <fileset dir="${output.folder}/samples" includes="*"/>
- <fileset dir="${output.folder}" includes="MQTTVersion"/>
- </move>
- <copy overwrite="true" todir="${output.folder}/samples">
- <fileset dir="src/samples" includes="*"/>
- </copy>
- <delete>
- <fileset dir="." includes="eclipse-paho-mqtt-c-windows-${release.version}.zip"/>
- <fileset dir="." includes="eclipse-paho-mqtt-c-${os.family}-${release.version}.tar.gz"/>
- </delete>
- <if>
- <os family="windows"/>
- <then>
- <exec executable="c:\cygwin\bin\zip.exe" failonerror="true" dir="${output.folder}">
- <arg value="-r"/>
- <arg value="eclipse-paho-mqtt-c-windows-${release.version}.zip"/>
- <arg value="about.html"/>
- <arg value="notice.html"/>
- <arg value="README.md"/>
- <arg value="CONTRIBUTING.md"/>
- <arg value="epl-v20"/>
- <arg value="edl-v10"/>
- <arg value="include"/>
- <arg value="samples"/>
- <arg value="lib"/>
- <arg value="bin"/>
- </exec>
- </then>
- <else>
- <exec executable="tar" failonerror="true" dir="${output.folder}">
- <arg value="czf"/>
- <arg value="eclipse-paho-mqtt-c-${os.family}-${release.version}.tar.gz"/>
- <arg value="about.html"/>
- <arg value="notice.html"/>
- <arg value="README.md"/>
- <arg value="CONTRIBUTING.md"/>
- <arg value="epl-v20"/>
- <arg value="edl-v10"/>
- <arg value="include"/>
- <arg value="samples"/>
- <arg value="lib"/>
- <arg value="bin"/>
- </exec>
- </else>
- </if>
- <if>
- <os family="unix"/>
- <then>
- <exec executable="tar" failonerror="true" dir=".">
- <arg value="czf"/>
- <arg value="${output.folder}/eclipse-paho-mqtt-c-src-${release.version}.tar.gz"/>
- <arg value="about.html"/>
- <arg value="notice.html"/>
- <arg value="README.md"/>
- <arg value="CONTRIBUTING.md"/>
- <arg value="epl-v20"/>
- <arg value="edl-v10"/>
- <arg value="Makefile"/>
- <arg value="build.xml"/>
- <arg value="src"/>
- <arg value="test"/>
- <arg value="Windows Build"/>
- </exec>
- </then>
- </if>
- </target>
- <target name="copy">
- <if>
- <available file="/shared/technology"/>
- <then>
- <mkdir dir="/shared/technology/paho/C/${release.version}/${build.level}"/>
- <echo message="Copying the build output to /shared" />
- <copy overwrite="true" todir="/shared/technology/paho/C/${release.version}/${build.level}">
- <fileset dir="${output.folder}">
- <include name="*.gz"/>
- <include name="*.zip"/>
- </fileset>
- </copy>
- </then>
- </if>
- </target>
- <target name="full" depends="init, version, build, test, doc, package, copy" />
- </project>
|