You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
product-iots/modules/samples/raspberrypi/build.xml

60 lines
2.5 KiB

<project name="Arduino" basedir="" default="deploy">
<import file="../common.xml"/>
<property name="sample_type" value="raspberrypi"/>
<property name="data_source" value="RaspberrypiDM_DB"/>
<property name="package" value="org.wso2.carbon.device.mgt.iot.sample.raspberrypi"/>
<target name="create-db" depends="clean">
<mkdir dir="${db.dir}"/>
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/${data_source};DB_CLOSE_ON_EXIT=FALSE"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${db.username}" password="${db.password}" autocommit="true" onerror="continue">
<classpath>
<pathelement location="${lib.dir}/h2-database-engine_1.2.140.wso2v3.jar"/>
</classpath>
<fileset file="dbscripts/${db.type}_${sample_type}.sql"/>
</sql>
<copy file="${db.dir}/${data_source}.h2.db" toDir="${target.db.dir}" overwrite="yes"/>
<xmltask source="${iot.conf}" dest="${iot.conf}" report="true">
<insert path="/IoTDeviceTypeConfigManager[1]">
<![CDATA[
<IotDeviceTypeConfig type="${sample_type}">
<DatasourceName>jdbc/${data_source}</DatasourceName>
</IotDeviceTypeConfig>
]]>
</insert>
</xmltask>
</target>
<target name="build">
<exec dir="src" executable="sh">
<arg line="-c 'mvn clean install'" />
</exec>
</target>
<target name="deploy" depends="create-db,build">
<copy toDir="${target.sketch.dir}/${sample_type}">
<fileset dir="sketch"/>
</copy>
<copy file="src/${package}.service.impl/target/${sample_type}.war" toDir="${target.webapp.dir}" overwrite="yes"/>
<copy file="src/${package}.plugin.impl/target/${package}.plugin.impl-${target.version}.jar" toDir="${target.dropins.dir}" overwrite="yes"/>
<copy file="page/${sample_type}.hbs" toDir="${target.page.dir}" overwrite="yes"/>
<copy toDir="${target.unit.dir}/${sample_type}">
<fileset dir="units"/>
</copy>
</target>
<target name="clean">
<delete file="${target.db.dir}/${data_source}.h2.db"/>
<delete dir="${target.sketch.dir}/${sample_type}"/>
<delete file="${target.page.dir}/${sample_type}.hbs"/>
<delete dir="${target.unit.dir}/${sample_type}"/>
<xmltask source="${iot.conf}" dest="${iot.conf}" report="true">
<remove path="/IoTDeviceTypeConfigManager/IotDeviceTypeConfig[type='${sample_type}']"/>
</xmltask>
</target>
</project>