mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-26 01:51:40 +00:00
This PR updates everything for 2027. This includes removing GradleRIO, simplifying our wpilib version defintion, updating APIs, updating to Java 21, and more. Note that photonlibpy is failing because robotpy has not been fully updated yet. Examples are omitted because they need to be updated for our new PhotonPoseEstimator API and still need some changes from WPILIB. photonlib windows build is failing because we're waiting for some upstream changes. Finally, images are failing since they don't have Java 21 yet.
202 lines
5.8 KiB
Groovy
202 lines
5.8 KiB
Groovy
apply plugin: 'maven-publish'
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'jacoco'
|
|
apply plugin: 'com.google.protobuf'
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
|
|
def baseArtifactId = nativeName
|
|
def artifactGroupId = 'org.photonvision'
|
|
def javaBaseName = "_GROUP_org_photonvision_${baseArtifactId}_ID_${baseArtifactId}-java_CLS"
|
|
|
|
def outputsFolder = file("$buildDir/outputs")
|
|
def licenseFile = ext.licenseFile
|
|
def externalLicensesFolder = file("$rootDir/ExternalLicenses")
|
|
|
|
javadoc {
|
|
options {
|
|
encoding = 'UTF-8'
|
|
links "https://github.wpilib.org/allwpilib/docs/release/java/"
|
|
}
|
|
}
|
|
|
|
jar {
|
|
from licenseFile
|
|
from externalLicensesFolder
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
archiveClassifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
from licenseFile
|
|
from externalLicensesFolder
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
archiveClassifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
from licenseFile
|
|
from externalLicensesFolder
|
|
}
|
|
|
|
task outputJar(type: Jar, dependsOn: classes) {
|
|
archiveBaseName = javaBaseName
|
|
destinationDirectory = outputsFolder
|
|
from sourceSets.main.output
|
|
from licenseFile
|
|
from externalLicensesFolder
|
|
}
|
|
|
|
task outputSourcesJar(type: Jar, dependsOn: classes) {
|
|
archiveBaseName = javaBaseName
|
|
destinationDirectory = outputsFolder
|
|
archiveClassifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
from licenseFile
|
|
from externalLicensesFolder
|
|
}
|
|
|
|
task outputJavadocJar(type: Jar, dependsOn: javadoc) {
|
|
archiveBaseName = javaBaseName
|
|
destinationDirectory = outputsFolder
|
|
archiveClassifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
from licenseFile
|
|
from externalLicensesFolder
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives javadocJar
|
|
archives outputJar
|
|
archives outputSourcesJar
|
|
archives outputJavadocJar
|
|
}
|
|
|
|
addTaskToCopyAllOutputs(outputSourcesJar)
|
|
addTaskToCopyAllOutputs(outputJavadocJar)
|
|
addTaskToCopyAllOutputs(outputJar)
|
|
|
|
build.dependsOn outputSourcesJar
|
|
build.dependsOn outputJavadocJar
|
|
build.dependsOn outputJar
|
|
|
|
publishing {
|
|
publications {
|
|
java(MavenPublication) {
|
|
artifact jar
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
|
|
artifactId = "${baseArtifactId}-java"
|
|
groupId = artifactGroupId
|
|
version = pubVersion
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
// If we're trying to copy local outputs, just throw everything into build/maven
|
|
// The problem here is we can't specify which repo to publish to easily, so we have to choose one or the other
|
|
if (project.hasProperty('copyOfflineArtifacts')) {
|
|
url(localMavenURL)
|
|
} else {
|
|
url = photonMavenURL
|
|
credentials {
|
|
username = 'ghactions'
|
|
password = System.getenv("ARTIFACTORY_API_KEY")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
|
|
testLogging {
|
|
events "failed"
|
|
exceptionFormat = "full"
|
|
showStandardStreams = true
|
|
}
|
|
forkEvery = 1
|
|
finalizedBy jacocoTestReport
|
|
}
|
|
|
|
wpilibTools.deps.wpilibVersion = wpilibVersion
|
|
|
|
dependencies {
|
|
if(project.hasProperty('includePhotonTargeting')) {
|
|
implementation project(":photon-targeting")
|
|
}
|
|
|
|
implementation "org.wpilib.wpiutil:wpiutil-java:$wpilibVersion"
|
|
implementation "org.wpilib.datalog:datalog-java:$wpilibVersion"
|
|
implementation "org.wpilib.cameraserver:cameraserver-java:$wpilibVersion"
|
|
implementation "org.wpilib.cscore:cscore-java:$wpilibVersion"
|
|
implementation "org.wpilib.wpinet:wpinet-java:$wpilibVersion"
|
|
implementation "org.wpilib.wpimath:wpimath-java:$wpilibVersion"
|
|
implementation "org.wpilib.ntcore:ntcore-java:$wpilibVersion"
|
|
implementation "org.wpilib.hal:hal-java:$wpilibVersion"
|
|
implementation "org.wpilib.wpilibj:wpilibj-java:$wpilibVersion"
|
|
implementation "org.wpilib.apriltag:apriltag-java:$wpilibVersion"
|
|
implementation "org.wpilib.wpiunits:wpiunits-java:$wpilibVersion"
|
|
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + openCVYear, openCVversion)
|
|
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: jacksonVersion
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: jacksonVersion
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: jacksonVersion
|
|
|
|
implementation group: "org.ejml", name: "ejml-simple", version: ejmlVersion
|
|
implementation group: "us.hebi.quickbuf", name: "quickbuf-runtime", version: quickbufVersion;
|
|
|
|
testImplementation(platform('org.junit:junit-bom:5.11.4'))
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api'
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-params'
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
}
|
|
|
|
jacoco {
|
|
toolVersion = "0.8.10"
|
|
}
|
|
|
|
jacocoTestReport {
|
|
reports {
|
|
xml.required = true
|
|
html.required = true
|
|
}
|
|
}
|
|
|
|
|
|
protobuf {
|
|
protoc {
|
|
artifact = 'com.google.protobuf:protoc:3.21.12'
|
|
}
|
|
plugins {
|
|
quickbuf {
|
|
artifact = 'us.hebi.quickbuf:protoc-gen-quickbuf:1.3.3'
|
|
}
|
|
}
|
|
generateProtoTasks {
|
|
all().configureEach { task ->
|
|
task.builtins {
|
|
// cpp {}
|
|
// The protobuf-java code is bad -- use quickbuf
|
|
remove java
|
|
}
|
|
task.plugins {
|
|
quickbuf {
|
|
option "gen_descriptors=true"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|