diff --git a/vscode-wpilib/resources/gradle/cppxrp/.vscode/settings.json b/vscode-wpilib/resources/gradle/cppxrp/.vscode/settings.json new file mode 100644 index 00000000..7f9c47e5 --- /dev/null +++ b/vscode-wpilib/resources/gradle/cppxrp/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + "java.configuration.updateBuildConfiguration": "disabled", + "java.import.gradle.enabled": false, + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "bin/": true, + "**/.classpath": true, + "**/.project": true, + "**/.settings": true, + "**/.factorypath": true, + "**/*~": true + }, + "C_Cpp.default.configurationProvider": "vscode-wpilib", + "wpilib.skipSelectSimulateExtension": true +} diff --git a/vscode-wpilib/resources/gradle/cppxrp/.wpilib/wpilib_preferences.json b/vscode-wpilib/resources/gradle/cppxrp/.wpilib/wpilib_preferences.json new file mode 100644 index 00000000..b220068b --- /dev/null +++ b/vscode-wpilib/resources/gradle/cppxrp/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": true, + "currentLanguage": "cpp", + "projectYear": "2023", + "teamNumber": -1 +} diff --git a/vscode-wpilib/resources/gradle/cppxrp/build.gradle b/vscode-wpilib/resources/gradle/cppxrp/build.gradle new file mode 100644 index 00000000..bad3e9ed --- /dev/null +++ b/vscode-wpilib/resources/gradle/cppxrp/build.gradle @@ -0,0 +1,59 @@ +plugins { + id "cpp" + id "google-test-test-suite" + id "edu.wpi.first.GradleRIO" version "###GRADLERIOREPLACE###" +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +//Sets the websocket client remote host. +wpi.sim.envVar("HALSIMWS_HOST", "192.168.42.1") +wpi.sim.envVar("HALSIMWS_FILTERS", "AIO,DIO,DriverStation,Encoder,Gyro,XRPMotor,XRPServo") +wpi.sim.addWebsocketsServer().defaultEnabled = true +wpi.sim.addWebsocketsClient().defaultEnabled = true + +model { + components { + frcUserProgram(NativeExecutableSpec) { + targetPlatform wpi.platforms.desktop + + sources.cpp { + source { + srcDir 'src/main/cpp' + include '**/*.cpp', '**/*.cc' + } + exportedHeaders { + srcDir 'src/main/include' + } + } + + wpi.cpp.enableExternalTasks(it) + + wpi.sim.enable(it) + + // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. + wpi.cpp.vendor.cpp(it) + wpi.cpp.deps.wpilib(it) + } + } + testSuites { + frcUserProgramTest(GoogleTestTestSuiteSpec) { + testing $.components.frcUserProgram + + sources.cpp { + source { + srcDir 'src/test/cpp' + include '**/*.cpp' + } + } + + wpi.cpp.enableExternalTasks(it) + + wpi.cpp.vendor.cpp(it) + wpi.cpp.deps.wpilib(it) + wpi.cpp.deps.googleTest(it) + } + } +} diff --git a/vscode-wpilib/resources/gradle/cppxrp/src/test/cpp/main.cpp b/vscode-wpilib/resources/gradle/cppxrp/src/test/cpp/main.cpp new file mode 100644 index 00000000..b8b23d23 --- /dev/null +++ b/vscode-wpilib/resources/gradle/cppxrp/src/test/cpp/main.cpp @@ -0,0 +1,10 @@ +#include + +#include "gtest/gtest.h" + +int main(int argc, char** argv) { + HAL_Initialize(500, 0); + ::testing::InitGoogleTest(&argc, argv); + int ret = RUN_ALL_TESTS(); + return ret; +} diff --git a/vscode-wpilib/resources/gradle/javaxrp/.vscode/settings.json b/vscode-wpilib/resources/gradle/javaxrp/.vscode/settings.json new file mode 100644 index 00000000..cbd2e69d --- /dev/null +++ b/vscode-wpilib/resources/gradle/javaxrp/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic", + "java.server.launchMode": "Standard", + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "bin/": true, + "**/.classpath": true, + "**/.project": true, + "**/.settings": true, + "**/.factorypath": true, + "**/*~": true + }, + "wpilib.skipSelectSimulateExtension": true, + "java.test.config": [ + { + "name": "WPIlibUnitTests", + "workingDirectory": "${workspaceFolder}/build/jni/release", + "vmargs": [ "-Djava.library.path=${workspaceFolder}/build/jni/release" ], + "env": { + "LD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release" , + "DYLD_LIBRARY_PATH": "${workspaceFolder}/build/jni/release" + } + }, + ], + "java.test.defaultConfig": "WPIlibUnitTests" +} diff --git a/vscode-wpilib/resources/gradle/javaxrp/.wpilib/wpilib_preferences.json b/vscode-wpilib/resources/gradle/javaxrp/.wpilib/wpilib_preferences.json new file mode 100644 index 00000000..047fb325 --- /dev/null +++ b/vscode-wpilib/resources/gradle/javaxrp/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": false, + "currentLanguage": "java", + "projectYear": "2023", + "teamNumber": -1 +} diff --git a/vscode-wpilib/resources/gradle/javaxrp/build.gradle b/vscode-wpilib/resources/gradle/javaxrp/build.gradle new file mode 100644 index 00000000..cecc5d29 --- /dev/null +++ b/vscode-wpilib/resources/gradle/javaxrp/build.gradle @@ -0,0 +1,63 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "###GRADLERIOREPLACE###" +} + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +def ROBOT_MAIN_CLASS = "###ROBOTCLASSREPLACE###" + +// Set this to true to enable desktop support. +def includeDesktopSupport = true + +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. +// Also defines JUnit 5. +dependencies { + implementation wpi.java.deps.wpilib() + implementation wpi.java.vendor.java() + + nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop) + nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop) + simulationDebug wpi.sim.enableDebug() + + nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop) + nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop) + simulationRelease wpi.sim.enableRelease() + + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' +} + +test { + useJUnitPlatform() + systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' +} + +// Simulation configuration (e.g. environment variables). +wpi.sim.addGui().defaultEnabled = true +wpi.sim.addDriverstation() + +//Sets the websocket client remote host. +wpi.sim.envVar("HALSIMWS_HOST", "192.168.42.1") +wpi.sim.envVar("HALSIMWS_FILTERS", "AIO,DIO,DriverStation,Encoder,Gyro,XRPMotor,XRPServo") +wpi.sim.addWebsocketsServer().defaultEnabled = true +wpi.sim.addWebsocketsClient().defaultEnabled = true + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// in order to make them all available at runtime. Also adding the manifest so WPILib +// knows where to look for our Robot Class. +jar { + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) + duplicatesStrategy = DuplicatesStrategy.INCLUDE +} + +wpi.java.configureExecutableTasks(jar) +wpi.java.configureTestTasks(test) + +// Configure string concat to always inline compile +tasks.withType(JavaCompile) { + options.compilerArgs.add '-XDstringConcat=inline' +}