diff --git a/build.gradle b/build.gradle index 8a4ad5d43..7dbbd1e3e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,31 @@ plugins { id "com.diffplug.gradle.spotless" version "3.28.0" + id "com.github.johnrengelman.shadow" version "5.2.0" + id "com.github.node-gradle.node" version "2.2.4" apply false + id "edu.wpi.first.GradleJni" version "0.10.1" + id "edu.wpi.first.GradleVsCode" version "0.12.0" + id "edu.wpi.first.NativeUtils" version "2021.1.1" apply false + id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2" + id "org.hidetake.ssh" version "2.10.1" } allprojects { repositories { jcenter() - mavenCentral() - maven { - url = "https://maven.photonvision.org/repository/internal/" - } - maven { - url = 'https://frcmaven.wpi.edu:443/artifactory/development' - } - maven { - url = 'https://frcmaven.wpi.edu:443/artifactory/release' - } + maven { url = "https://maven.photonvision.org/repository/internal/" } } + wpilibRepositories.addAllReleaseRepositories(it) + wpilibRepositories.addAllDevelopmentRepositories(it) +} + +// Configure the version number. +apply from: "versioningHelper.gradle" + +ext { + wpilibVersion = "2021.2.1" + opencvVersion = "3.4.7-5" + joglVersion = "2.4.0-rc-20200307" + pubVersion = versionString } spotless { @@ -27,9 +37,8 @@ spotless { removeUnusedImports() } java { - target '**/*.java' + target "**/*.java" licenseHeaderFile "$rootDir/LicenseHeader.txt" - - targetExclude('photon-core/src/main/java/org/photonvision/PhotonVersion.java') + targetExclude("photon-core/src/main/java/org/photonvision/PhotonVersion.java") } } diff --git a/photon-core/build.gradle b/photon-core/build.gradle index 6ccefe1b2..cf257268b 100644 --- a/photon-core/build.gradle +++ b/photon-core/build.gradle @@ -1,8 +1,7 @@ import java.time.LocalDateTime import java.time.format.DateTimeFormatter -apply from: '../common.gradle' -apply from: '../versioningHelper.gradle' +apply from: "${rootDir}/shared/common.gradle" dependencies { implementation project(':photon-targeting') @@ -12,10 +11,11 @@ dependencies { implementation 'org.msgpack:msgpack-core:0.8.20' implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.20' - // Wpiutil + // wpiutil compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxaarch64bionic" compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxraspbian" compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:linuxx86-64" + compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:osxx86-64" compile "edu.wpi.first.wpiutil:wpiutil-jni:$wpilibVersion:windowsx86-64" // JOGL stuff (currently we only distribute for aarch64, which is Pi 4) diff --git a/photon-lib/build.gradle b/photon-lib/build.gradle index a8a1f0fab..d8422e58f 100644 --- a/photon-lib/build.gradle +++ b/photon-lib/build.gradle @@ -1,33 +1,9 @@ -plugins { - id 'cpp' - id 'java' - id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2' - id 'google-test-test-suite' - id 'edu.wpi.first.NativeUtils' version '2020.10.1' - id 'edu.wpi.first.GradleJni' version '0.10.1' - id 'edu.wpi.first.GradleVsCode' version '0.12.0' -} +apply plugin: "cpp" +apply plugin: "java" +apply plugin: "google-test-test-suite" +apply plugin: "edu.wpi.first.NativeUtils" -repositories { - mavenCentral() - maven { url "https://frcmaven.wpi.edu/artifactory/development" } -} - -if (project.hasProperty('releaseMode')) { - wpilibRepositories.addAllReleaseRepositories(project) -} else { - wpilibRepositories.addAllDevelopmentRepositories(project) -} - -apply from: '../versioningHelper.gradle' - -ext { - pubVersion = versionString - wpilibVersion = '2020.3.2-99-g9f4de91' -} - -// Apply C++ configuration -apply from: 'config.gradle' +apply from: "${rootDir}/shared/config.gradle" test { useJUnitPlatform() @@ -35,25 +11,17 @@ test { // Apply Java configuration dependencies { + compile project(":photon-core") + compile project(":photon-targeting") - // TODO C++ - compile project(':photon-core') - compile project(':photon-targeting') - - implementation 'edu.wpi.first.cscore:cscore-java:2020.+' - implementation 'edu.wpi.first.cameraserver:cameraserver-java:2020.+' - implementation 'edu.wpi.first.wpilibj:wpilibj-java:2020.+' - implementation 'edu.wpi.first.wpiutil:wpiutil-java:2020.+' - implementation 'edu.wpi.first.wpimath:wpimath-java:2020.+' - implementation 'edu.wpi.first.hal:hal-java:2020.+' - implementation 'edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:3.4.7-2' - + implementation "edu.wpi.first.cscore:cscore-java:$wpilibVersion" + implementation "edu.wpi.first.cameraserver:cameraserver-java:$wpilibVersion" + implementation "edu.wpi.first.wpilibj:wpilibj-java:$wpilibVersion" + implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion" + implementation "edu.wpi.first.wpimath:wpimath-java:$wpilibVersion" + implementation "edu.wpi.first.hal:hal-java:$wpilibVersion" + implementation "edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:3.4.7-2" implementation "edu.wpi.first.ntcore:ntcore-java:$wpilibVersion" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxaarch64bionic" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxraspbian" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxx86-64" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:osxx86-64" - compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:windowsx86-64" testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2") testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.2") @@ -62,68 +30,68 @@ dependencies { // Set up exports properly nativeUtils { - exportsConfigs { - // Main library is just default empty. This will export everything - Photon { + exportsConfigs { + // Main library is just default empty. This will export everything + Photon { + } } - } } model { - components { - Photon(NativeLibrarySpec) { - sources { - cpp { - source { - srcDirs 'src/main/native/cpp' - include '**/*.cpp' - } - exportedHeaders { - srcDirs 'src/main/native/include' - } + components { + Photon(NativeLibrarySpec) { + sources { + cpp { + source { + srcDirs "src/main/native/cpp" + include "**/*.cpp" + } + exportedHeaders { + srcDirs "src/main/native/include" + } + } + } + nativeUtils.useRequiredLibrary(it, "wpilib_shared") } - } - nativeUtils.useRequiredLibrary(it, 'wpilib_shared') } - } - testSuites { - cppTest(GoogleTestTestSuiteSpec) { - testing $.components.Photon + testSuites { + cppTest(GoogleTestTestSuiteSpec) { + testing $.components.Photon - sources.cpp { - source { - srcDir 'src/test/native/cpp' - include '**/*.cpp' + sources.cpp { + source { + srcDir "src/test/native/cpp" + include "**/*.cpp" + } + } + + nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared") + nativeUtils.useRequiredLibrary(it, "googletest_static") } - } - - nativeUtils.useRequiredLibrary(it, 'wpilib_executable_shared') - nativeUtils.useRequiredLibrary(it, 'googletest_static') } - } } def photonlibFileInput = file("src/generate/photonlib.json.in") ext.photonlibFileOutput = file("$buildDir/generated/vendordeps/photonlib.json") task generateVendorJson() { - description = 'Generates the vendor JSON file' - group = 'PhotonVision' + description = "Generates the vendor JSON file" + group = "PhotonVision" - outputs.file photonlibFileOutput - inputs.file photonlibFileInput + outputs.file photonlibFileOutput + inputs.file photonlibFileInput - doLast { - println "Writing version ${pubVersion} to $photonlibFileOutput" + doLast { + println "Writing version ${pubVersion} to $photonlibFileOutput" - if (photonlibFileOutput.exists()) { - photonlibFileOutput.delete() + if (photonlibFileOutput.exists()) { + photonlibFileOutput.delete() + } + def read = photonlibFileInput.text.replace('${photon_version}', pubVersion) + photonlibFileOutput.write(read) } - def read = photonlibFileInput.text.replace('${photon_version}', pubVersion) - photonlibFileOutput.write(read) - } } build.dependsOn generateVendorJson -apply from: 'publish.gradle' +apply from: "publish.gradle" diff --git a/photon-lib/settings.gradle b/photon-lib/settings.gradle deleted file mode 100644 index 212a8d608..000000000 --- a/photon-lib/settings.gradle +++ /dev/null @@ -1,8 +0,0 @@ -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - } -} - -rootProject.name = 'photon-lib' diff --git a/photon-server/build.gradle b/photon-server/build.gradle index 5ef591e91..d6731cfbc 100644 --- a/photon-server/build.gradle +++ b/photon-server/build.gradle @@ -1,8 +1,6 @@ -plugins { - id 'application' - id 'com.github.johnrengelman.shadow' version '5.2.0' - id 'org.hidetake.ssh' version '2.10.1' -} +apply plugin: "application" +apply plugin: "com.github.johnrengelman.shadow" +apply plugin: "org.hidetake.ssh" evaluationDependsOn(':photon-core') @@ -11,10 +9,9 @@ mainClassName = 'org.photonvision.Main' group 'org.photonvision' version versionString -apply from: '../common.gradle' +apply from: "${rootDir}/shared/common.gradle" dependencies { - // photon core implementation project(':photon-core') implementation "io.javalin:javalin:3.7.0" @@ -23,12 +20,10 @@ dependencies { implementation "org.msgpack:jackson-dataformat-msgpack:0.8.20" compile "org.slf4j:slf4j-simple:1.8.0-beta4" - } shadowJar { configurations = [project.configurations.runtimeClasspath] - archiveFileName.set("photonvision-${project.version}.jar") } diff --git a/photon-targeting/build.gradle b/photon-targeting/build.gradle index f43133d4f..7996019ec 100644 --- a/photon-targeting/build.gradle +++ b/photon-targeting/build.gradle @@ -1,28 +1,10 @@ -apply plugin: 'java' - -repositories { - maven { - url = 'https://frcmaven.wpi.edu:443/artifactory/development' - } - maven { - url = 'https://frcmaven.wpi.edu:443/artifactory/release' - } -} - -apply from: '../versioningHelper.gradle' - -ext { - pubVersion = versionString -} - -def openCVVersion = '3.4.7-2' +apply plugin: "java" dependencies { - implementation 'edu.wpi.first.wpimath:wpimath-java:2021.1.2' - implementation "edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:$openCVVersion" + implementation "edu.wpi.first.wpimath:wpimath-java:$wpilibVersion" implementation "com.fasterxml.jackson.core:jackson-core:2.10.0" implementation "com.fasterxml.jackson.core:jackson-annotations:2.10.0" - implementation 'org.apache.commons:commons-math3:3.6.1' + implementation "org.apache.commons:commons-math3:3.6.1" } java { @@ -30,4 +12,4 @@ java { withSourcesJar() } -apply from: 'publish.gradle' +apply from: "publish.gradle" diff --git a/photon-targeting/publish.gradle b/photon-targeting/publish.gradle index c54cf2988..efecc1518 100644 --- a/photon-targeting/publish.gradle +++ b/photon-targeting/publish.gradle @@ -3,8 +3,6 @@ apply plugin: 'maven-publish' def artifactGroupId = 'org.photonvision' def baseArtifactId = 'PhotonTargeting' -def outputsFolder = file("$buildDir/outputs") - publishing { repositories { maven { diff --git a/photonlib-cpp-examples/build.gradle b/photonlib-cpp-examples/build.gradle index b19336013..d071fa61f 100644 --- a/photonlib-cpp-examples/build.gradle +++ b/photonlib-cpp-examples/build.gradle @@ -1,21 +1,10 @@ -plugins { - id 'cpp' - id 'java' - id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2' - id 'google-test-test-suite' - id 'edu.wpi.first.NativeUtils' version '2020.10.1' - id 'edu.wpi.first.GradleJni' version '0.10.1' -} +apply plugin: "cpp" +apply plugin: "java" +apply plugin: "google-test-test-suite" +apply plugin: "edu.wpi.first.GradleVsCode" +apply plugin: "edu.wpi.first.NativeUtils" -repositories { - maven { - url = 'https://frcmaven.wpi.edu:443/artifactory/release' - maven { url "https://frcmaven.wpi.edu/artifactory/development" } - mavenCentral() - } -} - -apply from: '../photon-lib/config.gradle' +apply from: "${rootDir}/shared/config.gradle" ext.examplesMap = [:] @@ -64,7 +53,7 @@ model { } } } - nativeUtils.useRequiredLibrary(it, 'wpilib_shared') + nativeUtils.useRequiredLibrary(it, 'wpilib_executable_shared') } } } diff --git a/photonlib-java-examples/build.gradle b/photonlib-java-examples/build.gradle index 8d8f60228..fd94883db 100644 --- a/photonlib-java-examples/build.gradle +++ b/photonlib-java-examples/build.gradle @@ -1,23 +1,12 @@ import edu.wpi.first.toolchain.NativePlatforms -plugins { - id 'edu.wpi.first.NativeUtils' version '2021.1.1' -} +apply plugin: "java" +apply plugin: "cpp" +apply plugin: "edu.wpi.first.NativeUtils" -apply plugin: 'java' -apply plugin: 'cpp' -apply plugin: 'edu.wpi.first.NativeUtils' +apply from: "${rootDir}/shared/config.gradle" -// This adds all of the WPILib dependencies. -nativeUtils.addWpiNativeUtils() nativeUtils { - wpi { - configureDependencies { - wpiVersion = "2021.1.2" - opencvVersion = "3.4.7-5" - wpimathVersion = "2021.1.2" - } - } dependencyConfigs { gui { groupId = "edu.wpi.first.halsim" @@ -25,7 +14,7 @@ nativeUtils { headerClassifier = "headers" sourceClassifier = "sources" ext = "zip" - version = "2021.1.2" + version = wpilibVersion sharedPlatforms << "osxx86-64" << "linuxx86-64" << "windowsx86-64" } } @@ -38,56 +27,50 @@ nativeUtils { } } -repositories { - maven { - url = 'https://frcmaven.wpi.edu:443/artifactory/release' - } -} - ext { exampleFile = new File("$projectDir/src/main/java/org/photonlib/examples/examples.json") } dependencies { - implementation project(':photon-lib') - implementation project(':photon-targeting') + implementation project(":photon-lib") + implementation project(":photon-targeting") - implementation 'edu.wpi.first.cscore:cscore-java:2021.+' - implementation 'edu.wpi.first.cameraserver:cameraserver-java:2021.+' - implementation 'edu.wpi.first.ntcore:ntcore-java:2021.+' - implementation 'edu.wpi.first.wpilibj:wpilibj-java:2021.+' - implementation 'edu.wpi.first.wpiutil:wpiutil-java:2021.+' - implementation 'edu.wpi.first.wpimath:wpimath-java:2021.+' - implementation 'edu.wpi.first.hal:hal-java:2021.+' + implementation "edu.wpi.first.cscore:cscore-java:$wpilibVersion" + implementation "edu.wpi.first.cameraserver:cameraserver-java:$wpilibVersion" + implementation "edu.wpi.first.ntcore:ntcore-java:$wpilibVersion" + implementation "edu.wpi.first.wpilibj:wpilibj-java:$wpilibVersion" + implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion" + implementation "edu.wpi.first.wpimath:wpimath-java:$wpilibVersion" + implementation "edu.wpi.first.hal:hal-java:$wpilibVersion" implementation "org.ejml:ejml-simple:0.38" implementation "com.fasterxml.jackson.core:jackson-annotations:2.10.0" implementation "com.fasterxml.jackson.core:jackson-core:2.10.0" implementation "com.fasterxml.jackson.core:jackson-databind:2.10.0" - implementation 'edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:3.4.7-3' + implementation "edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:3.4.7-3" } model { components { - all { - nativeUtils.useAllPlatforms(it) - } dev(NativeExecutableSpec) { - targetBuildTypes 'debug' + targetBuildTypes "debug" sources { cpp { source { - srcDirs 'src/dev/native/cpp' - include '**/*.cpp' + srcDirs "src/dev/native/cpp" + include "**/*.cpp" } exportedHeaders { - srcDirs 'src/dev/native/include' + srcDirs "src/dev/native/include" } } } binaries.all { binary -> - nativeUtils.useRequiredLibrary(binary, 'wpilib_executable_shared') - nativeUtils.useRequiredLibrary(binary, 'opencv_shared') - nativeUtils.useRequiredLibrary(binary, 'halsim_gui') + nativeUtils.useRequiredLibrary(binary, "wpilib_executable_shared") + nativeUtils.useRequiredLibrary(binary, "opencv_shared") + + if (binary.targetPlatform.name == NativePlatforms.desktop) { + nativeUtils.useRequiredLibrary(binary, "halsim_gui") + } } } } @@ -102,13 +85,13 @@ model { def arch = it.targetPlatform.name if (arch == NativePlatforms.desktop) { found = true - def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib' + def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + "lib" def doFirstTask = { task -> - def extensions = '' + def extensions = "" it.tasks.install.installDirectory.get().getAsFile().eachFileRecurse { def name = it.name - if (!(name.endsWith('.dll') || name.endsWith('.so') || name.endsWith('.dylib'))) { + if (!(name.endsWith(".dll") || name.endsWith(".so") || name.endsWith(".dylib"))) { return } def file = it @@ -116,8 +99,8 @@ model { extensions += file.absolutePath + File.pathSeparator } } - if (extensions != '') { - task.environment 'HALSIM_EXTENSIONS', extensions + if (extensions != "") { + task.environment "HALSIM_EXTENSIONS", extensions } } @@ -126,13 +109,13 @@ model { main = "org.photonlib.examples." + entry.foldername + ".Main" classpath = sourceSets.main.runtimeClasspath run.dependsOn it.tasks.install - run.systemProperty 'java.library.path', filePath - run.environment 'LD_LIBRARY_PATH', filePath + run.systemProperty "java.library.path", filePath + run.environment "LD_LIBRARY_PATH", filePath run.workingDir filePath doFirst { doFirstTask(run) } if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) { - run.jvmArgs = ['-XstartOnFirstThread'] + run.jvmArgs = ["-XstartOnFirstThread"] } } } diff --git a/common.gradle b/shared/common.gradle similarity index 58% rename from common.gradle rename to shared/common.gradle index d96ddce41..42b40965b 100644 --- a/common.gradle +++ b/shared/common.gradle @@ -1,17 +1,9 @@ // Plugins -apply plugin: 'jacoco' -apply plugin: 'java' +apply plugin: "jacoco" +apply plugin: "java" sourceCompatibility = 11 -// Common version config -ext { - wpilibVersion = '2021.1.2' - joglVersion = '2.4.0-rc-20200307' - openCVVersion = '3.4.7-2' -} - -// Common deps dependencies { // Jackson implementation "com.fasterxml.jackson.core:jackson-annotations:2.10.0" @@ -19,12 +11,12 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-databind:2.10.0" // Apache commons - implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' - implementation 'org.apache.commons:commons-math3:3.6.1' - implementation group: 'commons-io', name: 'commons-io', version: '2.6' - implementation group: 'commons-cli', name: 'commons-cli', version: '1.4' - implementation 'org.apache.commons:commons-collections4:4.4' - implementation 'org.apache.commons:commons-exec:1.3' + implementation group: "org.apache.commons", name: "commons-lang3", version: "3.9" + implementation "org.apache.commons:commons-math3:3.6.1" + implementation group: "commons-io", name: "commons-io", version: "2.6" + implementation group: "commons-cli", name: "commons-cli", version: "1.4" + implementation "org.apache.commons:commons-collections4:4.4" + implementation "org.apache.commons:commons-exec:1.3" // WPILib deps implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion" @@ -44,28 +36,28 @@ dependencies { compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:osxx86-64" compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:windowsx86-64" - implementation "edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:$openCVVersion" - compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:linuxaarch64bionic" - compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:linuxraspbian" - compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:linuxx86-64" - compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:osxx86-64" - compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:windowsx86-64" + implementation "edu.wpi.first.thirdparty.frc2021.opencv:opencv-java:$opencvVersion" + compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:linuxaarch64bionic" + compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:linuxraspbian" + compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:linuxx86-64" + compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:osxx86-64" + compile "edu.wpi.first.thirdparty.frc2021.opencv:opencv-jni:$opencvVersion:windowsx86-64" - implementation 'edu.wpi.first.wpimath:wpimath-java:2021.1.2-9-g26584ff' + implementation "edu.wpi.first.wpimath:wpimath-java:2021.1.2-9-g26584ff" // test stuff - testImplementation('org.junit.jupiter:junit-jupiter:5.6.0') + testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") } test { useJUnitPlatform() testLogging { - events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' + events "passed", "skipped", "failed", "standardOut", "standardError" } } task testHeadless(type: Test) { - group = 'verification' + group = "verification" systemProperty("java.awt.headless", "true") useJUnitPlatform() } @@ -86,7 +78,7 @@ jacocoTestReport { afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { fileTree(dir: it, - exclude: 'edu/wpi/**' + exclude: "edu/wpi/**" ) })) } diff --git a/photon-lib/config.gradle b/shared/config.gradle similarity index 86% rename from photon-lib/config.gradle rename to shared/config.gradle index ec82167db..fbaa647c7 100644 --- a/photon-lib/config.gradle +++ b/shared/config.gradle @@ -1,37 +1,25 @@ -import org.gradle.internal.os.OperatingSystem - +// Configure Native-Utils WPI Plugin nativeUtils.addWpiNativeUtils() nativeUtils.withRoboRIO() nativeUtils.withRaspbian() nativeUtils.withBionic() -nativeUtils { - wpi { - configureDependencies { - wpiVersion = "2020.+" - niLibVersion = "2020.10.1" - wpimathVersion = "2020.+" - opencvVersion = "3.4.7-2" - niLibVersion = "2020.10.1" - googleTestVersion = "1.9.0-3-437e100" - opencvVersion = "3.4.7-2" - googleTestVersion = "1.9.0-3-437e100" - } - } +// Configure WPI dependencies. +nativeUtils.wpi.configureDependencies { + wpiVersion = wpilibVersion + wpimathVersion = wpilibVersion + niLibVersion = "2020.10.1" + opencvVersion = "3.4.7-5" + googleTestVersion = "1.9.0-5-437e100-1" + imguiVersion = "1.79-1" } +// Configure warnings and errors nativeUtils.wpi.addWarnings() nativeUtils.wpi.addWarningsAsErrors() -nativeUtils.setSinglePrintPerPlatform() - +// Enable builds for all platforms. model { - // components { - // all { - // targetPlatform nativeUtils.wpi.platforms.roborio - // } - // } - // Uncomment this, and remove above lines to enable builds for all platforms components { all { nativeUtils.useAllPlatforms(it) @@ -44,7 +32,8 @@ model { } } -ext.appendDebugPathToBinaries = { binaries-> +// Add debug path to binaries. +ext.appendDebugPathToBinaries = { binaries -> binaries.withType(StaticLibraryBinarySpec) { if (it.buildType.name.contains('debug')) { def staticFileDir = it.staticLibraryFile.parentFile @@ -78,8 +67,9 @@ ext.appendDebugPathToBinaries = { binaries-> } } +// Create ZIP tasks for each component. ext.createComponentZipTasks = { components, names, base, type, project, func -> - def stringNames = names.collect {it.toString()} + def stringNames = names.collect { it.toString() } def configMap = [:] components.each { if (it in NativeLibrarySpec && stringNames.contains(it.name)) { @@ -150,6 +140,7 @@ ext.createAllCombined = { list, name, base, type, project -> } +// Create the standard ZIP format for the dependencies. ext.includeStandardZipFormat = { task, value -> value.each { binary -> if (binary.buildable) { @@ -170,7 +161,7 @@ ext.includeStandardZipFormat = { task, value -> task.from(binary.sharedLibraryLinkFile) { into nativeUtils.getPlatformPath(binary) + '/shared' } - } else if (binary instanceof StaticLibraryBinarySpec) { + } else if (binary instanceof StaticLibraryBinarySpec) { task.dependsOn binary.tasks.createStaticLib task.from(binary.staticLibraryFile) { into nativeUtils.getPlatformPath(binary) + '/static'