2013-12-15 18:30:16 -05:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
|
|
|
|
<project name="athena-project-build" default="deploy">
|
2014-04-05 19:44:14 -04:00
|
|
|
|
2014-04-05 02:48:17 -04:00
|
|
|
<property file="${wpilib.ant.dir}/../so.properties"/>
|
2014-04-05 19:44:14 -04:00
|
|
|
<property name="opkg.name" value="wpilib" />
|
|
|
|
|
<property name="opkg.arch" value="armv7a-vfp" />
|
2014-04-05 02:48:17 -04:00
|
|
|
|
2013-12-15 18:30:16 -05:00
|
|
|
<!-- Load Tasks -->
|
|
|
|
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
|
|
|
|
<classpath>
|
|
|
|
|
<pathelement location="${wpilib.ant.dir}/ant-contrib.jar"/>
|
|
|
|
|
</classpath>
|
|
|
|
|
</taskdef>
|
|
|
|
|
<taskdef resource="net/jtools/classloadertask/antlib.xml" classpath="${classloadertask.jar}"/>
|
|
|
|
|
<classloader loader="system" classpath="${jsch.jar}"/>
|
|
|
|
|
|
|
|
|
|
<target name="clean" description="Clean up all build and distribution artifacts.">
|
|
|
|
|
<delete dir="${build.dir}"/>
|
|
|
|
|
<delete dir="${dist.dir}"/>
|
|
|
|
|
</target>
|
|
|
|
|
|
|
|
|
|
<!-- Targets -->
|
|
|
|
|
|
|
|
|
|
<target name="get-target-ip">
|
|
|
|
|
<math result="ip.upper" operand1="${team-number}" operation="/" operand2="100" datatype="int"/>
|
|
|
|
|
<math result="ip.lower" operand1="${team-number}" operation="%" operand2="100" datatype="int"/>
|
|
|
|
|
<property name="target" value="10.${ip.upper}.${ip.lower}.2" />
|
|
|
|
|
<echo>Target IP: ${target}</echo>
|
|
|
|
|
</target>
|
|
|
|
|
|
|
|
|
|
<target name="deploy" depends="get-target-ip" description="Deploy the progam and start it running.">
|
|
|
|
|
<sshexec host="${target}"
|
2014-05-02 17:54:01 -04:00
|
|
|
username="${username}"
|
|
|
|
|
password="${password}"
|
|
|
|
|
trust="true"
|
|
|
|
|
command="rm ${deploy.dir}/FRCUserProgram" />
|
2013-12-15 18:30:16 -05:00
|
|
|
<echo>[athena-deploy] Copying code over.</echo>
|
2014-05-02 17:54:01 -04:00
|
|
|
<scp file="${out.exe}" sftp="true" todir="${username}@${target}:${deploy.dir}"
|
2013-12-15 18:30:16 -05:00
|
|
|
password="${password}" trust="true"/>
|
2014-04-05 02:48:17 -04:00
|
|
|
<sshexec host="${target}"
|
|
|
|
|
username="${username}"
|
|
|
|
|
password="${password}"
|
|
|
|
|
trust="true"
|
|
|
|
|
command="opkg info wpilib |grep Version | awk '{printf $2}'"
|
|
|
|
|
outputproperty="installedWpilibSo"/>
|
|
|
|
|
<if>
|
|
|
|
|
<equals arg1="${installedWpilibSo}" arg2="${cpp-sos}" />
|
|
|
|
|
<then>
|
2014-04-05 19:44:14 -04:00
|
|
|
|
2014-04-05 02:48:17 -04:00
|
|
|
<echo>Found version of WPILib: ${installedWpilibSo} (latest)</echo>
|
|
|
|
|
</then>
|
|
|
|
|
<else>
|
|
|
|
|
<echo>Found version of WPILib: ${installedWpilibSo}</echo>
|
|
|
|
|
<echo>Upgrading WPILib to ${cpp-sos}...</echo>
|
2014-04-05 19:44:14 -04:00
|
|
|
<delete>
|
|
|
|
|
<fileset dir="${wpilib.ant.dir}">
|
|
|
|
|
<include name="data.tar*" />
|
|
|
|
|
<include name="control*" />
|
|
|
|
|
<include name="post*" />
|
|
|
|
|
<include name="md5sums" />
|
|
|
|
|
<include name="*.deb" />
|
|
|
|
|
</fileset>
|
|
|
|
|
</delete>
|
|
|
|
|
<tar destfile="${wpilib.ant.dir}/data.tar">
|
|
|
|
|
<tarfileset dir="${wpilib.ant.dir}/../lib" username="root" group="admin" uid="0" gid="0"
|
|
|
|
|
prefix="usr/local/frc/lib">
|
|
|
|
|
<include name="libWPILibAthena.so" />
|
|
|
|
|
<include name="libNetworkTables.so" />
|
|
|
|
|
<include name="libHALAthena.so" />
|
|
|
|
|
</tarfileset>
|
|
|
|
|
</tar>
|
|
|
|
|
<gzip destfile="${wpilib.ant.dir}/data.tar.gz" src="${wpilib.ant.dir}/data.tar"/>
|
|
|
|
|
<echo file="${wpilib.ant.dir}/debian-binary">2.0</echo>
|
|
|
|
|
<echo file="${wpilib.ant.dir}/control">Package: ${opkg.name}
|
|
|
|
|
Version: ${cpp-sos}
|
|
|
|
|
Section: devel
|
|
|
|
|
Priority: optional
|
|
|
|
|
Architecture: ${opkg.arch}
|
|
|
|
|
Depends: libc6 (>= 2.11.1-r7), libgcc1 (>= 4.4.1)
|
|
|
|
|
Maintainer: Brad Miller >bamiller@wpi.edu<
|
|
|
|
|
Description: WPILib, NetworkTables and HAL for RoboRIO target
|
|
|
|
|
.
|
|
|
|
|
This package contains the shared objects for WPILib, NetworkTables, and HAL for the 2015 target on the RoboRIO
|
|
|
|
|
</echo>
|
|
|
|
|
<echo file="${wpilib.ant.dir}/postinst">#!/bin/sh
|
|
|
|
|
ldconfig
|
|
|
|
|
</echo>
|
|
|
|
|
<echo file="${wpilib.ant.dir}/postrm">#!/bin/sh
|
|
|
|
|
ldconfig
|
|
|
|
|
</echo>
|
|
|
|
|
<checksum property="md5.wpilib" format="MD5SUM" file="${wpilib.ant.dir}/../lib/libWPILibAthena.so" />
|
|
|
|
|
<checksum property="md5.nwt" format="MD5SUM" file="${wpilib.ant.dir}/../lib/libNetworkTables.so" />
|
|
|
|
|
<checksum property="md5.hal" format="MD5SUM" file="${wpilib.ant.dir}/../lib/libHALAthena.so" />
|
|
|
|
|
<echo file="${wpilib.ant.dir}/md5sums">${md5.wpilib} usr/local/frc/lib/libWPILibAthena.so
|
|
|
|
|
${md5.nwt} usr/local/frc/lib/libNetworkTables.so
|
|
|
|
|
${md5.hal} usr/local/frc/lib/libHALAthena.so</echo>
|
|
|
|
|
<tar destfile="${wpilib.ant.dir}/control.tar">
|
|
|
|
|
<tarfileset dir="${wpilib.ant.dir}" username="root" group="admin" uid="0" gid="0"
|
|
|
|
|
prefix="">
|
|
|
|
|
<include name="control" />
|
|
|
|
|
<include name="md5sums" />
|
|
|
|
|
</tarfileset>
|
|
|
|
|
<tarfileset dir="${wpilib.ant.dir}" filemode="755" username="root" group="admin" uid="0" gid="0"
|
|
|
|
|
prefix="">
|
|
|
|
|
<include name="postinst" />
|
|
|
|
|
<include name="postrm" />
|
|
|
|
|
</tarfileset>
|
|
|
|
|
</tar>
|
|
|
|
|
<gzip destfile="${wpilib.ant.dir}/control.tar.gz" src="${wpilib.ant.dir}/control.tar"/>
|
2014-04-20 18:43:26 -04:00
|
|
|
<exec command="${wpilib.ant.dir}\..\..\..\toolchains\arm-none-linux-gnueabi-4.4.1\bin\arm-none-linux-gnueabi-ar -r ${opkg.name}_${cpp-sos}_${opkg.arch}.deb debian-binary control.tar.gz data.tar.gz" dir="${wpilib.ant.dir}"/>
|
2014-04-05 19:44:14 -04:00
|
|
|
<scp file="${wpilib.ant.dir}/${opkg.name}_${cpp-sos}_${opkg.arch}.deb" todir="${username}@${target}:/tmp"
|
2014-04-05 02:48:17 -04:00
|
|
|
password="${password}" trust="true"/>
|
|
|
|
|
<sshexec host="${target}"
|
|
|
|
|
username="${username}"
|
|
|
|
|
password="${password}"
|
|
|
|
|
trust="true"
|
2014-04-05 19:44:14 -04:00
|
|
|
command="opkg install /tmp/${opkg.name}_${cpp-sos}_${opkg.arch}.deb; sh -c 'rm -rf /tmp/wpilib*.deb'"/>
|
2014-04-05 02:48:17 -04:00
|
|
|
</else>
|
|
|
|
|
</if>
|
2013-12-15 18:30:16 -05:00
|
|
|
<echo>[athena-deploy] Starting program.</echo>
|
|
|
|
|
<sshexec host="${target}"
|
|
|
|
|
username="${username}"
|
|
|
|
|
password="${password}"
|
|
|
|
|
trust="true"
|
2014-05-02 17:54:01 -04:00
|
|
|
command="chmod +x ${deploy.dir}/FRCUserProgram; ${deploy.dir}/FRCUserProgram"/>
|
2013-12-15 18:30:16 -05:00
|
|
|
</target>
|
|
|
|
|
|
|
|
|
|
<target name="debug-deploy" depends="get-target-ip" description="Deploy the jar and start the program running in debug mode.">
|
|
|
|
|
<echo>[athena-deploy] Killing running program</echo>
|
|
|
|
|
<sshexec host="${target}"
|
|
|
|
|
username="${username}"
|
|
|
|
|
password="${password}"
|
|
|
|
|
trust="true"
|
|
|
|
|
command="killall FRCUserProgram; sleep 1"/>
|
|
|
|
|
<echo>[athena-debug-deploy] Copying code over.</echo>
|
|
|
|
|
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}"
|
|
|
|
|
password="${password}" trust="true"/>
|
|
|
|
|
<scp file="${wpilib.ant.dir}/debugcppprogram" todir="${username}@${target}:${deploy.dir}"
|
|
|
|
|
password="${password}" trust="true"/>
|
|
|
|
|
<scp file="${wpilib.ant.dir}/debugjavaprogram" todir="${username}@${target}:${deploy.dir}"
|
|
|
|
|
password="${password}" trust="true"/>
|
|
|
|
|
<echo>[athena-debug-deploy] Starting program.</echo>
|
|
|
|
|
<sshexec host="${target}"
|
|
|
|
|
username="${username}"
|
|
|
|
|
password="${password}"
|
|
|
|
|
trust="true"
|
|
|
|
|
command="chmod a+x debug*program; ${deploy.debug.command}"/>
|
|
|
|
|
</target>
|
|
|
|
|
</project>
|