Initial checkin of unified hierarchy of WPILib 2015
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
28
eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/.project
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>edu.wpi.first.wpilib.plugins.cpp</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,31 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: WPILib_CPP_Robot_Development
|
||||
Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.cpp;singleton:=true
|
||||
Bundle-Version: 0.1.0.qualifier
|
||||
Bundle-Activator: edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources;bundle-version="3.8.1",
|
||||
edu.wpi.first.wpilib.plugins.core;bundle-version="0.1.0",
|
||||
org.eclipse.cdt;bundle-version="8.1.0",
|
||||
org.eclipse.cdt.build.crossgcc;bundle-version="1.1.0",
|
||||
org.eclipse.cdt.core;bundle-version="5.4.0",
|
||||
org.eclipse.cdt.ui;bundle-version="5.4.0",
|
||||
org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0",
|
||||
org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="8.1.0",
|
||||
org.eclipse.cdt.managedbuilder.ui;bundle-version="8.1.0",
|
||||
org.eclipse.ui.editors;bundle-version="3.8.0",
|
||||
org.eclipse.ui.ide;bundle-version="3.8.1",
|
||||
org.eclipse.debug.core;bundle-version="3.7.100",
|
||||
org.eclipse.debug.ui;bundle-version="3.8.1",
|
||||
org.eclipse.rse;bundle-version="3.1.0",
|
||||
org.eclipse.rse.core;bundle-version="3.1.1",
|
||||
org.eclipse.cdt.debug.core;bundle-version="7.2.0",
|
||||
org.eclipse.cdt.debug.ui;bundle-version="7.2.0",
|
||||
org.eclipse.cdt.launch;bundle-version="7.1.0",
|
||||
org.eclipse.cdt.launch.remote;bundle-version="2.4.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Export-Package: edu.wpi.first.wpilib.plugins.cpp,
|
||||
edu.wpi.first.wpilib.plugins.cpp.preferences
|
||||
@@ -0,0 +1,9 @@
|
||||
source.. = src/main/java/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
resources/
|
||||
src.includes = resources/**,\
|
||||
src/
|
||||
bin.excludes = resources/configuration.properties
|
||||
190
eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/plugin.xml
Normal file
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.eclipse.ui.newWizards">
|
||||
<category
|
||||
name="WPILib Robot C++ Development"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp">
|
||||
</category>
|
||||
<wizard
|
||||
category="edu.wpi.first.wpilib.plugins.cpp"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.NewCPPWizard"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
icon="resources/icons/wpi.ico"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.NewCPPWizard"
|
||||
name="Robot C++ Project"
|
||||
project="true">
|
||||
</wizard>
|
||||
<wizard
|
||||
category="edu.wpi.first.wpilib.plugins.cpp"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.wizards.examples.ExampleCPPWizard"
|
||||
icon="resources/icons/wpi.ico"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.wizards.examples.ExampleWizard"
|
||||
name="Example Robot C++ Project"
|
||||
project="true">
|
||||
</wizard>
|
||||
<wizard
|
||||
category="edu.wpi.first.wpilib.plugins.cpp"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandWizard"
|
||||
icon="resources/icons/Command.png"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandWizard"
|
||||
name="Command">
|
||||
</wizard>
|
||||
<wizard
|
||||
category="edu.wpi.first.wpilib.plugins.cpp"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandGroupWizard"
|
||||
icon="resources/icons/CommandGroup.png"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandGroupWizard"
|
||||
name="CommandGroup">
|
||||
</wizard>
|
||||
<wizard
|
||||
category="edu.wpi.first.wpilib.plugins.cpp"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.SubsystemWizard"
|
||||
icon="resources/icons/Subsystem.png"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.SubsystemWizard"
|
||||
name="Subsytem">
|
||||
</wizard>
|
||||
<wizard
|
||||
category="edu.wpi.first.wpilib.plugins.cpp"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.PIDSubsystemWizard"
|
||||
icon="resources/icons/PIDSubsystem.png"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.PIDSubsystemWizard"
|
||||
name="PIDSubsystem">
|
||||
</wizard>
|
||||
<wizard
|
||||
category="edu.wpi.first.wpilib.plugins.cpp"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.TriggerWizard"
|
||||
icon="resources/icons/Button.png"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.TriggerWizard"
|
||||
name="Trigger">
|
||||
</wizard>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.navigator.navigatorContent">
|
||||
<commonWizard
|
||||
menuGroupId="edu.wpi.first.wpilib.plugins.cpp"
|
||||
type="new"
|
||||
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandWizard">
|
||||
<enablement>
|
||||
<with
|
||||
variable="activeWorkbenchWindow.activePerspective">
|
||||
<equals
|
||||
value="org.eclipse.cdt.ui.CPerspective">
|
||||
</equals>
|
||||
</with>
|
||||
</enablement>
|
||||
</commonWizard>
|
||||
<commonWizard
|
||||
menuGroupId="edu.wpi.first.wpilib.plugins.cpp"
|
||||
type="new"
|
||||
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandGroupWizard">
|
||||
<enablement>
|
||||
<with
|
||||
variable="activeWorkbenchWindow.activePerspective">
|
||||
<equals
|
||||
value="org.eclipse.cdt.ui.CPerspective">
|
||||
</equals>
|
||||
</with>
|
||||
</enablement>
|
||||
</commonWizard>
|
||||
<commonWizard
|
||||
menuGroupId="edu.wpi.first.wpilib.plugins.cpp"
|
||||
type="new"
|
||||
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.SubsystemWizard">
|
||||
<enablement>
|
||||
<with
|
||||
variable="activeWorkbenchWindow.activePerspective">
|
||||
<equals
|
||||
value="org.eclipse.cdt.ui.CPerspective">
|
||||
</equals>
|
||||
</with>
|
||||
</enablement>
|
||||
</commonWizard>
|
||||
<commonWizard
|
||||
menuGroupId="edu.wpi.first.wpilib.plugins.cpp"
|
||||
type="new"
|
||||
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.PIDSubsystemWizard">
|
||||
<enablement>
|
||||
<with
|
||||
variable="activeWorkbenchWindow.activePerspective">
|
||||
<equals
|
||||
value="org.eclipse.cdt.ui.CPerspective">
|
||||
</equals>
|
||||
</with>
|
||||
</enablement>
|
||||
</commonWizard>
|
||||
<commonWizard
|
||||
menuGroupId="edu.wpi.first.wpilib.plugins.cpp"
|
||||
type="new"
|
||||
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.TriggerWizard">
|
||||
<enablement>
|
||||
<with
|
||||
variable="activeWorkbenchWindow.activePerspective">
|
||||
<equals
|
||||
value="org.eclipse.cdt.ui.CPerspective">
|
||||
</equals>
|
||||
</with>
|
||||
</enablement>
|
||||
</commonWizard>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.preferencePages">
|
||||
<page
|
||||
category="edu.wpi.first.wpilib.plugins.core.preferences.WPILibPreferencePage"
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.preferences.CPPPreferencePage"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.preferences.CPPPreferencePage"
|
||||
name="C++ Preferences">
|
||||
</page>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.preferences">
|
||||
<initializer
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.preferences.PreferenceInitializer">
|
||||
</initializer>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.debug.ui.launchShortcuts">
|
||||
<shortcut
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.launching.DeployLaunchShortcut"
|
||||
description="Deploy the WPILib project to the athena board."
|
||||
icon="resources/icons/wpi.ico"
|
||||
id="edu.wpi.first.wpilib.plugins.cpp.launching.deploy"
|
||||
label="WPILib Deploy"
|
||||
modes="run,debug">
|
||||
<contextualLaunch>
|
||||
<enablement>
|
||||
<with
|
||||
variable="selection">
|
||||
<iterate>
|
||||
<and>
|
||||
<test
|
||||
value="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
|
||||
property="org.eclipse.core.resources.projectNature">
|
||||
</test>
|
||||
<test
|
||||
value="org.eclipse.cdt.core.cnature"
|
||||
property="org.eclipse.core.resources.projectNature">
|
||||
</test>
|
||||
</and>
|
||||
</iterate>
|
||||
</with>
|
||||
</enablement>
|
||||
</contextualLaunch>
|
||||
<description
|
||||
description="Deploy the WPILib project to the athena board."
|
||||
mode="run">
|
||||
</description>
|
||||
<description
|
||||
description="Deploy the WPILib project to the athena board and debug it."
|
||||
mode="debug">
|
||||
</description>
|
||||
</shortcut>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.startup">
|
||||
<startup
|
||||
class="edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin">
|
||||
</startup>
|
||||
</extension>
|
||||
</plugin>
|
||||
365
eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/pom.xml
Normal file
@@ -0,0 +1,365 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>edu.wpi.first.wpilib.plugins.cpp</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>edu.wpi.first.wpilib.plugins</groupId>
|
||||
<artifactId>edu.wpi.first.wpilib.plugins</artifactId>
|
||||
<version>0.1.0.qualifier</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>WPILib Repository</id>
|
||||
<url>http://frcbuilder.wpi.edu:8348/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<build-number>DEVELOPMENT</build-number>
|
||||
<cpp-zip>${project.build.directory}/cpp-zip</cpp-zip>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>.</directory>
|
||||
<includes>
|
||||
<include>resources/configuration.properties</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-ant-resources-to-cpp-zip</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${cpp-zip}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources/cpp-zip</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
|
||||
<!-- Fetch the dependencies needed to build the cpp.zip file. -->
|
||||
<execution>
|
||||
<id>fetch-cpp-zip-dependencies</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<!-- Libraries needed to link against for WPILib on the Athena -->
|
||||
<artifactItem>
|
||||
<groupId>edu.wpi.first.wpilib.networktables.cpp</groupId>
|
||||
<artifactId>libNetworkTablesAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>a</type>
|
||||
<destFileName>libNetworkTables.a</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>edu.wpi.first.wpilib.hal</groupId>
|
||||
<artifactId>libHALAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>a</type>
|
||||
<destFileName>libHAL.a</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>edu.wpi.first.wpilib.cpp</groupId>
|
||||
<artifactId>libWPILibAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>a</type>
|
||||
<destFileName>libWPILib.a</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libFRC_NetworkCommunication</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libFRC_NetworkCommunication.so</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libRoboRIO_FRC_ChipObject</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libRoboRIO_FRC_ChipObject.so</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libFRC_FPGA_ChipObject</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libFRC_FPGA_ChipObject.so</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libNiFpga</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libNiFpga.so</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libni_emb</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libni_emb.so</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libnirio_emb_can</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libnirio_emb_can.so</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libNiFpgaLv</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libNiFpgaLv.so</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libNiRioSrv</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libNiRioSrv.so</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libni_rtlog</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
<destFileName>libni_rtlog.so</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<!-- Includes needed to compile against for WPILib on the Athena -->
|
||||
<artifactItem>
|
||||
<groupId>edu.wpi.first.wpilib.hal</groupId>
|
||||
<artifactId>include</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>inczip</type>
|
||||
<outputDirectory>${cpp-zip}/inczip</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>edu.wpi.first.wpilib.networktables.cpp</groupId>
|
||||
<artifactId>include</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>inczip</type>
|
||||
<outputDirectory>${cpp-zip}/inczip</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>edu.wpi.first.wpilib.cpp</groupId>
|
||||
<artifactId>libWPILibAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>inczip</type>
|
||||
<outputDirectory>${cpp-zip}/inczip</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${cpp-zip}/lib</outputDirectory>
|
||||
<overWriteReleases>false</overWriteReleases>
|
||||
<overWriteSnapshots>true</overWriteSnapshots>
|
||||
<prependGroupId>true</prependGroupId>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
|
||||
<!-- Set time stamp and version properties. -->
|
||||
<execution>
|
||||
<id>set-version-info</id>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<phase>process-sources</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<tstamp>
|
||||
<format property="timestamp" pattern="yyyy/MM/dd HH:mm:ss z"/>
|
||||
</tstamp>
|
||||
<tstamp>
|
||||
<format property="version-info" pattern="yyyy.MM"/>
|
||||
</tstamp>
|
||||
<property name="version" value="${version-info}.${build-number}"/>
|
||||
</target>
|
||||
<exportAntProperties>true</exportAntProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!-- Unzip the include files for cpp.zip. -->
|
||||
<execution>
|
||||
<id>unzip-cpp-includes</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<unzip dest="${cpp-zip}/include">
|
||||
<patternset>
|
||||
<include name="**/*.h"/>
|
||||
</patternset>
|
||||
<fileset dir="${cpp-zip}/inczip">
|
||||
<include name="*.inczip"/>
|
||||
</fileset>
|
||||
</unzip>
|
||||
<delete dir="${cpp-zip}/inczip"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!-- Generate zip file to unzip for the user. -->
|
||||
<execution>
|
||||
<id>generate-cpp-zip</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<zip destfile="${project.build.directory}/classes/resources/cpp.zip"
|
||||
basedir="${cpp-zip}"
|
||||
update="true" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<!-- Add fake dependencies to inform Maven of the correct
|
||||
order it should build projects in during a multi-module build.
|
||||
|
||||
This list should match the list in the invocation of
|
||||
maven-dependency-plugin:copy above.
|
||||
|
||||
It may be possible to avoid this duplication by using the
|
||||
maven-assembly-plugin instead.-->
|
||||
<!-- Libraries needed to link against for WPILib on the Athena -->
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.wpilib.networktables.cpp</groupId>
|
||||
<artifactId>libNetworkTablesAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>a</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.wpilib.hal</groupId>
|
||||
<artifactId>libHALAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>a</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.wpilib.cpp</groupId>
|
||||
<artifactId>libWPILibAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>a</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libFRC_NetworkCommunication</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libRoboRIO_FRC_ChipObject</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libFRC_FPGA_ChipObject</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libNiFpga</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libni_emb</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libnirio_emb_can</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libNiFpgaLv</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libNiRioSrv</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ni.first.libraries</groupId>
|
||||
<artifactId>libni_rtlog</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>so</type>
|
||||
</dependency>
|
||||
|
||||
<!-- Includes needed to compile against for WPILib on the Athena -->
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.wpilib.hal</groupId>
|
||||
<artifactId>include</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>inczip</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.wpilib.networktables.cpp</groupId>
|
||||
<artifactId>include</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>inczip</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.wpilib.cpp</groupId>
|
||||
<artifactId>libWPILibAthena</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<type>inczip</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
timestamp=${timestamp}
|
||||
version=${version}
|
||||
|
After Width: | Height: | Size: 790 B |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 983 B |
|
After Width: | Height: | Size: 894 B |
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="FRCUserProgram" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318." name="/" resourcePath="">
|
||||
<toolChain errorParsers="" id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1222262887" name="Cross GCC" nonInternalBuilderId="cdt.managedbuild.builder.gnu.cross" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.513278893" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="arm-none-linux-gnueabi-" valueType="string"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.1104307" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" value="$toolchain/bin" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.801649698" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder autoBuildTarget="all" buildPath="${workspace_loc:/$project}/Debug" cleanBuildTarget="clean" errorParsers="" id="org.eclipse.cdt.build.core.internal.builder.2128327489" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
|
||||
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.cross.c.compiler.432788947" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.154663678" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.516596133" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1224398283" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.442358515" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.549514425" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.1682909384" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.include.paths.1597382905" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="$cpp-location/include"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.963785380" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1367166630" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1568604896" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||
<option id="gnu.cpp.link.option.paths.1928585110" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value="$cpp-location/lib"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.libs.1072058280" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="WPILib"/>
|
||||
<listOptionValue builtIn="false" value="HAL"/>
|
||||
<listOptionValue builtIn="false" value="FRC_NetworkCommunication"/>
|
||||
<listOptionValue builtIn="false" value="RoboRIO_FRC_ChipObject"/>
|
||||
<listOptionValue builtIn="false" value="FRC_FPGA_ChipObject"/>
|
||||
<listOptionValue builtIn="false" value="NiFpga"/>
|
||||
<listOptionValue builtIn="false" value="ni_emb"/>
|
||||
<listOptionValue builtIn="false" value="nirio_emb_can"/>
|
||||
<listOptionValue builtIn="false" value="NiFpgaLv"/>
|
||||
<listOptionValue builtIn="false" value="NiRioSrv"/>
|
||||
<listOptionValue builtIn="false" value="ni_rtlog"/>
|
||||
<listOptionValue builtIn="false" value="NetworkTables"/>
|
||||
<listOptionValue builtIn="false" value="dl"/>
|
||||
<listOptionValue builtIn="false" value="pthread"/>
|
||||
<listOptionValue builtIn="false" value="HAL"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1757265359" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1584536431" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.tool.gnu.cross.assembler.184874228" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<option id="gnu.both.asm.option.include.paths.1131856974" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1900042568" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.1534660163">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.1534660163" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="FRCUserProgram" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.1534660163" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.1534660163." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.136041223" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.2033173825" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="arm-none-linux-gnueabi-" valueType="string"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.1246856819" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" value="$toolchain/bin" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.433467152" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder buildPath="${workspace_loc:/$project}/Release" id="cdt.managedbuild.builder.gnu.cross.716436070" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.2003820010" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1889430616" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.1571598299" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1532409549" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.901599840" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.366961467" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.95433592" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.863062221" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.970059366" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.476884336" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.749590312" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1104120173" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1966871489" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.304828125" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="$project.cdt.managedbuild.target.gnu.cross.exe.548740421" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.418253318;cdt.managedbuild.config.gnu.cross.exe.debug.418253318.;cdt.managedbuild.tool.gnu.cross.c.compiler.432788947;cdt.managedbuild.tool.gnu.c.compiler.input.1224398283">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD "${plugin_state_location}/specs.c"" command="arm-none-linux-gnueabi-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.1534660163;cdt.managedbuild.config.gnu.cross.exe.release.1534660163.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.901599840;cdt.managedbuild.tool.gnu.cpp.compiler.input.863062221">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD "${plugin_state_location}/specs.cpp"" command="arm-none-linux-gnueabi-g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.418253318;cdt.managedbuild.config.gnu.cross.exe.debug.418253318.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.442358515;cdt.managedbuild.tool.gnu.cpp.compiler.input.963785380">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD "${plugin_state_location}/specs.cpp"" command="arm-none-linux-gnueabi-g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.1534660163;cdt.managedbuild.config.gnu.cross.exe.release.1534660163.;cdt.managedbuild.tool.gnu.cross.c.compiler.2003820010;cdt.managedbuild.tool.gnu.c.compiler.input.1532409549">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD "${plugin_state_location}/specs.c"" command="arm-none-linux-gnueabi-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/$project"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/$project"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
@@ -0,0 +1,21 @@
|
||||
# Deployment information
|
||||
username=admin
|
||||
password=
|
||||
deploy.dir=/home/admin
|
||||
deploy.run.command=./runcppprogram
|
||||
deploy.debug.command=./debugcppprogram
|
||||
|
||||
# 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
|
||||
build.dir=build
|
||||
out.exe=Debug/${out}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="FRC Deployment" default="deploy">
|
||||
|
||||
<!--
|
||||
The following properties can be defined to override system level
|
||||
settings. These should not be touched unless you know what you're
|
||||
doing. The primary use is to override the wpilib version when
|
||||
working with older robots that can't compile with the latest
|
||||
libraries.
|
||||
-->
|
||||
|
||||
<!-- By default the system version of WPI is used -->
|
||||
<!-- <property name="version" value=""/> -->
|
||||
|
||||
<!-- By default the system team number is used -->
|
||||
<!-- <property name="team-number" value=""/> -->
|
||||
|
||||
<!-- By default the target is set to 10.TE.AM.2 -->
|
||||
<!-- <property name="target" value=""/> -->
|
||||
|
||||
<property file="${user.home}/wpilib/wpilib.properties"/>
|
||||
<property file="build.properties"/>
|
||||
|
||||
<import file="${wpilib.ant.dir}/build.xml"/>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "$classname.h"
|
||||
|
||||
$classname::$classname() {
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
// eg. Requires(chassis);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
void $classname::Initialize() {
|
||||
|
||||
}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
void $classname::Execute() {
|
||||
|
||||
}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
bool $classname::IsFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called once after isFinished returns true
|
||||
void $classname::End() {
|
||||
|
||||
}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
void $classname::Interrupted() {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef $classname_H
|
||||
#define $classname_H
|
||||
|
||||
#include "../CommandBase.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ExampleAuthor
|
||||
*/
|
||||
class $classname: public CommandBase {
|
||||
public:
|
||||
$classname();
|
||||
virtual void Initialize();
|
||||
virtual void Execute();
|
||||
virtual bool IsFinished();
|
||||
virtual void End();
|
||||
virtual void Interrupted();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "CommandBase.h"
|
||||
#include "Subsystems/ExampleSubsystem.h"
|
||||
#include "Commands/Scheduler.h"
|
||||
|
||||
CommandBase::CommandBase(const char *name) : Command(name) {
|
||||
}
|
||||
|
||||
CommandBase::CommandBase() : Command() {
|
||||
}
|
||||
|
||||
// Initialize a single static instance of all of your subsystems to NULL
|
||||
ExampleSubsystem* CommandBase::examplesubsystem = NULL;
|
||||
OI* CommandBase::oi = NULL;
|
||||
|
||||
void CommandBase::init() {
|
||||
// Create a single static instance of all of your subsystems. The following
|
||||
// line should be repeated for each subsystem in the project.
|
||||
examplesubsystem = new ExampleSubsystem();
|
||||
|
||||
oi = new OI();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef COMMAND_BASE_H
|
||||
#define COMMAND_BASE_H
|
||||
|
||||
#include "Commands/Command.h"
|
||||
#include "Subsystems/ExampleSubsystem.h"
|
||||
#include "OI.h"
|
||||
|
||||
|
||||
/**
|
||||
* The base for all commands. All atomic commands should subclass CommandBase.
|
||||
* CommandBase stores creates and stores each control system. To access a
|
||||
* subsystem elsewhere in your code in your code use CommandBase.examplesubsystem
|
||||
*/
|
||||
class CommandBase: public Command {
|
||||
public:
|
||||
CommandBase(const char *name);
|
||||
CommandBase();
|
||||
static void init();
|
||||
// Create a single static instance of all of your subsystems
|
||||
static ExampleSubsystem *examplesubsystem;
|
||||
static OI *oi;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
#include "$classname.h"
|
||||
|
||||
$classname::$classname() {
|
||||
// Add Commands here:
|
||||
// e.g. AddSequential(new Command1());
|
||||
// AddSequential(new Command2());
|
||||
// these will run in order.
|
||||
|
||||
// To run multiple commands at the same time,
|
||||
// use AddParallel()
|
||||
// e.g. AddParallel(new Command1());
|
||||
// AddSequential(new Command2());
|
||||
// Command1 and Command2 will run in parallel.
|
||||
|
||||
// A command group will require all of the subsystems that each member
|
||||
// would require.
|
||||
// e.g. if Command1 requires chassis, and Command2 requires arm,
|
||||
// a CommandGroup containing them would require both the chassis and the
|
||||
// arm.
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
#ifndef $classname_H
|
||||
#define $classname_H
|
||||
|
||||
#include "Commands/CommandGroup.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ExampleAuthor
|
||||
*/
|
||||
class $classname: public CommandGroup {
|
||||
public:
|
||||
$classname();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "ExampleCommand.h"
|
||||
|
||||
ExampleCommand::ExampleCommand() {
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
// eg. Requires(chassis);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
void ExampleCommand::Initialize() {
|
||||
|
||||
}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
void ExampleCommand::Execute() {
|
||||
|
||||
}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
bool ExampleCommand::IsFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called once after isFinished returns true
|
||||
void ExampleCommand::End() {
|
||||
|
||||
}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
void ExampleCommand::Interrupted() {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef EXAMPLE_COMMAND_H
|
||||
#define EXAMPLE_COMMAND_H
|
||||
|
||||
#include "../CommandBase.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ExampleAuthor
|
||||
*/
|
||||
class ExampleCommand: public CommandBase {
|
||||
public:
|
||||
ExampleCommand();
|
||||
virtual void Initialize();
|
||||
virtual void Execute();
|
||||
virtual bool IsFinished();
|
||||
virtual void End();
|
||||
virtual void Interrupted();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "ExampleSubsystem.h"
|
||||
#include "../Robotmap.h"
|
||||
|
||||
ExampleSubsystem::ExampleSubsystem() : Subsystem("ExampleSubsystem") {
|
||||
|
||||
}
|
||||
|
||||
void ExampleSubsystem::InitDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
//SetDefaultCommand(new MySpecialCommand());
|
||||
}
|
||||
|
||||
|
||||
// Put methods for controlling this subsystem
|
||||
// here. Call these from Commands.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef EXAMPLE_SUBSYSTEM_H
|
||||
#define EXAMPLE_SUBSYSTEM_H
|
||||
#include "Commands/Subsystem.h"
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ExampleAuthor
|
||||
*/
|
||||
class ExampleSubsystem: public Subsystem {
|
||||
private:
|
||||
// It's desirable that everything possible under private except
|
||||
// for methods that implement subsystem capabilities
|
||||
public:
|
||||
ExampleSubsystem();
|
||||
void InitDefaultCommand();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "OI.h"
|
||||
|
||||
OI::OI() {
|
||||
// Process operator interface input here.
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef OI_H
|
||||
#define OI_H
|
||||
|
||||
#include "WPILib.h"
|
||||
|
||||
class OI {
|
||||
private:
|
||||
|
||||
public:
|
||||
OI();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
#include "$classname.h"
|
||||
#include "../Robotmap.h"
|
||||
#include "SmartDashboard/SmartDashboard.h"
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
|
||||
#@autogenerated_code("pid", "")
|
||||
#parse("${exporter-path}PIDSubsystem-pid.cpp")
|
||||
#end
|
||||
$classname::$classname() : PIDSubsystem("$classname", 1.0, 0.0, 0.0) {
|
||||
// Use these to get going:
|
||||
// SetSetpoint() - Sets where the PID controller should move the system
|
||||
// to
|
||||
// Enable() - Enables the PID controller.
|
||||
}
|
||||
|
||||
double $classname::ReturnPIDInput() {
|
||||
// Return your input value for the PID loop
|
||||
// e.g. a sensor, like a potentiometer:
|
||||
// yourPot->SetAverageVoltage() / kYourMaxVoltage;
|
||||
}
|
||||
|
||||
void $classname::UsePIDOutput(double output) {
|
||||
// Use output to drive your system, like a motor
|
||||
// e.g. yourMotor->Set(output);
|
||||
}
|
||||
|
||||
void $classname::InitDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
//setDefaultCommand(new MySpecialCommand());
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
#ifndef $classname_H
|
||||
#define $classname_H
|
||||
|
||||
#include "Commands/PIDSubsystem.h"
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ExampleAuthor
|
||||
*/
|
||||
class $classname: public PIDSubsystem {
|
||||
public:
|
||||
$classname();
|
||||
double ReturnPIDInput();
|
||||
void UsePIDOutput(double output);
|
||||
void InitDefaultCommand();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
//============================================================================
|
||||
// Name : Robot.cpp
|
||||
// Author :
|
||||
// Version :
|
||||
// Copyright :
|
||||
// Description : Hello World in C++, Ansi-style
|
||||
//============================================================================
|
||||
|
||||
#include "WPILib.h"
|
||||
#include "Commands/Command.h"
|
||||
#include "Commands/ExampleCommand.h"
|
||||
#include "CommandBase.h"
|
||||
|
||||
class Robot : public IterativeRobot {
|
||||
private:
|
||||
Command *autonomousCommand;
|
||||
LiveWindow *lw;
|
||||
|
||||
virtual void RobotInit() {
|
||||
CommandBase::init();
|
||||
autonomousCommand = new ExampleCommand();
|
||||
lw = LiveWindow::GetInstance();
|
||||
}
|
||||
|
||||
virtual void AutonomousInit() {
|
||||
autonomousCommand->Start();
|
||||
}
|
||||
|
||||
virtual void AutonomousPeriodic() {
|
||||
Scheduler::GetInstance()->Run();
|
||||
}
|
||||
|
||||
virtual void TeleopInit() {
|
||||
// This makes sure that the autonomous stops running when
|
||||
// teleop starts running. If you want the autonomous to
|
||||
// continue until interrupted by another command, remove
|
||||
// this line or comment it out.
|
||||
autonomousCommand->Cancel();
|
||||
}
|
||||
|
||||
virtual void TeleopPeriodic() {
|
||||
Scheduler::GetInstance()->Run();
|
||||
}
|
||||
|
||||
virtual void TestPeriodic() {
|
||||
lw->Run();
|
||||
}
|
||||
};
|
||||
|
||||
START_ROBOT_CLASS(Robot);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef ROBOTMAP_H
|
||||
#define ROBOTMAP_H
|
||||
|
||||
|
||||
/**
|
||||
* The RobotMap is a mapping from the ports sensors and actuators are wired into
|
||||
* to a variable name. This provides flexibility changing wiring, makes checking
|
||||
* the wiring easier and significantly reduces the number of magic numbers
|
||||
* floating around.
|
||||
*/
|
||||
|
||||
// For example to map the left and right motors, you could define the
|
||||
// following variables to use with your drivetrain subsystem.
|
||||
// #define LEFTMOTOR 1
|
||||
// #define RIGHTMOTOR 2
|
||||
|
||||
// If you are using multiple modules, make sure to define both the port
|
||||
// number and the module. For example you with a rangefinder:
|
||||
// #define RANGE_FINDER_PORT 1
|
||||
// #define RANGE_FINDER_MODULE 1
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "$classname.h"
|
||||
#include "../Robotmap.h"
|
||||
|
||||
$classname::$classname() : Subsystem("ExampleSubsystem") {
|
||||
|
||||
}
|
||||
|
||||
void $classname::InitDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
//SetDefaultCommand(new MySpecialCommand());
|
||||
}
|
||||
|
||||
|
||||
// Put methods for controlling this subsystem
|
||||
// here. Call these from Commands.
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef $classname_H
|
||||
#define $classname_H
|
||||
#include "Commands/Subsystem.h"
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ExampleAuthor
|
||||
*/
|
||||
class $classname: public Subsystem {
|
||||
private:
|
||||
// It's desirable that everything possible under private except
|
||||
// for methods that implement subsystem capabilities
|
||||
public:
|
||||
$classname();
|
||||
void InitDefaultCommand();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
// TODO: convert into C++ template
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Trigger;
|
||||
|
||||
/**
|
||||
* New and improved C++
|
||||
*/
|
||||
public class $classname extends Trigger {
|
||||
|
||||
public boolean get() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// TODO: convert into C++ template
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Trigger;
|
||||
|
||||
/**
|
||||
* New and improved C++
|
||||
*/
|
||||
public class $classname extends Trigger {
|
||||
|
||||
public boolean get() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//============================================================================
|
||||
// Name : Robot.cpp
|
||||
// Author :
|
||||
// Version :
|
||||
// Copyright :
|
||||
// Description : Hello World in C++, Ansi-style
|
||||
//============================================================================
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
// This is a simple robot program
|
||||
int main() {
|
||||
NetworkTable::SetServerMode();
|
||||
NetworkTable::SetTeam(190);
|
||||
NetworkTable* table = NetworkTable::GetTable("SmartDashboard");
|
||||
cout << "Started up" << endl;
|
||||
|
||||
long i = 0;
|
||||
while (true) {
|
||||
cout << i << endl;
|
||||
table->PutNumber("i", i);
|
||||
i++;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package $package;
|
||||
|
||||
/**
|
||||
* Simplest possible robot program
|
||||
*
|
||||
* @author Team $team-number
|
||||
*/
|
||||
public class Robot {
|
||||
|
||||
/**
|
||||
* @param args Input....
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// Do stuff here!
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<examples>
|
||||
<tagDescription>
|
||||
<name>Simple Robot</name>
|
||||
<description>Examples for simple robot programs.</description>
|
||||
</tagDescription>
|
||||
<tagDescription>
|
||||
<name>Network Tables</name>
|
||||
<description>Examples of how to use Network Tables to accomplish a
|
||||
variety of tasks such as sending and receiving values to both
|
||||
dashboards and co-processors..</description>
|
||||
</tagDescription>
|
||||
|
||||
<example>
|
||||
<name>Simple Robot Example</name>
|
||||
<description>The simplest possible program that compiles. This
|
||||
shows the structure of a simple program that does nothing at
|
||||
all.</description>
|
||||
<tags>
|
||||
<tag>Simple Robot</tag>
|
||||
</tags>
|
||||
<packages>
|
||||
<package>src</package>
|
||||
</packages>
|
||||
<files>
|
||||
<file source="examples/Simple Robot Example/Robot.java" destination="src/Robot.cpp" />
|
||||
</files>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<name>Network Table Counter</name>
|
||||
<description>A simple program that increments a network table
|
||||
variable once every second. This shows the structure of a simple
|
||||
program that only uses network tables.</description>
|
||||
<tags>
|
||||
<tag>Simple Robot</tag>
|
||||
<tag>Network Tables</tag>
|
||||
</tags>
|
||||
<packages>
|
||||
<package>src</package>
|
||||
</packages>
|
||||
<files>
|
||||
<file source="examples/Network Table Counter/Robot.cpp" destination="src/Robot.cpp" />
|
||||
</files>
|
||||
</example>
|
||||
|
||||
</examples>
|
||||
@@ -0,0 +1,48 @@
|
||||
//============================================================================
|
||||
// Name : Robot.cpp
|
||||
// Author :
|
||||
// Version :
|
||||
// Copyright :
|
||||
// Description : Hello World in C++, Ansi-style
|
||||
//============================================================================
|
||||
|
||||
//============================================================================
|
||||
// Name : Robot.cpp
|
||||
// Author :
|
||||
// Version :
|
||||
// Copyright :
|
||||
// Description : Hello World in C++, Ansi-style
|
||||
//============================================================================
|
||||
|
||||
#include "WPILib.h"
|
||||
|
||||
class Robot : public IterativeRobot {
|
||||
private:
|
||||
LiveWindow *lw;
|
||||
|
||||
virtual void RobotInit() {
|
||||
lw = LiveWindow::GetInstance();
|
||||
}
|
||||
|
||||
virtual void AutonomousInit() {
|
||||
|
||||
}
|
||||
|
||||
virtual void AutonomousPeriodic() {
|
||||
|
||||
}
|
||||
|
||||
virtual void TeleopInit() {
|
||||
|
||||
}
|
||||
|
||||
virtual void TeleopPeriodic() {
|
||||
|
||||
}
|
||||
|
||||
virtual void TestPeriodic() {
|
||||
lw->Run();
|
||||
}
|
||||
};
|
||||
|
||||
START_ROBOT_CLASS(Robot);
|
||||
@@ -0,0 +1,62 @@
|
||||
//============================================================================
|
||||
// Name : Robot.cpp
|
||||
// Author :
|
||||
// Version :
|
||||
// Copyright :
|
||||
// Description : Hello World in C++, Ansi-style
|
||||
//============================================================================
|
||||
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
* This is a demo program showing the use of the RobotBase class.
|
||||
* The SimpleRobot class is the base of a robot application that will automatically call your
|
||||
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
|
||||
* the driver station or the field controls.
|
||||
*/
|
||||
class Robot : public SimpleRobot
|
||||
{
|
||||
RobotDrive myRobot; // robot drive system
|
||||
Joystick stick; // only joystick
|
||||
|
||||
public:
|
||||
Robot(void):
|
||||
myRobot(1, 2), // these must be initialized in the same order
|
||||
stick(1) // as they are declared above.
|
||||
{
|
||||
myRobot.SetExpiration(0.1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drive left & right motors for 2 seconds then stop
|
||||
*/
|
||||
void Autonomous(void)
|
||||
{
|
||||
myRobot.SetSafetyEnabled(false);
|
||||
myRobot.Drive(-0.5, 0.0); // drive forwards half speed
|
||||
Wait(2.0); // for 2 seconds
|
||||
myRobot.Drive(0.0, 0.0); // stop robot
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the motors with arcade steering.
|
||||
*/
|
||||
void OperatorControl(void)
|
||||
{
|
||||
myRobot.SetSafetyEnabled(true);
|
||||
while (IsOperatorControl())
|
||||
{
|
||||
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
|
||||
Wait(0.005); // wait for a motor update time
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs during test mode
|
||||
*/
|
||||
void Test() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
START_ROBOT_CLASS(Robot);
|
||||
@@ -0,0 +1,92 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.ui.IStartup;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.ant.AntPropertiesParser;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.installer.CPPInstaller;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.preferences.PreferenceConstants;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class WPILibCPPPlugin extends AbstractUIPlugin implements IStartup {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "WPILib_CPP_Robot_Development"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static WPILibCPPPlugin plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public WPILibCPPPlugin() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static WPILibCPPPlugin getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public String getDefaultToolchainVersion() {
|
||||
return "arm-none-linux-gnueabi-4.4.1";
|
||||
}
|
||||
|
||||
public String getToolchain() {
|
||||
return WPILibCore.getDefault().getWPILibBaseDir()
|
||||
+ File.separator + "toolchains" + File.separator + getPreferenceStore().getString(PreferenceConstants.TOOLCHAIN_VERSION);
|
||||
}
|
||||
|
||||
public String getCurrentVersion() {
|
||||
try {
|
||||
Properties props = new AntPropertiesParser(WPILibCPPPlugin.class.getResourceAsStream("/resources/configuration.properties")).getProperties();
|
||||
if (props.getProperty("version").startsWith("$")) {
|
||||
return "DEVELOPMENT";
|
||||
} else {
|
||||
return props.getProperty("version");
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
return "DEVELOPMENT";
|
||||
}
|
||||
}
|
||||
|
||||
public String getCPPDir() {
|
||||
return WPILibCore.getDefault().getWPILibBaseDir()
|
||||
+ File.separator + "cpp" + File.separator + getPreferenceStore().getString(PreferenceConstants.LIBRARY_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void earlyStartup() {
|
||||
new CPPInstaller(getCurrentVersion()).installIfNecessary();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.installer;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.installer.AbstractInstaller;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.preferences.PreferenceConstants;
|
||||
|
||||
/**
|
||||
* Installs the given version of WPILib into the correct location. Where the
|
||||
* install directory is usually ~/wpilib/cpp/version.
|
||||
*
|
||||
* @author alex
|
||||
*/
|
||||
public class CPPInstaller extends AbstractInstaller {
|
||||
|
||||
public CPPInstaller(String version) {
|
||||
super(version);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFeatureName() {
|
||||
return "cpp";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateInstalledVersion(String version) {
|
||||
IPreferenceStore prefs = WPILibCPPPlugin.getDefault().getPreferenceStore();
|
||||
if (prefs.getBoolean(PreferenceConstants.UPDATE_LIBRARY_VERSION)) {
|
||||
System.out.println("Forcing library version to "+version);
|
||||
Properties props = WPILibCore.getDefault().getProjectProperties(null);
|
||||
props.setProperty("cpp-version", version);
|
||||
WPILibCore.getDefault().saveGlobalProperties(props);
|
||||
prefs.setValue(PreferenceConstants.LIBRARY_VERSION, version);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getInstallResourceStream() {
|
||||
return CPPInstaller.class.getResourceAsStream("/resources/cpp.zip");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.launching;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.launch.remote.IRemoteConnectionConfigurationConstants;
|
||||
import org.eclipse.core.internal.resources.Resource;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.core.ILaunchManager;
|
||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||
import org.eclipse.debug.ui.ILaunchShortcut;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
|
||||
/**
|
||||
* Launch shortcut base functionality, common for deploying to the robot.
|
||||
* Retrieves the project the operation is being called on, and runs the correct
|
||||
* ant targets based on polymorphically determined data values
|
||||
*
|
||||
* @author Ryan O'Meara
|
||||
* @author Alex Henning
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class DeployLaunchShortcut implements ILaunchShortcut {
|
||||
//Class constants - used to delineate types for launch shortcuts
|
||||
public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy";
|
||||
private static final String ANT_SERVER_THREAD_NAME = "Ant Build Server Connection";
|
||||
|
||||
private static ILaunch lastDeploy = null;
|
||||
|
||||
/**
|
||||
* Returns the launch type of the shortcut that was used, one of the constants
|
||||
* defined in BaseLaunchShortcut
|
||||
* @return Launch shortcut type
|
||||
*/
|
||||
public String getLaunchType() {return DEPLOY_TYPE;}
|
||||
|
||||
@Override
|
||||
public void launch(ISelection selection, String mode) {
|
||||
//Extract resource from selection
|
||||
StructuredSelection sel = (StructuredSelection)selection;
|
||||
IProject activeProject = null;
|
||||
if (sel.getFirstElement() instanceof IProject) {
|
||||
activeProject = (IProject) sel.getFirstElement();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
//Run config using project found in extracted resource, with indicated mode
|
||||
runConfig(activeProject, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch(IEditorPart editor, String mode) {
|
||||
//Extract resource from editor
|
||||
if(editor != null){
|
||||
IFileEditorInput input = (IFileEditorInput)editor.getEditorInput();
|
||||
IFile file = input.getFile();
|
||||
IProject activeProject = file.getProject();
|
||||
|
||||
//If editor existed, run config using extracted resource in indicated mode
|
||||
runConfig(activeProject, mode);
|
||||
}else{
|
||||
System.err.println("editor was null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile)
|
||||
* @param activeProj The project that the script will be run on/from
|
||||
* @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE)
|
||||
*/
|
||||
public void runConfig(IProject activeProj, String mode){
|
||||
String targets = "deploy";
|
||||
|
||||
if(mode.equals(ILaunchManager.RUN_MODE)){
|
||||
if(getLaunchType().equals(DEPLOY_TYPE)){
|
||||
targets = "deploy";
|
||||
}
|
||||
} else if ((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
|
||||
targets = "debug-deploy";
|
||||
try{
|
||||
PlatformUI.getWorkbench().showPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
|
||||
|
||||
}catch(Exception e){}
|
||||
}
|
||||
|
||||
if((lastDeploy != null)&&(!lastDeploy.isTerminated())){
|
||||
System.out.println("Last deploy running");
|
||||
//Find the server connection thread and kill it
|
||||
Vector<ThreadGroup> threadGroups = new Vector<ThreadGroup>();
|
||||
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
|
||||
while (root.getParent() != null) {root = root.getParent();}
|
||||
threadGroups.add(root);
|
||||
ThreadGroup threadGroup = threadGroups.remove(0);
|
||||
int numThreads = threadGroup.activeCount();
|
||||
Thread[] threads = new Thread[numThreads*100];
|
||||
numThreads = threadGroup.enumerate(threads, true);
|
||||
|
||||
for(Thread current: threads){
|
||||
if(current != null){
|
||||
if(current.getName().equals(ANT_SERVER_THREAD_NAME)){
|
||||
try{
|
||||
//Manually end thread and then try terminating launch
|
||||
Method stopMethod = current.getClass().getMethod("stop");
|
||||
stopMethod.invoke(current);
|
||||
lastDeploy.terminate();
|
||||
break;
|
||||
}catch(Exception e){e.printStackTrace();}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Waiting");
|
||||
try{wait(1000);}catch(Exception e){}
|
||||
|
||||
}
|
||||
|
||||
if (mode.equals(ILaunchManager.RUN_MODE)) {
|
||||
System.out.println("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml");
|
||||
System.out.println("Targets: " + targets + ", Mode: " + mode);
|
||||
lastDeploy = AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), targets, null, mode);
|
||||
} else if((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
|
||||
ILaunchConfigurationWorkingCopy config;
|
||||
try {
|
||||
config = getRemoteDebugConfig(activeProj);
|
||||
//config.doSave(); // NOTE: For debugging
|
||||
startDebugConfig(config, lastDeploy);
|
||||
} catch (CoreException e) {
|
||||
System.err.println("Debug attach failed.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
activeProj.refreshLocal(Resource.DEPTH_INFINITE, null);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
private ILaunchConfigurationWorkingCopy getRemoteDebugConfig(IProject activeProj) throws CoreException {
|
||||
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
|
||||
ILaunchConfigurationType type = manager.getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_REMOTE_APP);
|
||||
int teamNumber = WPILibCore.getDefault().getTeamNumber(activeProj);
|
||||
String remote_connection = RSEUtils.getTarget(teamNumber).getName();
|
||||
|
||||
ILaunchConfigurationWorkingCopy config = type.newInstance(null, "Debug "+activeProj.getName());
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, activeProj.getName());
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "Debug/FRCUserProgram");
|
||||
config.setAttribute(DebugPlugin.getUniqueIdentifier() + ".ATTR_TARGET_PATH", "/home/admin/FRCUserProgram");
|
||||
config.setAttribute("org.eclipse.cdt.debug.mi.core.DEBUG_NAME", WPILibCPPPlugin.getDefault().getToolchain()+"/bin/arm-none-linux-gnueabi-gdb");
|
||||
config.setAttribute("org.eclipse.cdt.dsf.gdb.DEBUG_NAME", WPILibCPPPlugin.getDefault().getToolchain()+"/bin/arm-none-linux-gnueabi-gdb");
|
||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, remote_connection);
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, "org.eclipse.rse.remotecdt.RemoteGDBDebugger");
|
||||
Map<String, String> launchers = new HashMap<String, String>();
|
||||
launchers.put("[debug]", "org.eclipse.rse.remotecdt.launch");
|
||||
config.setAttribute(DebugPlugin.getUniqueIdentifier() + ".preferred_launchers", launchers);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
private void startDebugConfig(final ILaunchConfigurationWorkingCopy config, ILaunch deploy) throws CoreException {
|
||||
config.launch(ILaunchManager.DEBUG_MODE, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.launching;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.PasswordPersistenceManager;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemProfile;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.core.model.SystemSignonInformation;
|
||||
|
||||
public class RSEUtils {
|
||||
|
||||
public static IHost getTarget(int teamNumber) {
|
||||
// The ip address based on the team number
|
||||
String hostName = "10."+(teamNumber/100)+"."+(teamNumber%100)+".2";
|
||||
String connectionName = "Team "+teamNumber;
|
||||
|
||||
// get the singleton RSE registry
|
||||
try {
|
||||
RSECorePlugin.waitForInitCompletion();
|
||||
} catch (InterruptedException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry();
|
||||
|
||||
// get the default profile, used to store connections
|
||||
System.out.println("Profiles: "+Arrays.toString(registry.getActiveSystemProfiles()));
|
||||
ISystemProfile profile = registry.getActiveSystemProfiles()[0];
|
||||
|
||||
// see if a host object already exists for "build.eclipse.org"
|
||||
IHost host = registry.getHost(profile, connectionName);
|
||||
if (host == null) {
|
||||
// if there's no host then we will create it
|
||||
try {
|
||||
// create the host object as an SSH Only connection
|
||||
IRSESystemType systemType =
|
||||
RSECorePlugin.getTheCoreRegistry().getSystemTypeById("org.eclipse.rse.systemtype.ssh");
|
||||
host = registry.createHost(profile.getName(), systemType, connectionName, hostName,
|
||||
"The remote target for debugging the robot for team "+teamNumber+".");
|
||||
host.setDefaultUserId("admin");
|
||||
SystemSignonInformation info = new SystemSignonInformation(hostName, "admin",
|
||||
"XX", systemType);
|
||||
PasswordPersistenceManager.getInstance().add(info, true, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return host;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.preferences;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.preferences.ComboFieldEditor;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
|
||||
/**
|
||||
* This class represents a preference page that
|
||||
* is contributed to the Preferences dialog. By
|
||||
* subclassing <samp>FieldEditorPreferencePage</samp>, we
|
||||
* can use the field support built into JFace that allows
|
||||
* us to create a page that is small and knows how to
|
||||
* save, restore and apply itself.
|
||||
* <p>
|
||||
* This page is used to modify preferences only. They
|
||||
* are stored in the preference store that belongs to
|
||||
* the main plug-in class. That way, preferences can
|
||||
* be accessed directly via the preference store.
|
||||
*/
|
||||
|
||||
public class CPPPreferencePage
|
||||
extends FieldEditorPreferencePage
|
||||
implements IWorkbenchPreferencePage {
|
||||
ComboFieldEditor toolchainVersionEditor;
|
||||
BooleanFieldEditor autoUpdateToolchainEditor;
|
||||
private ComboFieldEditor wpiLibVersionEditor;
|
||||
private BooleanFieldEditor autoUpdateEditor;
|
||||
|
||||
public CPPPreferencePage() {
|
||||
super(GRID);
|
||||
setPreferenceStore(WPILibCPPPlugin.getDefault().getPreferenceStore());
|
||||
setDescription("Change workspace level settings for C++.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the field editors. Field editors are abstractions of
|
||||
* the common GUI blocks needed to manipulate various types
|
||||
* of preferences. Each field editor knows how to save and
|
||||
* restore itself.
|
||||
*/
|
||||
public void createFieldEditors() {
|
||||
wpiLibVersionEditor = new ComboFieldEditor(PreferenceConstants.LIBRARY_VERSION,
|
||||
"&Library Version:", getFieldEditorParent(), getInstalledVersions());
|
||||
addField(wpiLibVersionEditor);
|
||||
autoUpdateEditor = new BooleanFieldEditor(PreferenceConstants.UPDATE_LIBRARY_VERSION,
|
||||
"&Auto Update Library Version", getFieldEditorParent());
|
||||
addField(autoUpdateEditor);
|
||||
toolchainVersionEditor = new ComboFieldEditor(PreferenceConstants.TOOLCHAIN_VERSION,
|
||||
"&Toolchain Version:", getFieldEditorParent(), getInstalledToolchains());
|
||||
addField(toolchainVersionEditor);
|
||||
autoUpdateToolchainEditor = new BooleanFieldEditor(PreferenceConstants.UPDATE_TOOLCHAIN_VERSION,
|
||||
"&Auto Update Toolchain Version", getFieldEditorParent());
|
||||
addField(autoUpdateToolchainEditor);
|
||||
}
|
||||
|
||||
private List<String> getInstalledVersions() {
|
||||
File[] dirs = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"cpp")
|
||||
.listFiles(new FileFilter() {
|
||||
@Override public boolean accept(File f) {
|
||||
return f.isDirectory();
|
||||
}
|
||||
});
|
||||
List<String> versions = new ArrayList<String>();
|
||||
for (File dir : dirs) {
|
||||
versions.add(dir.getName());
|
||||
}
|
||||
Collections.sort(versions);
|
||||
return versions;
|
||||
}
|
||||
|
||||
private List<String> getInstalledToolchains() {
|
||||
File[] dirs = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"toolchains")
|
||||
.listFiles(new FileFilter() {
|
||||
@Override public boolean accept(File f) {
|
||||
return f.isDirectory();
|
||||
}
|
||||
});
|
||||
List<String> versions = new ArrayList<String>();
|
||||
for (File dir : dirs) {
|
||||
versions.add(dir.getName());
|
||||
}
|
||||
Collections.sort(versions);
|
||||
return versions;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
||||
*/
|
||||
public void init(IWorkbench workbench) {
|
||||
System.out.println("Preferences initialized.");
|
||||
Properties props = WPILibCore.getDefault().getProjectProperties(null);
|
||||
getPreferenceStore().setValue(PreferenceConstants.LIBRARY_VERSION,
|
||||
props.getProperty("cpp-version", WPILibCPPPlugin.getDefault().getCurrentVersion()));
|
||||
}
|
||||
|
||||
@Override public void performApply() {
|
||||
performOk();
|
||||
}
|
||||
|
||||
@Override public boolean performOk() {
|
||||
Properties props = WPILibCore.getDefault().getProjectProperties(null);
|
||||
props.setProperty("cpp-version", wpiLibVersionEditor.getChoice());
|
||||
WPILibCore.getDefault().saveGlobalProperties(props);
|
||||
return super.performOk();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.preferences;
|
||||
|
||||
/**
|
||||
* Constant definitions for plug-in preferences
|
||||
*/
|
||||
public class PreferenceConstants {
|
||||
public static final String LIBRARY_VERSION = "libraryVersionPreference";
|
||||
public static final String UPDATE_LIBRARY_VERSION = "udpateLibraryVersionPreference";
|
||||
public static final String TOOLCHAIN_VERSION = "toolchainVersionPreference";
|
||||
public static final String UPDATE_TOOLCHAIN_VERSION = "udpateToolchainVersionPreference";
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.preferences;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
|
||||
/**
|
||||
* Class used to initialize default preference values.
|
||||
*/
|
||||
public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
|
||||
*/
|
||||
public void initializeDefaultPreferences() {
|
||||
IPreferenceStore store = WPILibCPPPlugin.getDefault().getPreferenceStore();
|
||||
store.setDefault(PreferenceConstants.LIBRARY_VERSION,
|
||||
WPILibCore.getDefault().getProjectProperties(null)
|
||||
.getProperty("cpp-version", WPILibCPPPlugin.getDefault().getCurrentVersion()));
|
||||
store.setDefault(PreferenceConstants.UPDATE_LIBRARY_VERSION, true);
|
||||
store.setDefault(PreferenceConstants.TOOLCHAIN_VERSION, WPILibCPPPlugin.getDefault().getDefaultToolchainVersion());
|
||||
store.setDefault(PreferenceConstants.UPDATE_TOOLCHAIN_VERSION, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.examples;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.CPPProjectType;
|
||||
|
||||
public class ExampleCPPProject extends CPPProjectType implements IExampleProject {
|
||||
private String name, description;
|
||||
private List<String> tags;
|
||||
private List<String> directories;
|
||||
private List<ExportFile> files;
|
||||
|
||||
public ExampleCPPProject(String name, String description, List<String> tags,
|
||||
List<String> directories, List<ExportFile> files) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.tags = tags;
|
||||
this.directories = directories;
|
||||
this.files = files;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return "<h1>"+name+"</h1><p>"+description+"</p>";
|
||||
}
|
||||
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFolders(String packageName) {
|
||||
return directories.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getFiles(String packageName) {
|
||||
Map<String, String> files = super.getFiles(packageName);
|
||||
for (ExportFile file : this.files) {
|
||||
files.put(file.destination, file.source);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.examples;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ExampleWizard;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject.ExportFile;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.WPIRobotCPPProjectCreator;
|
||||
|
||||
public class ExampleCPPWizard extends ExampleWizard {
|
||||
private NewProjectMainPage detailsPage;
|
||||
|
||||
/**
|
||||
* Constructor for SampleNewWizard.
|
||||
*/
|
||||
public ExampleCPPWizard() {
|
||||
super();
|
||||
setNeedsProgressMonitor(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFinish(IExampleProject ex, String teamNumber) throws CoreException {
|
||||
Properties props = WPILibCore.getDefault().getProjectProperties(null);
|
||||
props.setProperty("team-number", teamNumber);
|
||||
WPILibCore.getDefault().saveGlobalProperties(props);
|
||||
|
||||
final String projectName = detailsPage.getProjectName();
|
||||
ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, ex));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IWizardPage getDetailsPage() {
|
||||
if (detailsPage != null) return detailsPage;
|
||||
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage());
|
||||
detailsPage.setTitle("Create Example Robot Java Project");
|
||||
detailsPage.setDescription("This wizard creates a new example project based on your selection.");
|
||||
detailsPage.setShowPackage(false);
|
||||
return detailsPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExampleProject makeExampleProject(String name, String description,
|
||||
List<String> tags, List<String> folders, List<ExportFile> files) {
|
||||
return new ExampleCPPProject(name, description, tags, folders, files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResourceURL() {
|
||||
return WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/examples");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXMLFile() {
|
||||
return "examples.xml";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template;
|
||||
|
||||
public class CommandGroupWizard extends FileTemplateWizard {
|
||||
|
||||
public CommandGroupWizard() {
|
||||
super("CommandGroup", "command-based/CommandGroup", "Commands");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template;
|
||||
|
||||
public class CommandWizard extends FileTemplateWizard {
|
||||
|
||||
public CommandWizard() {
|
||||
super("Command", "command-based/Command", "Commands");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.core.model.ISourceRoot;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.wizard.Wizard;
|
||||
import org.eclipse.ui.INewWizard;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchWizard;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
|
||||
public class FileTemplateWizard extends Wizard implements INewWizard {
|
||||
private String type, source, ending;
|
||||
private FileTemplateWizardMainPage page;
|
||||
private ISelection selection;
|
||||
private IProject project;
|
||||
|
||||
/**
|
||||
* Constructor for SampleNewWizard.
|
||||
*/
|
||||
public FileTemplateWizard(String type, String source, String ending) {
|
||||
super();
|
||||
setNeedsProgressMonitor(true);
|
||||
this.type = type;
|
||||
this.source = source;
|
||||
this.ending = ending;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding the page to the wizard.
|
||||
*/
|
||||
|
||||
public void addPages() {
|
||||
page = new FileTemplateWizardMainPage(type, project, ending, selection);
|
||||
addPage(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when 'Finish' button is pressed in
|
||||
* the wizard. We will create an operation and run it
|
||||
* using wizard as execution context.
|
||||
*/
|
||||
public boolean performFinish() {
|
||||
final IProject project = page.getProject();
|
||||
final String className = page.getClassName();
|
||||
final String folderName = page.getFolder();
|
||||
System.out.println("Class: "+className+" Folder: "+folderName);
|
||||
IRunnableWithProgress op = new IRunnableWithProgress() {
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException {
|
||||
try {
|
||||
doFinish(project, className, folderName, monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
getContainer().run(true, false, op);
|
||||
} catch (InterruptedException e) {
|
||||
return false;
|
||||
} catch (InvocationTargetException e) {
|
||||
Throwable realException = e.getTargetException();
|
||||
MessageDialog.openError(getShell(), "Error", realException.getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The worker method. It will find the container, create the
|
||||
* file if missing or just replace its contents, and open
|
||||
* the editor on the newly created file.
|
||||
*/
|
||||
private void doFinish(IProject project, String className, String folderName, IProgressMonitor monitor) throws CoreException {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("$classname", className);
|
||||
map.put("$folder", folderName);
|
||||
String filepath = folderName+File.separator+className;
|
||||
try {
|
||||
// Create Header
|
||||
URL url = new URL(WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/"), source+".h");
|
||||
ProjectCreationUtils.createTemplateFile(project, filepath+".h", url, map);
|
||||
|
||||
// Create CPP file
|
||||
url = new URL(WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/"), source+".cpp");
|
||||
ProjectCreationUtils.createTemplateFile(project, filepath+".cpp", url, map);
|
||||
} catch (MalformedURLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We will accept the selection in the workbench to see if
|
||||
* we can initialize from it.
|
||||
* @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
|
||||
*/
|
||||
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
||||
this.selection = selection;
|
||||
System.out.println(selection);
|
||||
Object element = ((StructuredSelection) selection).getFirstElement();
|
||||
System.out.println(element.getClass());
|
||||
if (element instanceof IResource) {
|
||||
project = ((IResource) element).getProject();
|
||||
} else if (element instanceof ISourceRoot) {
|
||||
project = ((ISourceRoot) element).getCProject().getProject();
|
||||
} else if (element instanceof ITranslationUnit) {
|
||||
project = ((ITranslationUnit) element).getCProject().getProject();
|
||||
} else if (element instanceof ISourceRoot) {
|
||||
project = ((ISourceRoot) element).getCProject().getProject();
|
||||
} else if (element instanceof ICContainer) {
|
||||
project = ((ICContainer) element).getCProject().getProject();
|
||||
} else System.out.println("Element not instance of IResource: "+element.getClass());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.cdt.core.CCProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.dialogs.IDialogPage;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.wizard.WizardPage;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IProjectFilter;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectComboField;
|
||||
|
||||
/**
|
||||
* The "New" wizard page allows setting the container for the new file as well
|
||||
* as the file name. The page will only accept file name without the extension
|
||||
* OR with the extension that matches the expected one (mpe).
|
||||
*/
|
||||
|
||||
public class FileTemplateWizardMainPage extends WizardPage {
|
||||
private IProject project;
|
||||
private String ending;
|
||||
private ProjectComboField projectsCombo;
|
||||
private Text classNameText;
|
||||
private Text folderText;
|
||||
|
||||
/**
|
||||
* Constructor for SampleNewWizardPage.
|
||||
*
|
||||
* @param pageName
|
||||
*/
|
||||
public FileTemplateWizardMainPage(String type, IProject project, String ending, ISelection selection) {
|
||||
super("wizardPage");
|
||||
setTitle("Create New "+type);
|
||||
setDescription("This wizard creates a new "+type.toLowerCase()+" from a template.");
|
||||
this.project = project;
|
||||
this.ending = ending;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDialogPage#createControl(Composite)
|
||||
*/
|
||||
public void createControl(Composite parent) {
|
||||
Composite container = new Composite(parent, SWT.NULL);
|
||||
GridLayout layout = new GridLayout();
|
||||
container.setLayout(layout);
|
||||
layout.numColumns = 2;
|
||||
layout.verticalSpacing = 9;
|
||||
|
||||
Label label = new Label(container, SWT.NULL);
|
||||
label.setText("Pro&ject:");
|
||||
|
||||
projectsCombo = new ProjectComboField(container, SWT.BORDER | SWT.SINGLE,
|
||||
new IProjectFilter() {
|
||||
@Override public boolean accept(IProject project) {
|
||||
try {
|
||||
return project.hasNature(FRCProjectNature.FRC_PROJECT_NATURE)
|
||||
&& project.hasNature(CCProjectNature.C_NATURE_ID);
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
projectsCombo.setLayoutData(gd);
|
||||
projectsCombo.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
dialogChanged();
|
||||
}
|
||||
});
|
||||
|
||||
label = new Label(container, SWT.NULL);
|
||||
label.setText("Class &Name:");
|
||||
|
||||
classNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
classNameText.setLayoutData(gd);
|
||||
classNameText.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
dialogChanged();
|
||||
}
|
||||
});
|
||||
|
||||
label = new Label(container, SWT.NULL);
|
||||
label.setText("&Folder:");
|
||||
|
||||
folderText = new Text(container, SWT.BORDER | SWT.SINGLE);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
folderText.setLayoutData(gd);
|
||||
folderText.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
dialogChanged();
|
||||
}
|
||||
});
|
||||
|
||||
initialize();
|
||||
dialogChanged();
|
||||
setControl(container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the current workbench selection is a suitable container to use.
|
||||
*/
|
||||
|
||||
private void initialize() {
|
||||
projectsCombo.setProject(project);
|
||||
folderText.setText(getDefaultFolder());
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that both text fields are set.
|
||||
*/
|
||||
|
||||
private void dialogChanged() {
|
||||
String className = getClassName();
|
||||
String folder = getFolder();
|
||||
|
||||
// Update the default package if necessary
|
||||
if (project == null || !project.equals(projectsCombo.getProject())) {
|
||||
String oldDefault = getDefaultFolder();
|
||||
project = projectsCombo.getProject();
|
||||
if (folder.equals(oldDefault)) {
|
||||
folderText.setText(getDefaultFolder());
|
||||
}
|
||||
}
|
||||
|
||||
if (!projectsCombo.isValid()) {
|
||||
updateStatus("Must select a project.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (className.length() == 0) {
|
||||
updateStatus("Class name must be specified");
|
||||
return;
|
||||
}
|
||||
if (!className.matches("^([a-zA-Z_]{1}[a-zA-Z0-9_]*)$")) {
|
||||
updateStatus("Must be a valid java class name");
|
||||
return;
|
||||
}
|
||||
if (folder.length() == 0) {
|
||||
updateStatus("Package must be specified");
|
||||
return;
|
||||
}
|
||||
updateStatus(null);
|
||||
}
|
||||
|
||||
private void updateStatus(String message) {
|
||||
setErrorMessage(message);
|
||||
setPageComplete(message == null);
|
||||
}
|
||||
|
||||
public IProject getProject() {
|
||||
return projectsCombo.getProject();
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return classNameText.getText();
|
||||
}
|
||||
|
||||
public String getFolder() {
|
||||
return folderText.getText();
|
||||
}
|
||||
|
||||
public String getDefaultFolder() {
|
||||
System.out.println("Project: "+project);
|
||||
return "src"+File.separator+ending;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template;
|
||||
|
||||
public class PIDSubsystemWizard extends FileTemplateWizard {
|
||||
|
||||
public PIDSubsystemWizard() {
|
||||
super("PIDSubsystem", "command-based/PIDSubsystem", "Subsystems");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template;
|
||||
|
||||
public class SubsystemWizard extends FileTemplateWizard {
|
||||
|
||||
public SubsystemWizard() {
|
||||
super("Subsystem", "command-based/Subsystem", "Subsystems");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template;
|
||||
|
||||
public class TriggerWizard extends FileTemplateWizard {
|
||||
|
||||
public TriggerWizard() {
|
||||
super("Trigger", "command-based/Trigger", "Triggers");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.newproject;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
|
||||
public class CPPProjectType implements ProjectType {
|
||||
static ProjectType SIMPLE = new CPPProjectType() {
|
||||
@Override public Map<String, String> getFiles(String packageName) {
|
||||
Map<String, String> files = super.getFiles(packageName);
|
||||
files.put("src/Robot.cpp", "simple/Robot.cpp");
|
||||
return files;
|
||||
}
|
||||
};
|
||||
static ProjectType ITERATIVE = new CPPProjectType() {
|
||||
@Override public Map<String, String> getFiles(String packageName) {
|
||||
Map<String, String> files = super.getFiles(packageName);
|
||||
files.put("src/Robot.cpp", "iterative/Robot.cpp");
|
||||
return files;
|
||||
}
|
||||
};
|
||||
static ProjectType COMMAND_BASED = new CPPProjectType() {
|
||||
@Override public String[] getFolders(String packageName) {
|
||||
String[] paths = {"src",
|
||||
"src/Commands",
|
||||
"src/Subsystems",
|
||||
"src/Triggers"};
|
||||
return paths;
|
||||
}
|
||||
@Override public Map<String, String> getFiles(String packageName) {
|
||||
Map<String, String> files = super.getFiles(packageName);
|
||||
files.put("src/Robot.cpp", "command-based/Robot.cpp");
|
||||
files.put("src/OI.h", "command-based/OI.h");
|
||||
files.put("src/OI.cpp", "command-based/OI.cpp");
|
||||
files.put("src/RobotMap.h", "command-based/RobotMap.h");
|
||||
files.put("src/CommandBase.cpp", "command-based/CommandBase.cpp");
|
||||
files.put("src/CommandBase.h", "command-based/CommandBase.h");
|
||||
files.put("src/Subsystems/ExampleSubsystem.h", "command-based/ExampleSubsystem.h");
|
||||
files.put("src/Subsystems/ExampleSubsystem.cpp", "command-based/ExampleSubsystem.cpp");
|
||||
files.put("src/Commands/ExampleCommand.h", "command-based/ExampleCommand.h");
|
||||
files.put("src/Commands/ExampleCommand.cpp", "command-based/ExampleCommand.cpp");
|
||||
return files;
|
||||
}
|
||||
};
|
||||
@SuppressWarnings("serial")
|
||||
static Map<String, ProjectType> TYPES = new HashMap<String, ProjectType>() {{
|
||||
put(ProjectType.SIMPLE, SIMPLE);
|
||||
put(ProjectType.ITERATIVE, ITERATIVE);
|
||||
put(ProjectType.COMMAND_BASED, COMMAND_BASED);
|
||||
}};
|
||||
|
||||
@Override
|
||||
public String[] getFolders(String packageName) {
|
||||
String[] paths = {"src"};
|
||||
return paths;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getFiles(String packageName) {
|
||||
HashMap<String, String> files = new HashMap<String, String>();
|
||||
files.put("build.xml", "build.xml");
|
||||
files.put("build.properties", "build.properties");
|
||||
files.put(".cproject", ".cproject");
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public URL getBaseURL() {
|
||||
return WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.newproject;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.wizard.Wizard;
|
||||
import org.eclipse.ui.INewWizard;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchWizard;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.TeamNumberPage;
|
||||
|
||||
/**
|
||||
*
|
||||
* Example Docs:
|
||||
* This is a sample new wizard. Its role is to create a new file
|
||||
* resource in the provided container. If the container resource
|
||||
* (a folder or a project) is selected in the workspace
|
||||
* when the wizard is opened, it will accept it as the target
|
||||
* container. The wizard creates one file with the extension
|
||||
* "mpe". If a sample multi-page editor (also available
|
||||
* as a template) is registered for the same extension, it will
|
||||
* be able to open it.
|
||||
*/
|
||||
|
||||
public class NewCPPWizard extends Wizard implements INewWizard {
|
||||
private NewProjectMainPage page;
|
||||
private ISelection selection;
|
||||
private TeamNumberPage teamNumberPage;
|
||||
|
||||
/**
|
||||
* Constructor for SampleNewWizard.
|
||||
*/
|
||||
public NewCPPWizard() {
|
||||
super();
|
||||
setNeedsProgressMonitor(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding the page to the wizard.
|
||||
*/
|
||||
|
||||
public void addPages() {
|
||||
if (TeamNumberPage.needsTeamNumberPage()) {
|
||||
teamNumberPage = new TeamNumberPage(selection);
|
||||
addPage(teamNumberPage);
|
||||
}
|
||||
page = new NewProjectMainPage(selection, teamNumberPage);
|
||||
page.setTitle("Create New Robot C++ Project");
|
||||
page.setDescription("This wizard creates a new Robot C++ Project configured to use WPILib for programming FRC robots.");
|
||||
page.setShowPackage(false);
|
||||
page.setProjectTypes(CPPProjectType.TYPES);
|
||||
addPage(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when 'Finish' button is pressed in
|
||||
* the wizard. We will create an operation and run it
|
||||
* using wizard as execution context.
|
||||
*/
|
||||
public boolean performFinish() {
|
||||
final String projectName = page.getProjectName();
|
||||
final String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
|
||||
final ProjectType projectType = page.getProjectType();
|
||||
System.out.println("Project: "+projectName+" Project Type: "+projectType);
|
||||
IRunnableWithProgress op = new IRunnableWithProgress() {
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException {
|
||||
try {
|
||||
doFinish(projectName, teamNumber, projectType, monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
getContainer().run(true, false, op);
|
||||
} catch (InterruptedException e) {
|
||||
return false;
|
||||
} catch (InvocationTargetException e) {
|
||||
Throwable realException = e.getTargetException();
|
||||
MessageDialog.openError(getShell(), "Error", realException.getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The worker method. It will find the container, create the
|
||||
* file if missing or just replace its contents, and open
|
||||
* the editor on the newly created file.
|
||||
*/
|
||||
|
||||
private void doFinish(String projectName, String teamNumber, ProjectType projectType, IProgressMonitor monitor) throws CoreException {
|
||||
Properties props = WPILibCore.getDefault().getProjectProperties(null);
|
||||
props.setProperty("team-number", teamNumber);
|
||||
WPILibCore.getDefault().saveGlobalProperties(props);
|
||||
ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, projectType));
|
||||
}
|
||||
|
||||
/**
|
||||
* We will accept the selection in the workbench to see if
|
||||
* we can initialize from it.
|
||||
* @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
|
||||
*/
|
||||
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
||||
this.selection = selection;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package edu.wpi.first.wpilib.plugins.cpp.wizards.newproject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.build.core.scannerconfig.ScannerConfigNature;
|
||||
import org.eclipse.cdt.core.CCProjectNature;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.index.IIndexManager;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IProjectCreator;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
|
||||
public class WPIRobotCPPProjectCreator implements IProjectCreator {
|
||||
String projectName;
|
||||
ProjectType projectType;
|
||||
|
||||
public WPIRobotCPPProjectCreator(String projectName, ProjectType projectType) {
|
||||
this.projectName = projectName;
|
||||
this.projectType = projectType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPackageName() {
|
||||
return ""; // C++ doesn't have the equivalent of a project name
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getValues() {
|
||||
Map<String, String> vals = new HashMap<String, String>();
|
||||
vals.put("$project", projectName);
|
||||
vals.put("$toolchain", WPILibCPPPlugin.getDefault().getToolchain());
|
||||
vals.put("$cpp-location", WPILibCPPPlugin.getDefault().getCPPDir());
|
||||
return vals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNatures() {
|
||||
List<String> natures = new ArrayList<>();
|
||||
natures.add(CCProjectNature.C_NATURE_ID);
|
||||
natures.add(CCProjectNature.CC_NATURE_ID);
|
||||
natures.add(ManagedCProjectNature.MNG_NATURE_ID);
|
||||
natures.add(ScannerConfigNature.NATURE_ID);
|
||||
natures.add(FRCProjectNature.FRC_PROJECT_NATURE);
|
||||
return natures;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectType getProjectType() {
|
||||
return projectType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(IProject project) {
|
||||
try {
|
||||
CCorePlugin.getDefault().createCDTProject(project.getDescription(), project, null);
|
||||
project.open(null);
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//config.getToolChain().getOptionById("cdt.managedbuild.option.gnu.cross.prefix").setValue(prefix);
|
||||
//config.getToolChain().getOptionById("cdt.managedbuild.option.gnu.cross.path").setValue(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalize(IProject project) throws CoreException {
|
||||
updateVariables(project);
|
||||
|
||||
// Freshen the index because otherwise it's red and angry
|
||||
ICElement[] projects = {CCorePlugin.getDefault().getCoreModel().create(project)};
|
||||
CCorePlugin.getIndexManager().update(projects, IIndexManager.UPDATE_ALL | IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT);
|
||||
}
|
||||
|
||||
private void updateVariables(IProject project) throws CoreException {
|
||||
// TODO: implement C++ equivalent
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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">
|
||||
<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="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="1.7" -->
|
||||
<!-- source="1.7" -->
|
||||
<!-- debug="true"> -->
|
||||
<!-- </javac> -->
|
||||
<!-- </target> -->
|
||||
|
||||
<!-- <target name="jar" depends="compile"> -->
|
||||
<!-- <echo>[athena-jar] Making jar ${dist.jar}.</echo> -->
|
||||
<!-- <mkdir dir="${dist.dir}" /> -->
|
||||
<!-- <jar destfile="${dist.jar}" update="false"> -->
|
||||
<!-- <manifest> -->
|
||||
<!-- <attribute name="Main-Class" value="${main}"/> -->
|
||||
<!-- <attribute name="Class-Path" value="."/> -->
|
||||
<!-- </manifest> -->
|
||||
|
||||
<!-- <fileset dir="${build.dir}" includes="**"/> -->
|
||||
|
||||
<!-- <zipgroupfileset file="${networktables.jar}" /> -->
|
||||
<!-- </jar> -->
|
||||
<!-- </target> -->
|
||||
|
||||
<target name="deploy" depends="get-target-ip" description="Deploy the progam and start it running.">
|
||||
<echo>[athena-deploy] Killing running program</echo>
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
command="killall FRCUserProgram; sleep 1"/>
|
||||
<echo>[athena-deploy] Copying code over.</echo>
|
||||
<scp file="${out.exe}" todir="${username}@${target}:${deploy.dir}"
|
||||
password="${password}" trust="true"/>
|
||||
<scp file="${wpilib.ant.dir}/runcppprogram" todir="${username}@${target}:${deploy.dir}"
|
||||
password="${password}" trust="true"/>
|
||||
<scp file="${wpilib.ant.dir}/runjavaprogram" todir="${username}@${target}:${deploy.dir}"
|
||||
password="${password}" trust="true"/>
|
||||
<echo>[athena-deploy] Starting program.</echo>
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
command="chmod a+x run*program; ${deploy.run.command}"/>
|
||||
</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>
|
||||
@@ -0,0 +1,6 @@
|
||||
#. ./.profile
|
||||
killall java
|
||||
sleep 1
|
||||
nohup java -Djna.library.path=$LD_LIBRARY_PATH -Xmx32M -agentlib:jdwp=transport=dt_socket,address=8348,server=y,suspend=y -jar FRCUserProgram.jar edu.wpi.first.wpilibj.unittests.RunTests
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#. ./.profile
|
||||
killall java
|
||||
killall FRCUserProgram
|
||||
sleep 1
|
||||
chmod +x ./FRCUserProgram
|
||||
nohup ./FRCUserProgram
|
||||
@@ -0,0 +1,5 @@
|
||||
#. ./.profile
|
||||
killall java
|
||||
killall FRCUserProgram
|
||||
sleep 1
|
||||
nohup java -Djna.library.path=$LD_LIBRARY_PATH -Xmx32M -jar FRCUserProgram.jar
|
||||