mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Initial framework for adding JNI libraries. Auto generated JNI headers and sticks native libraries into the JAR (and adds to class path for testing)
132 lines
4.0 KiB
Groovy
132 lines
4.0 KiB
Groovy
import edu.wpi.first.toolchain.*
|
|
|
|
plugins {
|
|
id "java"
|
|
id "cpp"
|
|
id "com.diffplug.spotless" version "6.24.0"
|
|
id "edu.wpi.first.NativeUtils" version "2024.6.1" apply false
|
|
id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2"
|
|
id "edu.wpi.first.GradleRIO" version "2024.3.2"
|
|
id 'edu.wpi.first.WpilibTools' version '1.3.0'
|
|
id 'com.google.protobuf' version '0.9.4' apply false
|
|
id 'edu.wpi.first.GradleJni' version '1.1.0'
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
mavenCentral()
|
|
mavenLocal()
|
|
maven { url = "https://maven.photonvision.org/releases" }
|
|
maven { url = "https://maven.photonvision.org/snapshots" }
|
|
maven { url = "https://jogamp.org/deployment/maven/" }
|
|
}
|
|
wpilibRepositories.addAllReleaseRepositories(it)
|
|
wpilibRepositories.addAllDevelopmentRepositories(it)
|
|
}
|
|
|
|
ext.localMavenURL = file("$project.buildDir/outputs/maven")
|
|
ext.allOutputsFolder = file("$project.buildDir/outputs")
|
|
|
|
// Configure the version number.
|
|
apply from: "versioningHelper.gradle"
|
|
|
|
ext {
|
|
wpilibVersion = "2024.3.2"
|
|
wpimathVersion = wpilibVersion
|
|
openCVversion = "4.8.0-2"
|
|
joglVersion = "2.4.0"
|
|
javalinVersion = "5.6.2"
|
|
libcameraDriverVersion = "dev-v2023.1.0-14-g787ab59"
|
|
rknnVersion = "dev-v2024.0.1-4-g0db16ac"
|
|
frcYear = "2024"
|
|
mrcalVersion = "dev-v2024.0.0-24-gc1efcf0";
|
|
|
|
|
|
pubVersion = versionString
|
|
isDev = pubVersion.startsWith("dev")
|
|
|
|
// A list, for legacy reasons, with only the current platform contained
|
|
wpilibNativeName = wpilibTools.platformMapper.currentPlatform.platformName;
|
|
def nativeName = wpilibNativeName
|
|
if (wpilibNativeName == "linuxx64") nativeName = "linuxx86-64";
|
|
if (wpilibNativeName == "winx64") nativeName = "windowsx86-64";
|
|
if (wpilibNativeName == "macx64") nativeName = "osxx86-64";
|
|
if (wpilibNativeName == "macarm64") nativeName = "osxarm64";
|
|
jniPlatform = nativeName
|
|
|
|
println("Building for platform " + jniPlatform + " wpilib: " + wpilibNativeName)
|
|
println("Using Wpilib: " + wpilibVersion)
|
|
println("Using OpenCV: " + openCVversion)
|
|
|
|
|
|
photonMavenURL = 'https://maven.photonvision.org/' + (isDev ? 'snapshots' : 'releases');
|
|
println("Publishing Photonlib to " + photonMavenURL)
|
|
}
|
|
|
|
spotless {
|
|
java {
|
|
target fileTree('.') {
|
|
include '**/*.java'
|
|
exclude '**/build/**', '**/build-*/**', "photon-core\\src\\main\\java\\org\\photonvision\\PhotonVersion.java", "photon-lib\\src\\main\\java\\org\\photonvision\\PhotonVersion.java", "**/src/generated/**"
|
|
}
|
|
toggleOffOn()
|
|
googleJavaFormat()
|
|
indentWithTabs(2)
|
|
indentWithSpaces(4)
|
|
removeUnusedImports()
|
|
trimTrailingWhitespace()
|
|
endWithNewline()
|
|
}
|
|
groovyGradle {
|
|
target fileTree('.') {
|
|
include '**/*.gradle'
|
|
exclude '**/build/**', '**/build-*/**'
|
|
}
|
|
greclipse()
|
|
indentWithSpaces(4)
|
|
trimTrailingWhitespace()
|
|
endWithNewline()
|
|
}
|
|
format 'xml', {
|
|
target fileTree('.') {
|
|
include '**/*.xml'
|
|
exclude '**/build/**', '**/build-*/**', "**/.idea/**"
|
|
}
|
|
eclipseWtp('xml')
|
|
trimTrailingWhitespace()
|
|
indentWithSpaces(2)
|
|
endWithNewline()
|
|
}
|
|
format 'misc', {
|
|
target fileTree('.') {
|
|
include '**/*.md', '**/.gitignore'
|
|
exclude '**/build/**', '**/build-*/**'
|
|
}
|
|
trimTrailingWhitespace()
|
|
indentWithSpaces(2)
|
|
endWithNewline()
|
|
}
|
|
}
|
|
|
|
wrapper {
|
|
gradleVersion '8.4'
|
|
}
|
|
|
|
ext.getCurrentArch = {
|
|
return NativePlatforms.desktop
|
|
}
|
|
|
|
subprojects {
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs.add '-XDstringConcat=inline'
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
// Enables UTF-8 support in Javadoc
|
|
tasks.withType(Javadoc) {
|
|
options.addStringOption("charset", "utf-8")
|
|
options.addStringOption("docencoding", "utf-8")
|
|
options.addStringOption("encoding", "utf-8")
|
|
}
|
|
}
|