Rename our allwpilib (which is now 2020) to not have 2019 in the name
Change-Id: I3c07f85ed32ab8b97db765a9b43f2a6ce7da964a
diff --git a/myRobot/CMakeLists.txt b/myRobot/CMakeLists.txt
new file mode 100644
index 0000000..fd9fba6
--- /dev/null
+++ b/myRobot/CMakeLists.txt
@@ -0,0 +1,8 @@
+project(myRobot)
+
+include(CompileWarnings)
+
+file(GLOB myRobotCpp_src src/main/native/cpp/*.cpp)
+
+add_executable(myRobotCpp ${myRobotCpp_src})
+target_link_libraries(myRobotCpp wpilibc)
diff --git a/myRobot/build.gradle b/myRobot/build.gradle
new file mode 100644
index 0000000..d2f1194
--- /dev/null
+++ b/myRobot/build.gradle
@@ -0,0 +1,237 @@
+import jaci.gradle.toolchains.*
+import jaci.gradle.nativedeps.*
+
+plugins {
+ id 'java'
+ id 'application'
+ id 'cpp'
+ id 'visual-studio'
+}
+
+apply plugin: 'edu.wpi.first.NativeUtils'
+apply plugin: 'jaci.gradle.EmbeddedTools'
+
+apply from: '../shared/config.gradle'
+
+ext {
+ sharedCvConfigs = [myRobotCpp: []]
+ staticCvConfigs = [myRobotCppStatic: []]
+ useJava = true
+ useCpp = true
+ skipDev = true
+}
+
+apply from: "${rootDir}/shared/opencv.gradle"
+
+deploy {
+ targets {
+ target('roborio') {
+ directory = '/home/admin'
+ maxChannels = 4
+ locations {
+ ssh {
+ address = "172.22.11.2"
+ user = 'admin'
+ password = ''
+ ipv6 = false
+ }
+ }
+ }
+ }
+ artifacts {
+ all {
+ targets << 'roborio'
+ predeploy << { ctx ->
+ ctx.execute('/usr/local/frc/bin/frcKillRobot.sh -t')
+ }
+ postdeploy << { ctx ->
+ ctx.execute("sync")
+ ctx.execute("ldconfig")
+ }
+ }
+
+ artifact('jre', JREArtifact) {
+ jreDependency = 'edu.wpi.first.jdk:roborio-2020:11.0.4u10-2'
+ }
+
+ javaArtifact('myRobotJava') {
+ jar = 'shadowJar'
+ postdeploy << { ctx ->
+ ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseConcMarkSweepGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/admin/myRobot-all.jar' > /home/admin/myRobotJavaRun")
+ ctx.execute("chmod +x /home/admin/myRobotJavaRun; chown lvuser /home/admin/myRobotJavaRun")
+ }
+ }
+
+ nativeArtifact('myRobotCpp') {
+ component = 'myRobotCpp'
+ targetPlatform = nativeUtils.wpi.platforms.roborio
+ libraryDirectory = '/usr/local/frc/third-party/lib'
+ buildType = 'debug'
+ postdeploy << { ctx ->
+ ctx.execute('chmod +x myRobotCpp')
+ }
+
+ }
+
+ nativeArtifact('myRobotCppStatic') {
+ component = 'myRobotCppStatic'
+ targetPlatform = nativeUtils.wpi.platforms.roborio
+ buildType = 'debug'
+
+ postdeploy << { ctx ->
+ ctx.execute('chmod +x myRobotCppStatic')
+ }
+ }
+ }
+}
+
+tasks.register('deployJava') {
+ try {
+ dependsOn tasks.named('deployJreRoborio')
+ dependsOn tasks.named('deployMyRobotJavaRoborio')
+ dependsOn tasks.named('deployMyRobotCppLibrariesRoborio')
+ } catch (ignored) {
+ }
+}
+
+tasks.register('deployShared') {
+ try {
+ dependsOn tasks.named('deployMyRobotCppLibrariesRoborio')
+ dependsOn tasks.named('deployMyRobotCppRoborio')
+ } catch (ignored) {
+ }
+}
+
+tasks.register('deployStatic') {
+ try {
+ dependsOn tasks.named('deployMyRobotCppStaticRoborio')
+ } catch (ignored) {
+ }
+}
+
+mainClassName = 'Main'
+
+apply plugin: 'com.github.johnrengelman.shadow'
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation project(':wpilibj')
+ implementation project(':hal')
+ implementation project(':wpiutil')
+ implementation project(':ntcore')
+ implementation project(':cscore')
+ implementation project(':cameraserver')
+ implementation project(':wpilibOldCommands')
+ implementation project(':wpilibNewCommands')
+}
+
+model {
+ components {
+ myRobotCpp(NativeExecutableSpec) {
+ targetBuildTypes 'debug'
+ sources {
+ cpp {
+ source {
+ srcDirs = ['src/main/native/cpp']
+ includes = ['**/*.cpp']
+ }
+ exportedHeaders {
+ srcDirs = ['src/main/native/include']
+ includes = ['**/*.h']
+ }
+ }
+ }
+ binaries.all { binary ->
+ lib project: ':wpilibOldCommands', library: 'wpilibOldCommands', linkage: 'shared'
+ lib project: ':wpilibNewCommands', library: 'wpilibNewCommands', linkage: 'shared'
+ lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
+ lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
+ lib project: ':cscore', library: 'cscore', linkage: 'shared'
+ lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared'
+ lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared'
+ project(':hal').addHalDependency(binary, 'shared')
+ project(':hal').addHalJniDependency(binary)
+ lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
+ lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
+ if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
+ nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared')
+ }
+ }
+ }
+ myRobotCppStatic(NativeExecutableSpec) {
+ targetBuildTypes 'debug'
+ nativeUtils.excludeBinariesFromStrip(it)
+ sources {
+ cpp {
+ source {
+ srcDirs = ['src/main/native/cpp']
+ includes = ['**/*.cpp']
+ }
+ exportedHeaders {
+ srcDirs = ['src/main/native/include']
+ includes = ['**/*.h']
+ }
+ }
+ }
+ binaries.all { binary ->
+ lib project: ':wpilibOldCommands', library: 'wpilibOldCommands', linkage: 'static'
+ lib project: ':wpilibNewCommands', library: 'wpilibNewCommands', linkage: 'static'
+ lib project: ':wpilibc', library: 'wpilibc', linkage: 'static'
+ lib project: ':ntcore', library: 'ntcore', linkage: 'static'
+ lib project: ':cscore', library: 'cscore', linkage: 'static'
+ project(':hal').addHalDependency(binary, 'static')
+ lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
+ lib project: ':cameraserver', library: 'cameraserver', linkage: 'static'
+ if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
+ nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared')
+ }
+ }
+ }
+ }
+ tasks {
+ def c = $.components
+ project.tasks.create('runCpp', Exec) {
+ group = 'WPILib'
+ description = "Run the myRobotCpp executable"
+ def found = false
+ def systemArch = getCurrentArch()
+ c.each {
+ if (it in NativeExecutableSpec && it.name == "myRobotCpp") {
+ it.binaries.each {
+ if (!found) {
+ def arch = it.targetPlatform.name
+ if (arch == systemArch) {
+ dependsOn it.tasks.install
+ commandLine it.tasks.install.runScriptFile.get().asFile.toString()
+ def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
+ run.dependsOn it.tasks.install
+ run.systemProperty 'java.library.path', filePath
+ run.environment 'LD_LIBRARY_PATH', filePath
+ run.workingDir filePath
+
+ found = true
+ }
+ }
+ }
+ }
+ }
+ }
+ installAthena(Task) {
+ $.binaries.each {
+ if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'myRobotCpp') {
+ dependsOn it.tasks.install
+ }
+ }
+ }
+ installAthenaStatic(Task) {
+ $.binaries.each {
+ if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'myRobotCppStatic') {
+ dependsOn it.tasks.install
+ }
+ }
+ }
+ }
+}
diff --git a/myRobot/src/main/java/Main.java b/myRobot/src/main/java/Main.java
new file mode 100644
index 0000000..aee472a
--- /dev/null
+++ b/myRobot/src/main/java/Main.java
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+import edu.wpi.first.wpilibj.RobotBase;
+
+public final class Main {
+ private Main() {
+ }
+
+ /**
+ * Main initialization function. Do not perform any initialization here.
+ *
+ * <p>If you change your main robot class, change the parameter type.
+ */
+ public static void main(String... args) {
+ RobotBase.startRobot(MyRobot::new);
+ }
+}
diff --git a/myRobot/src/main/java/MyRobot.java b/myRobot/src/main/java/MyRobot.java
new file mode 100644
index 0000000..fc69d42
--- /dev/null
+++ b/myRobot/src/main/java/MyRobot.java
@@ -0,0 +1,54 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+import edu.wpi.first.wpilibj.TimedRobot;
+
+@SuppressWarnings("all")
+public class MyRobot extends TimedRobot {
+ /**
+ * This function is run when the robot is first started up and should be
+ * used for any initialization code.
+ */
+ @Override
+ public void robotInit() {}
+
+ /**
+ * This function is run once each time the robot enters autonomous mode
+ */
+ @Override
+ public void autonomousInit() {}
+
+ /**
+ * This function is called periodically during autonomous
+ */
+ @Override
+ public void autonomousPeriodic() {}
+
+ /**
+ * This function is called once each time the robot enters tele-operated mode
+ */
+ @Override
+ public void teleopInit() {}
+
+ /**
+ * This function is called periodically during operator control
+ */
+ @Override
+ public void teleopPeriodic() {}
+
+ /**
+ * This function is called periodically during test mode
+ */
+ @Override
+ public void testPeriodic() {}
+
+ /**
+ * This function is called periodically during all modes
+ */
+ @Override
+ public void robotPeriodic() {}
+}
diff --git a/myRobot/src/main/native/cpp/MyRobot.cpp b/myRobot/src/main/native/cpp/MyRobot.cpp
new file mode 100644
index 0000000..79c6e9f
--- /dev/null
+++ b/myRobot/src/main/native/cpp/MyRobot.cpp
@@ -0,0 +1,48 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include <frc/TimedRobot.h>
+
+class MyRobot : public frc::TimedRobot {
+ /**
+ * This function is run when the robot is first started up and should be
+ * used for any initialization code.
+ */
+ void RobotInit() override {}
+
+ /**
+ * This function is run once each time the robot enters autonomous mode
+ */
+ void AutonomousInit() override {}
+
+ /**
+ * This function is called periodically during autonomous
+ */
+ void AutonomousPeriodic() override {}
+
+ /**
+ * This function is called once each time the robot enters tele-operated mode
+ */
+ void TeleopInit() override {}
+
+ /**
+ * This function is called periodically during operator control
+ */
+ void TeleopPeriodic() override {}
+
+ /**
+ * This function is called periodically during test mode
+ */
+ void TestPeriodic() override {}
+
+ /**
+ * This function is called periodically during all modes
+ */
+ void RobotPeriodic() override {}
+};
+
+int main() { return frc::StartRobot<MyRobot>(); }