From b7bc1ea745f5d0b5b7e0a16237d300cb43450e8f Mon Sep 17 00:00:00 2001 From: Thad House Date: Wed, 13 Nov 2019 21:35:52 -0800 Subject: [PATCH] Update to 2020v6 image (#2078) --- hal/build.gradle | 11 +++++++++++ hal/src/generate/ResourceType.txt | 4 +++- hal/src/main/native/athena/DutyCycle.cpp | 8 ++++++-- myRobot/build.gradle | 14 ++++++------- shared/config.gradle | 2 +- shared/jni/setupBuild.gradle | 18 ++++++----------- shared/nilibraries.gradle | 10 ---------- shared/plugins/setupBuild.gradle | 11 +++-------- simulation/halsim_ds_socket/build.gradle | 3 +++ simulation/lowfi_simulation/build.gradle | 16 ++++++--------- wpilibNewCommands/build.gradle | 5 +++-- wpilibOldCommands/build.gradle | 5 +++-- wpilibc/build.gradle | 16 ++++++--------- wpilibcExamples/build.gradle | 21 ++++++-------------- wpilibcIntegrationTests/build.gradle | 11 +++-------- wpilibj/build.gradle | 25 ++++++++++-------------- 16 files changed, 76 insertions(+), 104 deletions(-) delete mode 100644 shared/nilibraries.gradle diff --git a/hal/build.gradle b/hal/build.gradle index 56b220d496..1cad0753e2 100644 --- a/hal/build.gradle +++ b/hal/build.gradle @@ -185,3 +185,14 @@ nativeUtils.exportsConfigs { } } } + +model { + binaries { + all { + if (!(it instanceof NativeBinarySpec)) return + if (it.component.name != 'hal' && it.component.name != 'halBase') return + if (it.targetPlatform.name != nativeUtils.wpi.platforms.roborio) return + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared') + } + } +} diff --git a/hal/src/generate/ResourceType.txt b/hal/src/generate/ResourceType.txt index 4c0348617e..4ee8eb26c7 100644 --- a/hal/src/generate/ResourceType.txt +++ b/hal/src/generate/ResourceType.txt @@ -62,7 +62,7 @@ kResourceType_PCM = 60 kResourceType_PigeonIMU = 61 kResourceType_NidecBrushless = 62 kResourceType_CANifier = 63 -kResourceType_CTRE_future0 = 64 +kResourceType_TalonFX = 64 kResourceType_CTRE_future1 = 65 kResourceType_CTRE_future2 = 66 kResourceType_CTRE_future3 = 67 @@ -90,3 +90,5 @@ kResourceType_Odometry = 88 kResourceType_Units = 89 kResourceType_TrapezoidProfile = 90 kResourceType_DutyCycle = 91 +kResourceType_AddressableLEDs = 92 +kResourceType_FusionVenom = 93 diff --git a/hal/src/main/native/athena/DutyCycle.cpp b/hal/src/main/native/athena/DutyCycle.cpp index 0912e85a7c..1c1a678cb8 100644 --- a/hal/src/main/native/athena/DutyCycle.cpp +++ b/hal/src/main/native/athena/DutyCycle.cpp @@ -83,7 +83,9 @@ int32_t HAL_GetDutyCycleFrequency(HAL_DutyCycleHandle dutyCycleHandle, return 0; } - return dutyCycle->dutyCycle->readFrequency(status); + // TODO Handle Overflow + unsigned char overflow = 0; + return dutyCycle->dutyCycle->readFrequency(&overflow, status); } double HAL_GetDutyCycleOutput(HAL_DutyCycleHandle dutyCycleHandle, @@ -100,7 +102,9 @@ int32_t HAL_GetDutyCycleOutputRaw(HAL_DutyCycleHandle dutyCycleHandle, return 0; } - return dutyCycle->dutyCycle->readOutput(status); + // TODO Handle Overflow + unsigned char overflow = 0; + return dutyCycle->dutyCycle->readOutput(&overflow, status); } int32_t HAL_GetDutyCycleOutputScaleFactor(HAL_DutyCycleHandle dutyCycleHandle, diff --git a/myRobot/build.gradle b/myRobot/build.gradle index 16be7e5be3..2385690408 100644 --- a/myRobot/build.gradle +++ b/myRobot/build.gradle @@ -17,14 +17,6 @@ ext { skipDev = true } -ext { - chipObjectComponents = ['myRobotCpp', 'myRobotCppStatic'] - netCommComponents = ['myRobotCpp', 'myRobotCppStatic'] - useNiJava = true -} - -apply from: "${rootDir}/shared/nilibraries.gradle" - apply from: "${rootDir}/shared/opencv.gradle" mainClassName = 'Main' @@ -79,6 +71,9 @@ model { 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', 'ni_runtime_shared') + } } } myRobotCppStatic(NativeExecutableSpec) { @@ -105,6 +100,9 @@ model { 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', 'ni_runtime_shared') + } } } } diff --git a/shared/config.gradle b/shared/config.gradle index 47dba5b62d..12d3462ed6 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -8,7 +8,7 @@ nativeUtils { wpi { configureDependencies { wpiVersion = "-1" - niLibVersion = "2020.5.1" + niLibVersion = "2020.6.1" opencvVersion = "3.4.7-2" googleTestVersion = "1.9.0-3-437e100" imguiVersion = "1.72b-2" diff --git a/shared/jni/setupBuild.gradle b/shared/jni/setupBuild.gradle index a97f378a44..3b097cee82 100644 --- a/shared/jni/setupBuild.gradle +++ b/shared/jni/setupBuild.gradle @@ -32,18 +32,6 @@ staticGtestConfigs["${nativeName}Test"] = [] apply from: "${rootDir}/shared/googletest.gradle" -if (project.hasProperty('niLibraries')) { - ext { - chipObjectComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(), - "${nativeName}JNI".toString(), "${nativeName}JNIShared".toString(), "${nativeName}Test".toString()] - netCommComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(), - "${nativeName}JNI".toString(), "${nativeName}JNIShared".toString(), "${nativeName}Test".toString()] - useNiJava = true - } - - apply from: "${rootDir}/shared/nilibraries.gradle" -} - model { components { "${nativeName}Base"(NativeLibrarySpec) { @@ -211,6 +199,9 @@ model { if (!project.hasProperty('noWpiutil')) { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' } + if (nativeName == 'hal' && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } } @@ -243,6 +234,9 @@ model { lib library: nativeName, linkage: 'shared' if (!project.hasProperty('noWpiutil')) { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' + if (nativeName == 'hal' && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } } diff --git a/shared/nilibraries.gradle b/shared/nilibraries.gradle deleted file mode 100644 index efb9cfc8f0..0000000000 --- a/shared/nilibraries.gradle +++ /dev/null @@ -1,10 +0,0 @@ -model { - binaries { - all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared') - } - - } - } -} diff --git a/shared/plugins/setupBuild.gradle b/shared/plugins/setupBuild.gradle index 4feb8a973d..235bb71a1f 100644 --- a/shared/plugins/setupBuild.gradle +++ b/shared/plugins/setupBuild.gradle @@ -2,14 +2,6 @@ apply plugin: 'cpp' apply plugin: 'edu.wpi.first.NativeUtils' apply plugin: ExtraTasks -ext { - chipObjectComponents = ["$pluginName".toString(), "${pluginName}Dev".toString(), "${pluginName}Test".toString()] - netCommComponents = ["$pluginName".toString(), "${pluginName}Dev".toString(), "${pluginName}Test".toString()] - useNiJava = false -} - -apply from: "${rootDir}/shared/nilibraries.gradle" - if (!project.hasProperty('onlylinuxathena')) { ext.skiplinuxathena = true apply from: "${rootDir}/shared/config.gradle" @@ -64,6 +56,9 @@ if (!project.hasProperty('onlylinuxathena')) { lib project: ':ntcore', library: 'ntcore', linkage: 'shared' } lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } else { it.buildable = false } diff --git a/simulation/halsim_ds_socket/build.gradle b/simulation/halsim_ds_socket/build.gradle index 46e48f4018..ef7659d048 100644 --- a/simulation/halsim_ds_socket/build.gradle +++ b/simulation/halsim_ds_socket/build.gradle @@ -48,6 +48,9 @@ model { project(':hal').addHalDependency(it, 'shared') lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib library: pluginName, linkage: 'shared' + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } } diff --git a/simulation/lowfi_simulation/build.gradle b/simulation/lowfi_simulation/build.gradle index d86e4d604b..9708ee6ed5 100644 --- a/simulation/lowfi_simulation/build.gradle +++ b/simulation/lowfi_simulation/build.gradle @@ -30,16 +30,6 @@ if (!project.hasProperty('onlylinuxathena')) { project(':').libraryBuild.dependsOn build - ext { - chipObjectComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(), - "${nativeName}Test".toString()] - netCommComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(), - "${nativeName}Test".toString()] - useNiJava = false - } - - apply from: "${rootDir}/shared/nilibraries.gradle" - nativeUtils.exportsConfigs { lowfi_sim { x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure', @@ -125,6 +115,9 @@ if (!project.hasProperty('onlylinuxathena')) { project(':hal').addHalDependency(it, 'shared') lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib library: nativeName, linkage: 'shared' + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } } @@ -137,6 +130,9 @@ if (!project.hasProperty('onlylinuxathena')) { lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' lib library: nativeName, linkage: 'shared' + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } } diff --git a/wpilibNewCommands/build.gradle b/wpilibNewCommands/build.gradle index 69755699c4..c4ba6189c1 100644 --- a/wpilibNewCommands/build.gradle +++ b/wpilibNewCommands/build.gradle @@ -40,8 +40,6 @@ nativeUtils.exportsConfigs { } } -apply from: "${rootDir}/shared/nilibraries.gradle" - apply plugin: DisableBuildingGTest model { @@ -65,6 +63,9 @@ model { nativeUtils.useRequiredLibrary(it, 'opencv_shared') lib project: ':cscore', library: 'cscore', linkage: 'shared' } + if ((it instanceof NativeExecutableBinarySpec || it instanceof GoogleTestTestSuiteBinarySpec) && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } tasks { diff --git a/wpilibOldCommands/build.gradle b/wpilibOldCommands/build.gradle index c11b9ece99..66334adbfc 100644 --- a/wpilibOldCommands/build.gradle +++ b/wpilibOldCommands/build.gradle @@ -38,8 +38,6 @@ nativeUtils.exportsConfigs { } } -apply from: "${rootDir}/shared/nilibraries.gradle" - apply plugin: DisableBuildingGTest model { @@ -63,6 +61,9 @@ model { nativeUtils.useRequiredLibrary(it, 'opencv_shared') lib project: ':cscore', library: 'cscore', linkage: 'shared' } + if ((it instanceof NativeExecutableBinarySpec || it instanceof GoogleTestTestSuiteBinarySpec) && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } tasks { diff --git a/wpilibc/build.gradle b/wpilibc/build.gradle index b1a18c8c0a..0ada5cefda 100644 --- a/wpilibc/build.gradle +++ b/wpilibc/build.gradle @@ -60,16 +60,6 @@ staticGtestConfigs["${nativeName}Test"] = [] apply from: "${rootDir}/shared/googletest.gradle" -ext { - chipObjectComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(), - "${nativeName}Test".toString()] - netCommComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(), - "${nativeName}Test".toString()] - useNiJava = false -} - -apply from: "${rootDir}/shared/nilibraries.gradle" - apply plugin: DisableBuildingGTest nativeUtils.exportsConfigs { @@ -164,6 +154,9 @@ model { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' nativeUtils.useRequiredLibrary(it, 'opencv_shared') + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } } @@ -211,6 +204,9 @@ model { lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' nativeUtils.useRequiredLibrary(it, 'opencv_shared') lib library: nativeName, linkage: 'shared' + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } tasks { diff --git a/wpilibcExamples/build.gradle b/wpilibcExamples/build.gradle index 6754ad333d..28e77fb069 100644 --- a/wpilibcExamples/build.gradle +++ b/wpilibcExamples/build.gradle @@ -44,21 +44,6 @@ ext { apply from: "${rootDir}/shared/opencv.gradle" -ext { - chipObjectComponents = ['commands'] - netCommComponents = ['commands'] - examplesMap.each { key, value -> - chipObjectComponents << key.toString() - netCommComponents << key.toString() - } - templatesMap.each { key, value -> - chipObjectComponents << key.toString() - netCommComponents << key.toString() - } -} - -apply from: "${rootDir}/shared/nilibraries.gradle" - model { components { commands(NativeLibrarySpec) { @@ -107,6 +92,9 @@ model { lib project: ':simulation:halsim_print', library: 'halsim_print', linkage: 'shared' lib project: ':simulation:halsim_ds_nt', library: 'halsim_ds_nt', linkage: 'shared' } + if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } sources { cpp { @@ -158,6 +146,9 @@ model { lib project: ':simulation:halsim_print', library: 'halsim_print', linkage: 'shared' lib project: ':simulation:halsim_ds_nt', library: 'halsim_ds_nt', linkage: 'shared' } + if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } sources { cpp { diff --git a/wpilibcIntegrationTests/build.gradle b/wpilibcIntegrationTests/build.gradle index 83bcdebcb0..cc5ada83ba 100644 --- a/wpilibcIntegrationTests/build.gradle +++ b/wpilibcIntegrationTests/build.gradle @@ -19,14 +19,6 @@ apply from: "${rootDir}/shared/opencv.gradle" apply from: "${rootDir}/shared/googletest.gradle" -ext { - chipObjectComponents = ['wpilibcIntegrationTests'] - netCommComponents = ['wpilibcIntegrationTests'] - useNiJava = false -} - -apply from: "${rootDir}/shared/nilibraries.gradle" - model { components { wpilibcIntegrationTests(NativeExecutableSpec) { @@ -62,6 +54,9 @@ model { 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', 'ni_runtime_shared') + } } else { binary.sources { simCpp(CppSourceSet) { diff --git a/wpilibj/build.gradle b/wpilibj/build.gradle index b4bc772b51..eda4174493 100644 --- a/wpilibj/build.gradle +++ b/wpilibj/build.gradle @@ -89,14 +89,6 @@ ext { useCpp = true } -ext { - chipObjectComponents = ['wpilibjDev'] - netCommComponents = ['wpilibjDev'] - useNiJava = true -} - -apply from: "${rootDir}/shared/nilibraries.gradle" - apply from: "${rootDir}/shared/opencv.gradle" model { @@ -108,13 +100,6 @@ model { source { srcDirs 'src/dev/native/cpp' include '**/*.cpp' - lib project: ':ntcore', library: 'ntcore', linkage: 'shared' - lib project: ':cscore', library: 'cscore', linkage: 'shared' - lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' - lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared' - lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared' - lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' - lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' } exportedHeaders { srcDirs 'src/dev/native/include' @@ -122,8 +107,18 @@ model { } } binaries.all { + lib project: ':ntcore', library: 'ntcore', linkage: 'shared' + lib project: ':cscore', library: 'cscore', linkage: 'shared' + lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' + lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared' + lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared' + lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' + lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' project(':hal').addHalDependency(it, 'shared') project(':hal').addHalJniDependency(it) + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + nativeUtils.useRequiredLibrary(it, 'netcomm_shared', 'chipobject_shared', 'ni_runtime_shared') + } } } }