Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ deploy {
def deployArtifact = deploy.targets.roborio.artifacts.frcCpp

// Set this to true to enable desktop support.
def includeDesktopSupport = true

def includeDesktopSupport = gradle.startParameter.taskNames.any { task ->
task.toLowerCase().contains('sim') || task.toLowerCase().contains('debug')
}
// Set to true to run simulation in debug mode
wpi.cpp.debugSimulation = true

Expand Down Expand Up @@ -109,6 +110,26 @@ model {
// }
}

task backupNetworkTables(type: Exec) {
println "Backing up Networktables..."
def timestamp = new Date().format('yyyyMMdd_HHmm')
def nt_backup_file = "nt_backups/networktables_${timestamp}.json.bck"
def backupFile = "networktables_.json.bck"
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', 'scp', "lvuser@10.8.46.2:/home/lvuser/networktables.json", "./${nt_backup_file}"
commandLine 'cmd', '/c', 'scp', "lvuser@10.8.46.2:/home/lvuser/networktables.json", "./${backupFile}"
}
else {
commandLine 'sh', '-c', "scp lvuser@10.8.46.2:/home/lvuser/networktables.json ./${nt_backup_file}"
commandLine 'sh', '-c', "scp lvuser@10.8.46.2:/home/lvuser/networktables.json ./${backupFile}"
}
ignoreExitValue = true
}

tasks.matching { it.name.startsWith('deploy') }.all {
it.dependsOn backupNetworkTables
}

spotless {
cpp {
target fileTree('.') {
Expand Down
Loading