mirror of
https://github.com/Astatin3/photonvision-2025.0.0-beta-6.git
synced 2026-06-09 00:28:06 -06:00
Initial commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) Photon Vision.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <regex>
|
||||
|
||||
/*
|
||||
* Autogenerated file! Do not manually edit this file. This version is
|
||||
* regenerated any time the publish task is run, or when this file is deleted.
|
||||
*/
|
||||
|
||||
static const char* dev_ = "dev";
|
||||
|
||||
namespace photon {
|
||||
namespace PhotonVersion {
|
||||
const char* versionString = "${version}";
|
||||
const char* buildDate = "${date}";
|
||||
const bool isRelease = strncmp(dev_, versionString, strlen(dev_)) != 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) PhotonVision
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.photonvision;
|
||||
|
||||
/*
|
||||
* Autogenerated file! Do not manually edit this file. This version is regenerated
|
||||
* any time the publish task is run, or when this file is deleted.
|
||||
*/
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
public final class PhotonVersion {
|
||||
public static final String versionString = "${version}";
|
||||
public static final String buildDate = "${date}";
|
||||
public static final boolean isRelease = !versionString.startsWith("dev");
|
||||
|
||||
public static final boolean versionMatches(String other) {
|
||||
String c = versionString;
|
||||
Pattern p = Pattern.compile("v[0-9]+.[0-9]+.[0-9]+");
|
||||
Matcher m = p.matcher(c);
|
||||
if (m.find()) {
|
||||
c = m.group(0);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
m = p.matcher(other);
|
||||
if (m.find()) {
|
||||
other = m.group(0);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return c.equals(other);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Plugins
|
||||
apply plugin: "java"
|
||||
apply plugin: "jacoco"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
wpilibTools.deps.wpilibVersion = wpilibVersion
|
||||
|
||||
// Tell gradlerio what version of things to use (that we care about)
|
||||
// See: https://github.com/wpilibsuite/GradleRIO/blob/main/src/main/java/edu/wpi/first/gradlerio/wpi/WPIVersionsExtension.java
|
||||
wpi.getVersions().getOpencvVersion().convention(openCVversion);
|
||||
wpi.getVersions().getWpilibVersion().convention(wpilibVersion);
|
||||
wpi.getVersions().getWpimathVersion().convention(wpimathVersion);
|
||||
|
||||
dependencies {
|
||||
implementation project(':photon-targeting')
|
||||
|
||||
implementation "io.javalin:javalin:$javalinVersion"
|
||||
|
||||
implementation 'org.msgpack:msgpack-core:0.9.0'
|
||||
implementation 'org.msgpack:jackson-dataformat-msgpack:0.9.0'
|
||||
|
||||
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.wpilibJava("wpiunits")
|
||||
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + openCVYear, 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();
|
||||
|
||||
implementation "commons-io:commons-io:2.11.0"
|
||||
implementation "commons-cli:commons-cli:1.5.0"
|
||||
implementation "org.apache.commons:commons-lang3:3.12.0"
|
||||
implementation "org.apache.commons:commons-collections4:4.4"
|
||||
implementation "org.apache.commons:commons-exec:1.3"
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed", "standardOut", "standardError"
|
||||
}
|
||||
workingDir = new File("${rootDir}")
|
||||
finalizedBy jacocoTestReport
|
||||
}
|
||||
|
||||
tasks.register('testHeadless', Test) {
|
||||
group = "verification"
|
||||
systemProperty("java.awt.headless", "true")
|
||||
useJUnitPlatform()
|
||||
exclude '**/*BenchmarkTest*'
|
||||
workingDir = "../"
|
||||
}
|
||||
|
||||
tasks.register('generateJavaDocs', Javadoc) {
|
||||
source = sourceSets.main.allJava
|
||||
classpath = sourceSets.main.compileClasspath
|
||||
destinationDir = file("${projectDir}/build/docs")
|
||||
|
||||
options.addBooleanOption("Xdoclint:html,missing,reference,syntax", true)
|
||||
options.addBooleanOption('html5', true)
|
||||
|
||||
if (JavaVersion.current().isJava8Compatible() && project.hasProperty('docWarningsAsErrors')) {
|
||||
// Treat javadoc warnings as errors.
|
||||
//
|
||||
// The second argument '-quiet' is a hack. The one parameter
|
||||
// addStringOption() doesn't work, so we add '-quiet', which is added
|
||||
// anyway by gradle. See https://github.com/gradle/gradle/issues/2354.
|
||||
//
|
||||
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
|
||||
// for information about the nonstandard -Xwerror option. JDK 15+ has
|
||||
// -Werror.
|
||||
options.addStringOption('Xwerror', '-quiet')
|
||||
}
|
||||
|
||||
if (JavaVersion.current().isJava11Compatible()) {
|
||||
if (!JavaVersion.current().isJava12Compatible()) {
|
||||
options.addBooleanOption('-no-module-directories', true)
|
||||
}
|
||||
doLast {
|
||||
// This is a work-around for https://bugs.openjdk.java.net/browse/JDK-8211194. Can be removed once that issue is fixed on JDK's side
|
||||
// Since JDK 11, package-list is missing from javadoc output files and superseded by element-list file, but a lot of external tools still need it
|
||||
// Here we generate this file manually
|
||||
new File(destinationDir, 'package-list').text = new File(destinationDir, 'element-list').text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jacoco {
|
||||
toolVersion = "0.8.10"
|
||||
reportsDirectory = layout.buildDirectory.dir('customJacocoReportDir')
|
||||
}
|
||||
|
||||
jacocoTestReport {
|
||||
dependsOn testHeadless
|
||||
|
||||
reports {
|
||||
xml.required = true
|
||||
csv.required = false
|
||||
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
classDirectories.setFrom(files(classDirectories.files.collect {
|
||||
fileTree(dir: it,
|
||||
exclude: "edu/wpi/**"
|
||||
)
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
// Configure Native-Utils WPI Plugin
|
||||
nativeUtils.addWpiNativeUtils()
|
||||
nativeUtils.withCrossRoboRIO()
|
||||
nativeUtils.withCrossLinuxArm32()
|
||||
nativeUtils.withCrossLinuxArm64()
|
||||
|
||||
// Configure WPI dependencies.
|
||||
nativeUtils.wpi.configureDependencies {
|
||||
wpiVersion = wpilibVersion
|
||||
wpimathVersion = wpimathVersion
|
||||
opencvYear = 'frc'+openCVYear
|
||||
opencvVersion = openCVversion
|
||||
googleTestYear = "frc2024"
|
||||
googleTestVersion = "1.14.0-1"
|
||||
niLibVersion = "2025.0.0"
|
||||
}
|
||||
|
||||
// Configure warnings and errors
|
||||
nativeUtils.wpi.addWarnings()
|
||||
nativeUtils.wpi.addWarningsAsErrors()
|
||||
|
||||
nativeUtils.setSinglePrintPerPlatform()
|
||||
|
||||
// Enable builds for all platforms.
|
||||
model {
|
||||
components {
|
||||
all {
|
||||
nativeUtils.useAllPlatforms(it)
|
||||
}
|
||||
}
|
||||
binaries {
|
||||
withType(NativeBinarySpec).all {
|
||||
nativeUtils.usePlatformArguments(it)
|
||||
if (it.toolChain instanceof GccCompatibleToolChain) {
|
||||
it.cppCompiler.args << "-Wno-deprecated-enum-enum-conversion"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task copyAllOutputs(type: Copy) {
|
||||
def outputsFolder = file("$project.buildDir/outputs")
|
||||
destinationDir outputsFolder
|
||||
}
|
||||
|
||||
ext.addTaskToCopyAllOutputs = { task ->
|
||||
copyAllOutputs.dependsOn task
|
||||
copyAllOutputs.inputs.file task.archiveFile
|
||||
copyAllOutputs.from task.archiveFile
|
||||
}
|
||||
|
||||
// Add debug path to binaries.
|
||||
ext.appendDebugPathToBinaries = { binaries ->
|
||||
binaries.withType(StaticLibraryBinarySpec) {
|
||||
if (it.buildType.name.contains('debug')) {
|
||||
def staticFileDir = it.staticLibraryFile.parentFile
|
||||
def staticFileName = it.staticLibraryFile.name
|
||||
def staticFileExtension = staticFileName.substring(staticFileName.lastIndexOf('.'))
|
||||
staticFileName = staticFileName.substring(0, staticFileName.lastIndexOf('.'))
|
||||
staticFileName = staticFileName + 'd' + staticFileExtension
|
||||
def newStaticFile = new File(staticFileDir, staticFileName)
|
||||
it.staticLibraryFile = newStaticFile
|
||||
}
|
||||
}
|
||||
binaries.withType(SharedLibraryBinarySpec) {
|
||||
if (it.buildType.name.contains('debug')) {
|
||||
def sharedFileDir = it.sharedLibraryFile.parentFile
|
||||
def sharedFileName = it.sharedLibraryFile.name
|
||||
def sharedFileExtension = sharedFileName.substring(sharedFileName.lastIndexOf('.'))
|
||||
sharedFileName = sharedFileName.substring(0, sharedFileName.lastIndexOf('.'))
|
||||
sharedFileName = sharedFileName + 'd' + sharedFileExtension
|
||||
def newSharedFile = new File(sharedFileDir, sharedFileName)
|
||||
|
||||
def sharedLinkFileDir = it.sharedLibraryLinkFile.parentFile
|
||||
def sharedLinkFileName = it.sharedLibraryLinkFile.name
|
||||
def sharedLinkFileExtension = sharedLinkFileName.substring(sharedLinkFileName.lastIndexOf('.'))
|
||||
sharedLinkFileName = sharedLinkFileName.substring(0, sharedLinkFileName.lastIndexOf('.'))
|
||||
sharedLinkFileName = sharedLinkFileName + 'd' + sharedLinkFileExtension
|
||||
def newLinkFile = new File(sharedLinkFileDir, sharedLinkFileName)
|
||||
|
||||
it.sharedLibraryLinkFile = newLinkFile
|
||||
it.sharedLibraryFile = newSharedFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create ZIP tasks for each component.
|
||||
ext.createComponentZipTasks = { components, names, base, type, project, func ->
|
||||
def stringNames = names.collect { it.toString() }
|
||||
def configMap = [:]
|
||||
components.each {
|
||||
if (it in NativeLibrarySpec && stringNames.contains(it.name)) {
|
||||
it.binaries.each {
|
||||
if (!it.buildable) return
|
||||
def target = nativeUtils.getPublishClassifier(it)
|
||||
if (configMap.containsKey(target)) {
|
||||
configMap.get(target).add(it)
|
||||
} else {
|
||||
configMap.put(target, [])
|
||||
configMap.get(target).add(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
def taskList = []
|
||||
def outputsFolder = file("$project.buildDir/outputs")
|
||||
configMap.each { key, value ->
|
||||
def task = project.tasks.create(base + "-${key}", type) {
|
||||
description = 'Creates component archive for platform ' + key
|
||||
destinationDirectory = outputsFolder
|
||||
archiveClassifier = key
|
||||
archiveBaseName = base
|
||||
duplicatesStrategy = 'exclude'
|
||||
|
||||
from(licenseFile) {
|
||||
into '/'
|
||||
}
|
||||
|
||||
func(it, value)
|
||||
}
|
||||
taskList.add(task)
|
||||
|
||||
project.build.dependsOn task
|
||||
|
||||
project.artifacts {
|
||||
task
|
||||
}
|
||||
addTaskToCopyAllOutputs(task)
|
||||
}
|
||||
return taskList
|
||||
}
|
||||
|
||||
ext.createAllCombined = { list, name, base, type, project ->
|
||||
def outputsFolder = file("$project.buildDir/outputs")
|
||||
|
||||
def task = project.tasks.create(base + "-all", type) {
|
||||
description = "Creates component archive for all classifiers"
|
||||
destinationDirectory = outputsFolder
|
||||
classifier = "all"
|
||||
archiveBaseName = base
|
||||
duplicatesStrategy = 'exclude'
|
||||
|
||||
list.each {
|
||||
if (it.name.endsWith('debug')) return
|
||||
from project.zipTree(it.archiveFile)
|
||||
dependsOn it
|
||||
}
|
||||
}
|
||||
|
||||
project.build.dependsOn task
|
||||
|
||||
project.artifacts {
|
||||
task
|
||||
}
|
||||
|
||||
return task
|
||||
}
|
||||
|
||||
// Create the standard ZIP format for the dependencies.
|
||||
ext.includeStandardZipFormat = { task, value ->
|
||||
value.each { binary ->
|
||||
if (binary.buildable) {
|
||||
if (binary instanceof SharedLibraryBinarySpec) {
|
||||
task.dependsOn binary.tasks.link
|
||||
task.from(new File(binary.sharedLibraryFile.absolutePath + ".debug")) {
|
||||
into nativeUtils.getPlatformPath(binary) + '/shared'
|
||||
}
|
||||
def sharedPath = binary.sharedLibraryFile.absolutePath
|
||||
sharedPath = sharedPath.substring(0, sharedPath.length() - 4)
|
||||
|
||||
task.from(new File(sharedPath + '.pdb')) {
|
||||
into nativeUtils.getPlatformPath(binary) + '/shared'
|
||||
}
|
||||
task.from(binary.sharedLibraryFile) {
|
||||
into nativeUtils.getPlatformPath(binary) + '/shared'
|
||||
}
|
||||
task.from(binary.sharedLibraryLinkFile) {
|
||||
into nativeUtils.getPlatformPath(binary) + '/shared'
|
||||
}
|
||||
} else if (binary instanceof StaticLibraryBinarySpec) {
|
||||
task.dependsOn binary.tasks.createStaticLib
|
||||
task.from(binary.staticLibraryFile) {
|
||||
into nativeUtils.getPlatformPath(binary) + '/static'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'com.google.protobuf'
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
javadoc {
|
||||
options {
|
||||
encoding = 'UTF-8'
|
||||
links "https://github.wpilib.org/allwpilib/docs/release/java/"
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from licenseFile
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
archiveClassifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
from licenseFile
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
archiveClassifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
from licenseFile
|
||||
}
|
||||
|
||||
task outputJar(type: Jar, dependsOn: classes) {
|
||||
archiveBaseName = javaBaseName
|
||||
destinationDirectory = outputsFolder
|
||||
from sourceSets.main.output
|
||||
from licenseFile
|
||||
}
|
||||
|
||||
task outputSourcesJar(type: Jar, dependsOn: classes) {
|
||||
archiveBaseName = javaBaseName
|
||||
destinationDirectory = outputsFolder
|
||||
archiveClassifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
from licenseFile
|
||||
}
|
||||
|
||||
task outputJavadocJar(type: Jar, dependsOn: javadoc) {
|
||||
archiveBaseName = javaBaseName
|
||||
destinationDirectory = outputsFolder
|
||||
archiveClassifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
from licenseFile
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
finalizedBy jacocoTestReport
|
||||
}
|
||||
|
||||
wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
|
||||
|
||||
dependencies {
|
||||
if(project.hasProperty('includePhotonTargeting')) {
|
||||
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.wpilibJava("wpiunits")
|
||||
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + openCVYear, 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();
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
import java.security.MessageDigest
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
def outputsFolder = file("$buildDir/outputs")
|
||||
|
||||
def baseArtifactId = nativeName
|
||||
def artifactGroupId = 'org.photonvision'
|
||||
def zipBaseName = "_GROUP_org_photonvision_${baseArtifactId}_ID_${baseArtifactId}-cpp_CLS"
|
||||
|
||||
def licenseFile = ext.licenseFile
|
||||
// Quick hack to make this name visible to photon-lib for combined
|
||||
ext.zipBaseName = zipBaseName
|
||||
ext.artifactGroupId = artifactGroupId
|
||||
|
||||
task cppSourcesZip(type: Zip) {
|
||||
destinationDirectory = outputsFolder
|
||||
archiveBaseName = zipBaseName
|
||||
archiveClassifier = "sources"
|
||||
|
||||
from(licenseFile) {
|
||||
into '/'
|
||||
}
|
||||
|
||||
from("$projectDir/src/main/native/cpp") {
|
||||
into '/'
|
||||
}
|
||||
|
||||
// assume we will always have proto sources
|
||||
from("$buildDir/generated/source/proto/main/cpp") {
|
||||
into '/'
|
||||
// Only include generated C++ source files, not headers
|
||||
include "**/*.cc", "**/*.cpp"
|
||||
}
|
||||
dependsOn generateProto
|
||||
}
|
||||
|
||||
task cppHeadersZip(type: Zip) {
|
||||
destinationDirectory = outputsFolder
|
||||
archiveBaseName = zipBaseName
|
||||
archiveClassifier = "headers"
|
||||
|
||||
from(licenseFile) {
|
||||
into '/'
|
||||
}
|
||||
|
||||
ext.includeDirs = [
|
||||
project.file('src/main/native/include')
|
||||
]
|
||||
|
||||
ext.includeDirs.each {
|
||||
from(it) {
|
||||
into '/'
|
||||
}
|
||||
}
|
||||
|
||||
// assume we will always have proto sources
|
||||
from("$buildDir/generated/source/proto/main/cpp") {
|
||||
into '/'
|
||||
// Only include generated C++ headers
|
||||
include "**/*.h"
|
||||
}
|
||||
dependsOn generateProto
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives cppHeadersZip
|
||||
archives cppSourcesZip
|
||||
}
|
||||
|
||||
addTaskToCopyAllOutputs(cppSourcesZip)
|
||||
addTaskToCopyAllOutputs(cppHeadersZip)
|
||||
|
||||
model {
|
||||
publishing {
|
||||
def cppTaskList = createComponentZipTasks($.components, [
|
||||
nativeName,
|
||||
"${nativeName}JNI"
|
||||
], zipBaseName, Zip, project, includeStandardZipFormat)
|
||||
|
||||
publications {
|
||||
cpp(MavenPublication) {
|
||||
cppTaskList.each {
|
||||
artifact it
|
||||
}
|
||||
artifact cppHeadersZip
|
||||
artifact cppSourcesZip
|
||||
|
||||
artifactId = "${baseArtifactId}-cpp"
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user