2025-12-13 21:44:00 -08:00
|
|
|
import org.wpilib.deployutils.deploy.target.RemoteTarget
|
|
|
|
|
import org.wpilib.deployutils.deploy.target.location.SshDeployLocation
|
|
|
|
|
import org.wpilib.deployutils.deploy.artifact.*
|
2020-08-31 00:34:34 -07:00
|
|
|
import org.gradle.internal.os.OperatingSystem
|
2019-11-13 22:45:19 -08:00
|
|
|
|
2018-05-13 22:00:15 -07:00
|
|
|
plugins {
|
|
|
|
|
id 'java'
|
|
|
|
|
id 'application'
|
|
|
|
|
id 'cpp'
|
|
|
|
|
id 'visual-studio'
|
2016-11-01 23:41:05 -07:00
|
|
|
}
|
|
|
|
|
|
2025-12-13 21:44:00 -08:00
|
|
|
apply plugin: 'org.wpilib.NativeUtils'
|
|
|
|
|
apply plugin: 'org.wpilib.DeployUtils'
|
2016-11-01 23:41:05 -07:00
|
|
|
|
2025-07-15 21:16:06 -07:00
|
|
|
apply from: "${rootDir}/shared/config.gradle"
|
2018-05-13 22:00:15 -07:00
|
|
|
|
2020-08-31 00:34:34 -07:00
|
|
|
application {
|
|
|
|
|
if (OperatingSystem.current().isMacOsX()) {
|
|
|
|
|
applicationDefaultJvmArgs = ['-XstartOnFirstThread']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 22:00:15 -07:00
|
|
|
ext {
|
2024-05-24 10:41:23 -07:00
|
|
|
sharedCvConfigs = [developerRobotCpp: []]
|
|
|
|
|
staticCvConfigs = [developerRobotCppStatic: []]
|
2018-05-13 22:00:15 -07:00
|
|
|
useJava = true
|
|
|
|
|
useCpp = true
|
|
|
|
|
skipDev = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apply from: "${rootDir}/shared/opencv.gradle"
|
|
|
|
|
|
2023-10-04 19:31:25 -07:00
|
|
|
application {
|
2025-11-08 16:22:34 -08:00
|
|
|
mainClass = 'wpilib.robot.Main'
|
2023-10-04 19:31:25 -07:00
|
|
|
}
|
2021-09-19 17:59:14 -07:00
|
|
|
|
2024-12-12 22:19:14 -05:00
|
|
|
apply plugin: 'com.gradleup.shadow'
|
2021-09-19 17:59:14 -07:00
|
|
|
|
|
|
|
|
repositories {
|
2022-05-08 13:59:58 -07:00
|
|
|
maven {
|
|
|
|
|
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
|
|
|
|
|
}
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
implementation project(':wpilibj')
|
|
|
|
|
implementation project(':wpimath')
|
|
|
|
|
implementation project(':hal')
|
|
|
|
|
implementation project(':wpiutil')
|
2022-05-07 10:54:14 -07:00
|
|
|
implementation project(':wpinet')
|
2021-09-19 17:59:14 -07:00
|
|
|
implementation project(':ntcore')
|
|
|
|
|
implementation project(':cscore')
|
|
|
|
|
implementation project(':cameraserver')
|
2025-11-07 19:55:39 -05:00
|
|
|
implementation project(':commandsv2')
|
2023-08-12 02:26:05 -04:00
|
|
|
implementation project(':apriltag')
|
2024-12-08 01:00:49 -06:00
|
|
|
implementation project(':wpiunits')
|
|
|
|
|
implementation project(':epilogue-runtime')
|
|
|
|
|
annotationProcessor project(':epilogue-processor')
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
|
2022-11-14 14:26:41 -08:00
|
|
|
tasks.withType(com.github.spotbugs.snom.SpotBugsTask).configureEach {
|
|
|
|
|
onlyIf { false }
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-19 17:59:14 -07:00
|
|
|
def simProjects = ['halsim_gui']
|
|
|
|
|
|
2019-11-13 22:45:19 -08:00
|
|
|
deploy {
|
|
|
|
|
targets {
|
2024-12-01 04:31:26 +00:00
|
|
|
systemcore(RemoteTarget) {
|
|
|
|
|
directory = '/home/systemcore'
|
2019-11-13 22:45:19 -08:00
|
|
|
maxChannels = 4
|
|
|
|
|
locations {
|
2025-01-12 16:58:46 -08:00
|
|
|
mdns(SshDeployLocation) {
|
2025-05-31 10:52:27 -07:00
|
|
|
address = "robot.local"
|
2024-12-01 04:31:26 +00:00
|
|
|
user = 'systemcore'
|
2024-12-06 23:19:48 -08:00
|
|
|
password = 'systemcore'
|
2019-11-13 22:45:19 -08:00
|
|
|
ipv6 = false
|
|
|
|
|
}
|
2025-01-12 16:58:46 -08:00
|
|
|
usb(SshDeployLocation) {
|
2025-12-13 21:44:00 -08:00
|
|
|
address = "172.26.0.1"
|
2025-01-12 16:58:46 -08:00
|
|
|
user = 'systemcore'
|
|
|
|
|
password = 'systemcore'
|
|
|
|
|
ipv6 = false
|
|
|
|
|
}
|
2019-11-13 22:45:19 -08:00
|
|
|
}
|
|
|
|
|
|
2024-12-08 22:08:05 -08:00
|
|
|
timeout = 7
|
|
|
|
|
|
2021-09-19 17:59:14 -07:00
|
|
|
def remote = it
|
2019-11-18 19:52:56 -08:00
|
|
|
|
2021-09-19 17:59:14 -07:00
|
|
|
artifacts {
|
|
|
|
|
all {
|
|
|
|
|
postdeploy << { ctx ->
|
|
|
|
|
ctx.execute("sync")
|
2024-12-02 01:05:07 +00:00
|
|
|
ctx.execute("sudo ldconfig /home/systemcore/frc/third-party/lib")
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
2019-11-13 22:45:19 -08:00
|
|
|
|
2024-05-24 10:41:23 -07:00
|
|
|
developerRobotCpp(NativeExecutableArtifact) {
|
2024-12-01 04:31:26 +00:00
|
|
|
libraryDirectory = '/home/systemcore/frc/third-party/lib'
|
2022-01-21 15:45:47 -08:00
|
|
|
def excludes = getLibraryFilter().getExcludes()
|
|
|
|
|
excludes.add('**/*.so.debug')
|
|
|
|
|
excludes.add('**/*.so.*.debug')
|
2021-09-19 17:59:14 -07:00
|
|
|
postdeploy << { ctx ->
|
2024-12-08 22:08:05 -08:00
|
|
|
ctx.execute("echo 'LD_LIBRARY_PATH=/home/systemcore/frc/third-party/lib /home/systemcore/developerRobotCpp' > /home/systemcore/robotCommand")
|
2024-12-01 04:31:26 +00:00
|
|
|
ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand")
|
|
|
|
|
ctx.execute("setcap cap_sys_nice+eip \"/home/systemcore/developerRobotCpp\"")
|
2024-05-24 10:41:23 -07:00
|
|
|
ctx.execute('chmod +x developerRobotCpp')
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
2019-11-13 22:45:19 -08:00
|
|
|
|
2024-05-24 10:41:23 -07:00
|
|
|
developerRobotCppStatic(NativeExecutableArtifact) {
|
2024-12-01 04:31:26 +00:00
|
|
|
libraryDirectory = '/home/systemcore/frc/third-party/lib'
|
2021-09-19 17:59:14 -07:00
|
|
|
postdeploy << { ctx ->
|
2024-12-08 22:08:05 -08:00
|
|
|
ctx.execute("echo ''LD_LIBRARY_PATH=/home/systemcore/frc/third-party/lib /home/systemcore/developerRobotCppStatic' > /home/systemcore/robotCommand")
|
2024-12-01 04:31:26 +00:00
|
|
|
ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand")
|
2024-12-02 01:05:07 +00:00
|
|
|
ctx.execute("sudo setcap cap_sys_nice+eip \"/home/systemcore/developerRobotCppStatic\"")
|
2024-05-24 10:41:23 -07:00
|
|
|
ctx.execute('chmod +x developerRobotCppStatic')
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-24 10:41:23 -07:00
|
|
|
developerRobotCppJava(NativeExecutableArtifact) {
|
2024-12-01 04:31:26 +00:00
|
|
|
libraryDirectory = '/home/systemcore/frc/third-party/lib'
|
2022-10-24 20:03:39 -07:00
|
|
|
def excludes = getLibraryFilter().getExcludes()
|
|
|
|
|
excludes.add('**/*.so.debug')
|
|
|
|
|
excludes.add('**/*.so.*.debug')
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-24 10:41:23 -07:00
|
|
|
developerRobotJava(JavaArtifact) {
|
2021-09-19 17:59:14 -07:00
|
|
|
jarTask = shadowJar
|
|
|
|
|
postdeploy << { ctx ->
|
2024-12-01 04:31:26 +00:00
|
|
|
ctx.execute("echo '/usr/bin/java -XX:+UseG1GC -Djava.library.path=/home/systemcore/frc/third-party/lib -jar /home/systemcore/developerRobot-all.jar' > /home/systemcore/robotCommand")
|
|
|
|
|
ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand")
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
2019-11-13 22:45:19 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-19 00:46:31 +08:00
|
|
|
// Prevent the eclipse compiler (used by the VS Code extension for intellisense and debugging)
|
|
|
|
|
// from generating bad class files from annotation processors like Epilogue
|
|
|
|
|
eclipse {
|
|
|
|
|
classpath {
|
|
|
|
|
containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
|
|
|
|
|
file.whenMerged { cp ->
|
|
|
|
|
def entries = cp.entries;
|
|
|
|
|
def src = new org.gradle.plugins.ide.eclipse.model.SourceFolder('build/generated/sources/annotationProcessor/java/main/', null)
|
|
|
|
|
entries.add(src)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-13 22:45:19 -08:00
|
|
|
tasks.register('deployJava') {
|
2019-12-06 14:46:21 -05:00
|
|
|
try {
|
2024-12-01 04:31:26 +00:00
|
|
|
dependsOn tasks.named('deploydeveloperRobotJavasystemcore')
|
|
|
|
|
dependsOn tasks.named('deploydeveloperRobotCppJavasystemcore') // Deploying shared C++ is how to get the Java shared libraries.
|
2019-12-06 14:46:21 -05:00
|
|
|
} catch (ignored) {
|
|
|
|
|
}
|
2019-11-13 22:45:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks.register('deployShared') {
|
2019-12-06 14:46:21 -05:00
|
|
|
try {
|
2024-12-01 04:31:26 +00:00
|
|
|
dependsOn tasks.named('deploydeveloperRobotCppsystemcore')
|
2019-12-06 14:46:21 -05:00
|
|
|
} catch (ignored) {
|
|
|
|
|
}
|
2019-11-13 22:45:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks.register('deployStatic') {
|
2019-12-06 14:46:21 -05:00
|
|
|
try {
|
2024-12-01 04:31:26 +00:00
|
|
|
dependsOn tasks.named('deploydeveloperRobotCppStaticsystemcore')
|
2019-12-06 14:46:21 -05:00
|
|
|
} catch (ignored) {
|
|
|
|
|
}
|
2019-11-13 22:45:19 -08:00
|
|
|
}
|
|
|
|
|
|
2017-08-18 21:35:53 -07:00
|
|
|
model {
|
|
|
|
|
components {
|
2024-05-24 10:41:23 -07:00
|
|
|
developerRobotCpp(NativeExecutableSpec) {
|
2018-10-27 00:19:38 -07:00
|
|
|
targetBuildTypes 'debug'
|
2018-05-13 22:00:15 -07:00
|
|
|
sources {
|
|
|
|
|
cpp {
|
|
|
|
|
source {
|
|
|
|
|
srcDirs = ['src/main/native/cpp']
|
|
|
|
|
includes = ['**/*.cpp']
|
|
|
|
|
}
|
|
|
|
|
exportedHeaders {
|
|
|
|
|
srcDirs = ['src/main/native/include']
|
|
|
|
|
includes = ['**/*.h']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
binaries.all { binary ->
|
2024-12-01 04:31:26 +00:00
|
|
|
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) {
|
2021-09-19 17:59:14 -07:00
|
|
|
if (binary.buildType.name == 'debug') {
|
2024-12-01 04:31:26 +00:00
|
|
|
deploy.targets.systemcore.artifacts.developerRobotCpp.binary = binary
|
|
|
|
|
deploy.targets.systemcore.artifacts.developerRobotCppJava.binary = binary
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
2023-08-12 02:26:05 -04:00
|
|
|
lib project: ':apriltag', library: 'apriltag', linkage: 'shared'
|
2025-11-07 19:55:39 -05:00
|
|
|
lib project: ':commandsv2', library: 'commandsv2', linkage: 'shared'
|
2020-08-31 00:34:34 -07:00
|
|
|
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
|
|
|
|
|
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
|
2022-01-03 11:59:29 -08:00
|
|
|
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
|
2020-08-31 00:34:34 -07:00
|
|
|
lib project: ':cscore', library: 'cscore', linkage: 'shared'
|
|
|
|
|
lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared'
|
2021-12-12 17:57:52 -08:00
|
|
|
lib project: ':wpimath', library: 'wpimathJNIShared', linkage: 'shared'
|
2022-05-07 10:54:14 -07:00
|
|
|
lib project: ':wpinet', library: 'wpinetJNIShared', linkage: 'shared'
|
2021-12-12 17:57:52 -08:00
|
|
|
lib project: ':wpiutil', library: 'wpiutilJNIShared', linkage: 'shared'
|
2020-08-31 00:34:34 -07:00
|
|
|
project(':hal').addHalDependency(binary, 'shared')
|
|
|
|
|
project(':hal').addHalJniDependency(binary)
|
2025-01-24 23:47:09 -08:00
|
|
|
project(':ntcore').addNtcoreDependency(binary, 'shared')
|
|
|
|
|
project(':ntcore').addNtcoreJniDependency(binary)
|
2022-05-07 10:54:14 -07:00
|
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
|
2020-08-31 00:34:34 -07:00
|
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
2024-12-01 04:31:26 +00:00
|
|
|
def systemArch = getCurrentArch()
|
|
|
|
|
if (binary.targetPlatform.name == systemArch) {
|
|
|
|
|
simProjects.each {
|
|
|
|
|
lib project: ":simulation:$it", library: it, linkage: 'shared'
|
2019-11-13 21:35:52 -08:00
|
|
|
}
|
2020-08-31 00:34:34 -07:00
|
|
|
}
|
2018-05-13 22:00:15 -07:00
|
|
|
}
|
|
|
|
|
}
|
2024-05-24 10:41:23 -07:00
|
|
|
developerRobotCppStatic(NativeExecutableSpec) {
|
2018-10-27 00:19:38 -07:00
|
|
|
targetBuildTypes 'debug'
|
2019-11-17 16:39:38 -08:00
|
|
|
nativeUtils.excludeBinariesFromStrip(it)
|
2017-08-18 21:35:53 -07:00
|
|
|
sources {
|
|
|
|
|
cpp {
|
|
|
|
|
source {
|
|
|
|
|
srcDirs = ['src/main/native/cpp']
|
2018-05-13 22:00:15 -07:00
|
|
|
includes = ['**/*.cpp']
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
exportedHeaders {
|
2018-05-13 22:00:15 -07:00
|
|
|
srcDirs = ['src/main/native/include']
|
|
|
|
|
includes = ['**/*.h']
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
2016-11-06 21:47:18 -08:00
|
|
|
}
|
2016-11-01 23:41:05 -07:00
|
|
|
}
|
2018-05-13 22:00:15 -07:00
|
|
|
binaries.all { binary ->
|
2024-12-01 04:31:26 +00:00
|
|
|
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) {
|
2021-09-19 17:59:14 -07:00
|
|
|
if (binary.buildType.name == 'debug') {
|
2024-12-01 04:31:26 +00:00
|
|
|
deploy.targets.systemcore.artifacts.developerRobotCppStatic.binary = binary
|
2021-09-19 17:59:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
2023-08-12 02:26:05 -04:00
|
|
|
lib project: ':apriltag', library: 'apriltag', linkage: 'static'
|
2025-11-07 19:55:39 -05:00
|
|
|
lib project: ':commandsv2', library: 'commandsv2', linkage: 'static'
|
2020-08-31 00:34:34 -07:00
|
|
|
lib project: ':wpilibc', library: 'wpilibc', linkage: 'static'
|
|
|
|
|
lib project: ':wpimath', library: 'wpimath', linkage: 'static'
|
2022-01-03 11:59:29 -08:00
|
|
|
lib project: ':cameraserver', library: 'cameraserver', linkage: 'static'
|
2020-08-31 00:34:34 -07:00
|
|
|
lib project: ':cscore', library: 'cscore', linkage: 'static'
|
|
|
|
|
project(':hal').addHalDependency(binary, 'static')
|
2025-01-24 23:47:09 -08:00
|
|
|
project(':ntcore').addNtcoreDependency(binary, 'static')
|
2022-05-07 10:54:14 -07:00
|
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'static'
|
2020-08-31 00:34:34 -07:00
|
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
2016-11-01 23:41:05 -07:00
|
|
|
}
|
|
|
|
|
}
|
2017-08-18 21:35:53 -07:00
|
|
|
tasks {
|
2018-05-13 22:00:15 -07:00
|
|
|
def c = $.components
|
|
|
|
|
project.tasks.create('runCpp', Exec) {
|
|
|
|
|
group = 'WPILib'
|
2024-05-24 10:41:23 -07:00
|
|
|
description = "Run the developerRobotCpp executable"
|
2017-08-18 21:35:53 -07:00
|
|
|
def found = false
|
2018-05-13 22:00:15 -07:00
|
|
|
def systemArch = getCurrentArch()
|
2020-08-31 00:34:34 -07:00
|
|
|
def runTask = it
|
2018-05-13 22:00:15 -07:00
|
|
|
c.each {
|
2024-05-24 10:41:23 -07:00
|
|
|
if (it in NativeExecutableSpec && it.name == "developerRobotCpp") {
|
2017-08-18 21:35:53 -07:00
|
|
|
it.binaries.each {
|
|
|
|
|
if (!found) {
|
2019-06-28 14:09:10 -07:00
|
|
|
def arch = it.targetPlatform.name
|
2018-05-13 22:00:15 -07:00
|
|
|
if (arch == systemArch) {
|
2017-08-18 21:35:53 -07:00
|
|
|
dependsOn it.tasks.install
|
2018-05-13 22:00:15 -07:00
|
|
|
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
|
2020-08-31 00:34:34 -07:00
|
|
|
|
|
|
|
|
def installTask = it.tasks.install
|
|
|
|
|
|
|
|
|
|
def doFirstTask = {
|
|
|
|
|
def extensions = '';
|
|
|
|
|
installTask.installDirectory.get().getAsFile().eachFileRecurse {
|
|
|
|
|
def name = it.name
|
|
|
|
|
if (!(name.endsWith('.dll') || name.endsWith('.so') || name.endsWith('.dylib'))) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
def file = it
|
|
|
|
|
simProjects.each {
|
|
|
|
|
if (name.startsWith(it) || name.startsWith("lib$it".toString())) {
|
|
|
|
|
extensions += file.absolutePath + File.pathSeparator
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (extensions != '') {
|
|
|
|
|
run.environment 'HALSIM_EXTENSIONS', extensions
|
|
|
|
|
runTask.environment 'HALSIM_EXTENSIONS', extensions
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runTask.doFirst doFirstTask
|
|
|
|
|
run.doFirst doFirstTask
|
|
|
|
|
|
2017-08-18 21:35:53 -07:00
|
|
|
found = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-30 18:04:00 +00:00
|
|
|
|
2025-11-10 21:18:58 -05:00
|
|
|
installSystemcore(Task) {
|
2024-11-30 18:04:00 +00:00
|
|
|
$.binaries.each {
|
|
|
|
|
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore && it.component.name == 'developerRobotCpp') {
|
|
|
|
|
dependsOn it.tasks.install
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-01 04:31:26 +00:00
|
|
|
|
2025-11-10 21:18:58 -05:00
|
|
|
installSystemcoreStatic(Task) {
|
2024-11-30 18:04:00 +00:00
|
|
|
$.binaries.each {
|
|
|
|
|
if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore && it.component.name == 'developerRobotCppStatic') {
|
|
|
|
|
dependsOn it.tasks.install
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-01 23:41:05 -07:00
|
|
|
}
|
2017-08-19 22:14:34 -07:00
|
|
|
}
|