mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
When deploying a Java program in debug mode any previous running programs should be properly removed. [artf3408] This should link with (https://usfirst.collab.net/sf/go/artf3408?nav=1&_pagenum=2&returnUrlKey=1408475631056) [artf3415] is still an issue until NI resolves it. This should link with (https://usfirst.collab.net/sf/go/artf3415?nav=1&_pagenum=1&returnUrlKey=1408475758258) Change-Id: Ica9639b5a406b70be4d51aa4e45ffef56baddc93
179 lines
6.1 KiB
XML
179 lines
6.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<project name="athena-project-build" default="deploy">
|
|
|
|
<!-- 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">
|
|
<property name="target" value="roboRIO-${team-number}.local" />
|
|
<echo>Target: ${target}</echo>
|
|
</target>
|
|
|
|
<target name="compile" description="Compile the source code.">
|
|
<mkdir dir="${build.dir}"/>
|
|
<echo>[athena-compile] Compiling ${src.dir} with classpath=${classpath} to ${build.dir}</echo>
|
|
|
|
<javac srcdir="${src.dir}"
|
|
destdir="${build.dir}"
|
|
includeAntRuntime="no"
|
|
includeJavaRuntime="no"
|
|
classpath="${classpath}"
|
|
target="${ant.java.version}"
|
|
source="${ant.java.version}"
|
|
compiler="javac${ant.java.version}"
|
|
debug="true">
|
|
</javac>
|
|
</target>
|
|
|
|
<target name="jar" depends="compile">
|
|
<echo>[athena-jar] Making jar ${dist.jar}.</echo>
|
|
<mkdir dir="${dist.dir}" />
|
|
<mkdir dir="${build.jars}" />
|
|
|
|
<echo>[athena-jar] Copying jars from ${classpath} to ${build.jars}.</echo>
|
|
<copy todir="${build.jars}" flatten="true">
|
|
<path>
|
|
<pathelement path="${classpath}"/>
|
|
</path>
|
|
</copy>
|
|
|
|
<jar destfile="${dist.jar}" update="false">
|
|
<manifest>
|
|
<attribute name="Main-Class" value="edu.wpi.first.wpilibj.RobotBase"/>
|
|
<attribute name="Robot-Class" value="${robot.class}"/>
|
|
<attribute name="Class-Path" value="."/>
|
|
</manifest>
|
|
|
|
<fileset dir="${build.dir}" includes="**/*.class"/>
|
|
|
|
<zipgroupfileset dir="${build.jars}">
|
|
<include name="**/*.jar" />
|
|
</zipgroupfileset>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="deploy" depends="get-target-ip,jar" 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"/>
|
|
|
|
<echo>[athena-deploy] Starting program.</echo>
|
|
<sshexec host="${target}"
|
|
username="${username}"
|
|
password="${password}"
|
|
trust="true"
|
|
command="${deploy.kill.command};"/>
|
|
|
|
<sshexec host="${target}"
|
|
username="${username}"
|
|
password="${password}"
|
|
trust="true"
|
|
command="${deploy.log.command}"/>
|
|
</target>
|
|
|
|
<target name="debug-deploy" depends="get-target-ip,jar" 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 -->
|
|
<scp file="${wpilib.ant.dir}/robotDebugCommand" todir="${username}@${target}:${command.dir}" password="${password}" trust="true"/>
|
|
<!-- The frcdebug file is used as a flag for /usr/local/frc/bin/frcRunRobot.sh to run the robot program in debug mode -->
|
|
<scp file="${wpilib.ant.dir}/frcdebug" todir="${username}@${target}:${debug.flag.dir}" password="${password}" trust="true"/>
|
|
|
|
<echo>[athena-deploy] Starting Debug program.</echo>
|
|
<sshexec host="${target}"
|
|
username="${username}"
|
|
password="${password}"
|
|
trust="true"
|
|
command="${deploy.kill.command}"/>
|
|
|
|
<sshexec host="${target}"
|
|
username="${username}"
|
|
password="${password}"
|
|
trust="true"
|
|
command="${deploy.log.command}"/>
|
|
</target>
|
|
|
|
<!-- Simulate -->
|
|
<target name="jar-for-simulation" depends="compile">
|
|
<echo>[jar-for-simulation] Building jar.</echo>
|
|
|
|
<jar destfile="${simulation.dist.jar}">
|
|
<manifest>
|
|
<attribute name="Built-By" value="${user.name}"/>
|
|
<attribute name="Robot-Class" value="${robot.class}"/>
|
|
<attribute name="Main-Class" value="edu.wpi.first.wpilibj.RobotBase"/>
|
|
</manifest>
|
|
<fileset dir="${build.dir}" />
|
|
<zipgroupfileset dir="${wpilib.sim.lib}">
|
|
<include name="**/*.jar" />
|
|
</zipgroupfileset>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="simulate" depends="jar-for-simulation">
|
|
<parallel>
|
|
<sequential>
|
|
<echo>[simulate] Running Gazebo.</echo>
|
|
<exec executable="frcsim">
|
|
<arg value="${simulation.world.file}"/>
|
|
</exec>
|
|
</sequential>
|
|
<sequential>
|
|
<sleep seconds="5"/>
|
|
<echo>[simulate] Running DriverStation.</echo>
|
|
<java jar="${wpilib.sim.tools}/SimDS.jar" fork="true">
|
|
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
|
|
</java>
|
|
</sequential>
|
|
<sequential>
|
|
<sleep seconds="5"/>
|
|
<echo>[simulate] Running Code.</echo>
|
|
<java jar="${simulation.dist.jar}" fork="true">
|
|
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
|
|
</java>
|
|
</sequential>
|
|
</parallel>
|
|
</target>
|
|
|
|
<target name="debug-simulate" depends="jar-for-simulation">
|
|
<parallel>
|
|
<sequential>
|
|
<echo>[debug-simulate] Running Gazebo.</echo>
|
|
<exec executable="frcsim">
|
|
<arg value="${simulation.world.file}"/>
|
|
</exec>
|
|
</sequential>
|
|
<sequential>
|
|
<sleep seconds="5"/>
|
|
<echo>[debug-simulate] Running DriverStation.</echo>
|
|
<java jar="${wpilib.sim.tools}/SimDS.jar" fork="true">
|
|
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
|
|
</java>
|
|
</sequential>
|
|
<sequential>
|
|
<sleep seconds="5"/>
|
|
<echo>[debug-simulate] Running Code.</echo>
|
|
<java jar="${simulation.dist.jar}" fork="true">
|
|
<jvmarg value="-Xdebug" />
|
|
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8348" />
|
|
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
|
|
</java>
|
|
</sequential>
|
|
</parallel>
|
|
</target>
|
|
</project>
|