mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
Moves C++ global build properties to properties file to match Java.
Adds host reachability check and static IP fallback Adds roboRIO Image check Adds JRE check for Java Change-Id: I07f3a0863bde0ebec7e7d8f48270e45758bddba5
This commit is contained in:
@@ -1,20 +1,3 @@
|
||||
# Deployment information
|
||||
username=admin
|
||||
password=
|
||||
deploy.dir=/home/lvuser
|
||||
deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r
|
||||
deploy.log.file=/var/local/natinst/log/FRC_UserProgram.log
|
||||
command.dir=/home/lvuser/
|
||||
|
||||
# Libraries to use
|
||||
wpilib=${user.home}/wpilib/cpp/${cpp-version}
|
||||
wpilib.lib=${wpilib}/lib
|
||||
|
||||
# Ant support
|
||||
wpilib.ant.dir=${wpilib}/ant
|
||||
jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar
|
||||
classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar
|
||||
|
||||
# Build information
|
||||
out=FRCUserProgram
|
||||
src.dir=src
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
<property file="${user.home}/wpilib/wpilib.properties"/>
|
||||
<property file="build.properties"/>
|
||||
<property file="${user.home}/wpilib/cpp/${version}/ant/build.properties"/>
|
||||
|
||||
<import file="${wpilib.ant.dir}/build.xml"/>
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Deployment information
|
||||
username=admin
|
||||
password=
|
||||
deploy.dir=/home/lvuser
|
||||
deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r
|
||||
deploy.log.file=/var/local/natinst/log/FRC_UserProgram.log
|
||||
command.dir=/home/lvuser/
|
||||
|
||||
# Libraries to use
|
||||
wpilib=${user.home}/wpilib/cpp/${cpp-version}
|
||||
wpilib.lib=${wpilib}/lib
|
||||
roboRIOAllowedImages=18
|
||||
|
||||
# Ant support
|
||||
wpilib.ant.dir=${wpilib}/ant
|
||||
jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar
|
||||
classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar
|
||||
@@ -20,10 +20,25 @@
|
||||
|
||||
<target name="get-target-ip">
|
||||
<property name="target" value="roboRIO-${team-number}.local" />
|
||||
<echo>Target: ${target}</echo>
|
||||
<echo>Trying Target: ${target}</echo>
|
||||
<if>
|
||||
<isreachable host="${target}"/>
|
||||
<then>
|
||||
<echo>roboRIO found via mDNS</echo>
|
||||
</then>
|
||||
<else>
|
||||
<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>roboRIO not found via mDNS, falling back to static address of ${target}</echo>
|
||||
<assert name="roboRIOFound" message="roboRIO not found, please check that the roboRIO is connected, imaged and that the team number is set properly in Eclipse">
|
||||
<isreachable host="${target}"/>
|
||||
</assert>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="deploy" depends="get-target-ip" description="Deploy the progam and start it running.">
|
||||
<target name="deploy" depends="get-target-ip, dependencies" description="Deploy the progam and start it running.">
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
@@ -57,28 +72,6 @@
|
||||
command="/usr/local/frc/bin/frcKillRobot.sh"/>
|
||||
</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>
|
||||
|
||||
<!-- Simulation support -->
|
||||
<target name="simulate">
|
||||
<parallel>
|
||||
@@ -102,4 +95,20 @@
|
||||
</sequential>
|
||||
</parallel>
|
||||
</target>
|
||||
|
||||
<target name="dependencies" depends="get-target-ip">
|
||||
<property name="ant.enable.asserts" value="true"/>
|
||||
<post to="http://${target}/nisysapi/server" logfile="sysProps.xml" verbose="false" encoding="UTF-16LE">
|
||||
<prop name="Function" value="GetPropertiesOfItem"/>
|
||||
<prop name="Plugins" value="nisyscfg"/>
|
||||
<prop name="Items" value="system"/>
|
||||
</post>
|
||||
<loadfile srcFile="sysProps.xml" encoding="UTF-16LE" property="roboRIOSysValues"/>
|
||||
<propertyregex property="roboRIOImage" input="${roboRIOSysValues}" regexp="FRC_roboRIO_2015_v([0-9]+)" select="\1" defaultValue="ImageRegExFail"/>
|
||||
<assert message="roboRIO Image does not match plugin, allowed image version: ${roboRIOAllowedImages}">
|
||||
<bool>
|
||||
<contains string="${roboRIOAllowedImages}" substring="${roboRIOImage}"/>
|
||||
</bool>
|
||||
</assert>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -9,6 +9,7 @@ debug.flag.dir=/tmp/
|
||||
debug.flag.command=chown lvuser:ni ${debug.flag.dir}frcdebug
|
||||
command.dir=/home/lvuser/
|
||||
version=current
|
||||
roboRIOJRE.dir=/usr/local/frc/JRE
|
||||
|
||||
# Libraries to use
|
||||
wpilib=${user.home}/wpilib/java/${version}
|
||||
@@ -21,6 +22,7 @@ networktables.sources=${wpilib.lib}/NetworkTables-sources.jar
|
||||
#jnaerator.jar=${wpilib.lib}/jnaerator-runtime.jar
|
||||
#classpath=${wpilib.jar}:${networktables.jar}:${jna.jar}:${jnaerator.jar}
|
||||
classpath=${wpilib.jar}:${networktables.jar}
|
||||
roboRIOAllowedImages=18
|
||||
|
||||
# Ant support
|
||||
wpilib.ant.dir=${wpilib}/ant
|
||||
|
||||
@@ -20,7 +20,22 @@
|
||||
|
||||
<target name="get-target-ip">
|
||||
<property name="target" value="roboRIO-${team-number}.local" />
|
||||
<echo>Target: ${target}</echo>
|
||||
<echo>Trying Target: ${target}</echo>
|
||||
<if>
|
||||
<isreachable host="${target}"/>
|
||||
<then>
|
||||
<echo>roboRIO found via mDNS</echo>
|
||||
</then>
|
||||
<else>
|
||||
<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>roboRIO not found via mDNS, falling back to static address of ${target}</echo>
|
||||
<assert name="roboRIOFound" message="roboRIO not found, please check that the roboRIO is connected, imaged and that the team number is set properly in Eclipse">
|
||||
<isreachable host="${target}"/>
|
||||
</assert>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile the source code.">
|
||||
@@ -69,8 +84,8 @@
|
||||
<!-- We're running a clean here to get around a known ant issue where it does not detected changed constant variables.
|
||||
To get around this, we're recompiling the entire project, which is not an issue for most teams. If this is an issue
|
||||
for you, you can remove the clean here, just be sure to do a full rebuild after you've changed any constants.
|
||||
Reference: http://stackoverflow.com/questions/6430001/ant-doesnt-recompile-constants -->
|
||||
<target name="deploy" depends="get-target-ip,clean,jar" description="Deploy the jar and start the program running.">
|
||||
Reference: http://stackoverflow.com/questions/6430001/ant-doesnt-recompile-constants -->
|
||||
<target name="deploy" depends="clean,jar,get-target-ip,dependencies" description="Deploy the jar and start the program running.">
|
||||
<echo>[athena-deploy] Copying code over.</echo>
|
||||
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
|
||||
<scp file="${wpilib.ant.dir}/robotCommand" todir="${username}@${target}:${command.dir}" password="${password}" trust="true"/>
|
||||
@@ -89,7 +104,7 @@
|
||||
command="${deploy.log.command}"/>
|
||||
</target>
|
||||
|
||||
<target name="debug-deploy" depends="get-target-ip,jar" description="Deploy the jar and start the program running.">
|
||||
<target name="debug-deploy" depends="jar,get-target-ip,dependencies" description="Deploy the jar and start the program running.">
|
||||
<echo>[athena-deploy] Copying code over.</echo>
|
||||
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
|
||||
<!-- The remoteDebugCommand file is used by /usr/local/frc/bin/frcRunRobot.sh on the roboRIO -->
|
||||
@@ -184,4 +199,27 @@
|
||||
</sequential>
|
||||
</parallel>
|
||||
</target>
|
||||
|
||||
<target name="dependencies" depends="get-target-ip">
|
||||
<property name="ant.enable.asserts" value="true"/>
|
||||
<post to="http://${target}/nisysapi/server" logfile="sysProps.xml" verbose="false" encoding="UTF-16LE">
|
||||
<prop name="Function" value="GetPropertiesOfItem"/>
|
||||
<prop name="Plugins" value="nisyscfg"/>
|
||||
<prop name="Items" value="system"/>
|
||||
</post>
|
||||
<loadfile srcFile="sysProps.xml" encoding="UTF-16LE" property="roboRIOSysValues"/>
|
||||
<propertyregex property="roboRIOImage" input="${roboRIOSysValues}" regexp="FRC_roboRIO_2015_v([0-9]+)" select="\1" defaultValue="ImageRegExFail"/>
|
||||
<assert message="roboRIO Image does not match plugin, allowed image version: ${roboRIOAllowedImages}">
|
||||
<bool>
|
||||
<contains string="${roboRIOAllowedImages}" substring="${roboRIOImage}"/>
|
||||
</bool>
|
||||
</assert>
|
||||
<echo>Checking for JRE. If this fails install the JRE using these instructions: http://wpilib.screenstepslive.com/s/4485/m/13809/l/243933-installing-java-8-on-the-roborio-java-only</echo>
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
failonerror="true"
|
||||
command="test -d ${roboRIOJRE.dir}"/>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user