mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-26 01:51:40 +00:00
* add classes to targeting and update gradle * rename me * Finish cleanup * Formatting fixes * just use common.gradle * Update build.gradle * Update config.gradle * remove typo * simplify * Add Packet Headers * move simulation classes into simulation folder * draw in dependency * fix * Everything working minus tests cause im lazy * formatting fixes REMEMBER TO REMOVE UNUSED IMPORTS, IM JUST TOO LAZY TO CHECK RN * move packet test to targeting * Formatting fixes * remove TargetCorner from c++ im not 100% sure but just doing std::pair<double, double> is sufficient and shouldnt conflict with protobuf * think i added packet * fix namespace issue * organize imports in photon-targeting * Formatting fixes * remove ctors * fix typo * Add PNP and Multitag packet tests * revert TargetCorner class * Add Test placeholders * remove annoying print * Reorganize build and publish process channeling inner Thad * add targeting as flag * Update config.gradle * fix issue with platform binaries not building * Update photonlib.json.in casing still needs to be checked * add minimum level back * add back UTF-8 encoding of javadoc * simplify publish model for photon-lib * fix windows symbol generation * formatting fixes * move task from main gradle to config * Update config.gradle
131 lines
4.4 KiB
Groovy
131 lines
4.4 KiB
Groovy
plugins {
|
|
id 'edu.wpi.first.WpilibTools' version '1.3.0'
|
|
}
|
|
|
|
apply plugin: "edu.wpi.first.NativeUtils"
|
|
|
|
import java.nio.file.Path
|
|
|
|
ext {
|
|
nativeName = "photonlib"
|
|
includePhotonTargeting = true
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/setupBuild.gradle"
|
|
apply from: "${rootDir}/versioningHelper.gradle"
|
|
|
|
|
|
wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
|
|
|
|
def nativeConfigName = 'wpilibNatives'
|
|
def nativeConfig = configurations.create(nativeConfigName)
|
|
|
|
def nativeTasks = wpilibTools.createExtractionTasks {
|
|
configurationName = nativeConfigName
|
|
}
|
|
|
|
nativeTasks.addToSourceSetResources(sourceSets.main)
|
|
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
|
|
|
dependencies {
|
|
implementation project(":photon-targeting")
|
|
|
|
implementation wpilibTools.deps.wpilibJava("wpiutil")
|
|
implementation wpilibTools.deps.wpilibJava("cameraserver")
|
|
implementation wpilibTools.deps.wpilibJava("cscore")
|
|
implementation wpilibTools.deps.wpilibJava("wpinet")
|
|
implementation wpilibTools.deps.wpilibJava("wpimath")
|
|
implementation wpilibTools.deps.wpilibJava("ntcore")
|
|
implementation wpilibTools.deps.wpilibJava("hal")
|
|
implementation wpilibTools.deps.wpilibJava("wpilibj")
|
|
implementation wpilibTools.deps.wpilibJava("apriltag")
|
|
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
|
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: wpi.versions.jacksonVersion.get()
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: wpi.versions.jacksonVersion.get()
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: wpi.versions.jacksonVersion.get()
|
|
|
|
implementation group: "org.ejml", name: "ejml-simple", version: wpi.versions.ejmlVersion.get()
|
|
implementation group: "us.hebi.quickbuf", name: "quickbuf-runtime", version: wpi.versions.quickbufVersion.get();
|
|
}
|
|
|
|
cppHeadersZip {
|
|
from('src/generate/native/include') {
|
|
into '/'
|
|
}
|
|
}
|
|
|
|
def photonlibFileInput = file("src/generate/photonlib.json.in")
|
|
ext.photonlibFileOutput = file("$buildDir/generated/vendordeps/photonlib.json")
|
|
|
|
def vendorJson = artifacts.add('archives', file("$photonlibFileOutput"))
|
|
|
|
task generateVendorJson() {
|
|
description = "Generates the vendor JSON file"
|
|
group = "PhotonVision"
|
|
|
|
outputs.file photonlibFileOutput
|
|
inputs.file photonlibFileInput
|
|
|
|
println "Writing vendor JSON ${pubVersion} to $photonlibFileOutput"
|
|
|
|
if (photonlibFileOutput.exists()) {
|
|
photonlibFileOutput.delete()
|
|
}
|
|
photonlibFileOutput.parentFile.mkdirs()
|
|
|
|
def read = photonlibFileInput.text
|
|
.replace('${photon_version}', pubVersion)
|
|
.replace('${frc_year}', frcYear)
|
|
photonlibFileOutput.text = read
|
|
|
|
outputs.upToDateWhen { false }
|
|
}
|
|
|
|
build.mustRunAfter generateVendorJson
|
|
|
|
task writeCurrentVersion {
|
|
def versionFileIn = file("${rootDir}/shared/PhotonVersion.java.in")
|
|
writePhotonVersionFile(versionFileIn, Path.of("$projectDir", "src", "main", "java", "org", "photonvision", "PhotonVersion.java"),
|
|
versionString)
|
|
versionFileIn = file("${rootDir}/shared/PhotonVersion.h.in")
|
|
writePhotonVersionFile(versionFileIn, Path.of("$projectDir", "src", "generate", "native", "include", "PhotonVersion.h"),
|
|
versionString)
|
|
}
|
|
|
|
build.mustRunAfter writeCurrentVersion
|
|
|
|
model {
|
|
components {
|
|
all {
|
|
it.sources.each {
|
|
it.exportedHeaders {
|
|
srcDirs "src/main/native/include"
|
|
srcDirs "src/generate/native/include"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Publish the vendordep json
|
|
publishing {
|
|
publications {
|
|
vendorjson(MavenPublication) {
|
|
artifact vendorJson
|
|
|
|
artifactId = "${nativeName}-json"
|
|
groupId = "org.photonvision"
|
|
version "1.0"
|
|
}
|
|
}
|
|
}
|
|
}
|