mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Java generics are too limited to do what we need. This refactors generic code previously in Unit and Measure into unit-specific classes that can have unit-safe math operations (notably, times and divide) that can return values in known units instead of a wildcarded Measure<?>. Unit-specific measure implementations are automatically generated by ./wpiunits/generate_units.py, which generates generic interfaces and mutable and immutable implementations of those interfaces. These make up the bulk of the diff of this PR (approximately 9300 LOC). This also adds units for angular and linear velocities, accelerations, and momenta; moment of inertia; and torque.
276 lines
8.9 KiB
Groovy
276 lines
8.9 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id "org.ysb33r.doxygen" version "1.0.3"
|
|
}
|
|
|
|
evaluationDependsOn(':apriltag')
|
|
evaluationDependsOn(':cameraserver')
|
|
evaluationDependsOn(':cscore')
|
|
evaluationDependsOn(':epilogue-runtime')
|
|
evaluationDependsOn(':hal')
|
|
evaluationDependsOn(':ntcore')
|
|
evaluationDependsOn(':wpilibNewCommands')
|
|
evaluationDependsOn(':wpilibc')
|
|
evaluationDependsOn(':wpilibj')
|
|
evaluationDependsOn(':wpimath')
|
|
evaluationDependsOn(':wpinet')
|
|
evaluationDependsOn(':wpiunits')
|
|
evaluationDependsOn(':wpiutil')
|
|
|
|
def baseArtifactIdCpp = 'documentation'
|
|
def artifactGroupIdCpp = 'edu.wpi.first.wpilibc'
|
|
def zipBaseNameCpp = '_GROUP_edu_wpi_first_wpilibc_ID_documentation_CLS'
|
|
|
|
def baseArtifactIdJava = 'documentation'
|
|
def artifactGroupIdJava = 'edu.wpi.first.wpilibj'
|
|
def zipBaseNameJava = '_GROUP_edu_wpi_first_wpilibj_ID_documentation_CLS'
|
|
|
|
def outputsFolder = file("$project.buildDir/outputs")
|
|
|
|
def cppProjectZips = []
|
|
def cppIncludeRoots = []
|
|
|
|
cppProjectZips.add(project(':apriltag').cppHeadersZip)
|
|
cppProjectZips.add(project(':cameraserver').cppHeadersZip)
|
|
cppProjectZips.add(project(':cscore').cppHeadersZip)
|
|
cppProjectZips.add(project(':hal').cppHeadersZip)
|
|
cppProjectZips.add(project(':ntcore').cppHeadersZip)
|
|
cppProjectZips.add(project(':wpilibNewCommands').cppHeadersZip)
|
|
cppProjectZips.add(project(':wpilibc').cppHeadersZip)
|
|
cppProjectZips.add(project(':wpimath').cppHeadersZip)
|
|
cppProjectZips.add(project(':wpinet').cppHeadersZip)
|
|
cppProjectZips.add(project(':wpiutil').cppHeadersZip)
|
|
|
|
doxygen {
|
|
// Doxygen binaries are only provided for x86_64 platforms
|
|
// Other platforms will need to provide doxygen via their system
|
|
// See below maven and https://doxygen.nl/download.html for provided binaries
|
|
// Ensure theme.css (from https://github.com/jothepro/doxygen-awesome-css) is compatible with
|
|
// doxygen version when updating
|
|
|
|
String arch = System.getProperty("os.arch");
|
|
if (arch.equals("x86_64") || arch.equals("amd64")) {
|
|
executables {
|
|
doxygen {
|
|
executableByVersion('1.12.0')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
doxygen {
|
|
template 'Doxyfile'
|
|
|
|
cppProjectZips.each {
|
|
dependsOn it
|
|
source it.source
|
|
it.ext.includeDirs.each {
|
|
cppIncludeRoots.add(it.absolutePath)
|
|
}
|
|
}
|
|
|
|
if (project.hasProperty('docWarningsAsErrors')) {
|
|
// apriltag
|
|
exclude 'apriltag_pose.h'
|
|
|
|
// Eigen
|
|
exclude 'Eigen/**'
|
|
exclude 'unsupported/**'
|
|
|
|
// LLVM
|
|
exclude 'wpi/AlignOf.h'
|
|
exclude 'wpi/Casting.h'
|
|
exclude 'wpi/Chrono.h'
|
|
exclude 'wpi/Compiler.h'
|
|
exclude 'wpi/ConvertUTF.h'
|
|
exclude 'wpi/DenseMap.h'
|
|
exclude 'wpi/DenseMapInfo.h'
|
|
exclude 'wpi/Endian.h'
|
|
exclude 'wpi/EpochTracker.h'
|
|
exclude 'wpi/Errc.h'
|
|
exclude 'wpi/Errno.h'
|
|
exclude 'wpi/ErrorHandling.h'
|
|
exclude 'wpi/bit.h'
|
|
exclude 'wpi/fs.h'
|
|
exclude 'wpi/FunctionExtras.h'
|
|
exclude 'wpi/function_ref.h'
|
|
exclude 'wpi/Hashing.h'
|
|
exclude 'wpi/iterator.h'
|
|
exclude 'wpi/iterator_range.h'
|
|
exclude 'wpi/ManagedStatic.h'
|
|
exclude 'wpi/MapVector.h'
|
|
exclude 'wpi/MathExtras.h'
|
|
exclude 'wpi/MemAlloc.h'
|
|
exclude 'wpi/PointerIntPair.h'
|
|
exclude 'wpi/PointerLikeTypeTraits.h'
|
|
exclude 'wpi/PointerUnion.h'
|
|
exclude 'wpi/raw_os_ostream.h'
|
|
exclude 'wpi/raw_ostream.h'
|
|
exclude 'wpi/SmallPtrSet.h'
|
|
exclude 'wpi/SmallSet.h'
|
|
exclude 'wpi/SmallString.h'
|
|
exclude 'wpi/SmallVector.h'
|
|
exclude 'wpi/StringExtras.h'
|
|
exclude 'wpi/StringMap.h'
|
|
exclude 'wpi/SwapByteOrder.h'
|
|
exclude 'wpi/type_traits.h'
|
|
exclude 'wpi/VersionTuple.h'
|
|
exclude 'wpi/WindowsError.h'
|
|
|
|
// fmtlib
|
|
exclude 'fmt/**'
|
|
|
|
// libuv
|
|
exclude 'uv.h'
|
|
exclude 'uv/**'
|
|
exclude 'wpinet/uv/**'
|
|
|
|
// json
|
|
exclude 'wpi/adl_serializer.h'
|
|
exclude 'wpi/byte_container_with_subtype.h'
|
|
exclude 'wpi/detail/**'
|
|
exclude 'wpi/json.h'
|
|
exclude 'wpi/json_fwd.h'
|
|
exclude 'wpi/ordered_map.h'
|
|
exclude 'wpi/thirdparty/**'
|
|
|
|
// memory
|
|
exclude 'wpi/memory/**'
|
|
|
|
// mpack
|
|
exclude 'wpi/mpack.h'
|
|
|
|
// units
|
|
exclude 'units/**'
|
|
}
|
|
|
|
exclude '*.pb.h'
|
|
|
|
// Save space by excluding protobuf and eigen
|
|
exclude 'Eigen/**'
|
|
exclude 'google/protobuf/**'
|
|
|
|
exclude '**/.clang-tidy'
|
|
exclude '**/.clang-format'
|
|
|
|
option 'project_name', 'WPILibC++'
|
|
option 'project_logo', '../wpiutil/src/main/native/resources/wpilib-128.png'
|
|
option 'project_number', wpilibVersioning.version.get()
|
|
option 'strip_from_inc_path', cppIncludeRoots
|
|
option 'strip_from_path', cppIncludeRoots
|
|
|
|
if (project.hasProperty('docWarningsAsErrors')) {
|
|
option 'warn_as_error', 'FAIL_ON_WARNINGS_PRINT'
|
|
}
|
|
}
|
|
|
|
tasks.register("zipCppDocs", Zip) {
|
|
archiveBaseName = zipBaseNameCpp
|
|
destinationDirectory = outputsFolder
|
|
dependsOn doxygen
|
|
from ("$buildDir/docs/doxygen/html")
|
|
into '/'
|
|
}
|
|
|
|
// Java
|
|
configurations {
|
|
javaSource {
|
|
transitive false
|
|
}
|
|
}
|
|
|
|
task generateJavaDocs(type: Javadoc) {
|
|
classpath += project(":wpilibj").sourceSets.main.compileClasspath
|
|
options.links("https://docs.oracle.com/en/java/javase/17/docs/api/")
|
|
options.links("https://docs.opencv.org/4.x/javadoc/")
|
|
options.addStringOption("tag", "pre:a:Pre-Condition")
|
|
options.addBooleanOption("Xdoclint/package:" +
|
|
// TODO: v Document these, then remove them from the list
|
|
"-edu.wpi.first.hal," +
|
|
"-edu.wpi.first.hal.simulation," +
|
|
// TODO: ^ Document these, then remove them from the list
|
|
"-edu.wpi.first.math.proto," +
|
|
"-edu.wpi.first.math.struct," +
|
|
"-edu.wpi.first.math.controller.proto," +
|
|
"-edu.wpi.first.math.controller.struct," +
|
|
"-edu.wpi.first.math.geometry.proto," +
|
|
"-edu.wpi.first.math.geometry.struct," +
|
|
"-edu.wpi.first.math.kinematics.proto," +
|
|
"-edu.wpi.first.math.kinematics.struct," +
|
|
"-edu.wpi.first.math.spline.proto," +
|
|
"-edu.wpi.first.math.spline.struct," +
|
|
"-edu.wpi.first.math.system.proto," +
|
|
"-edu.wpi.first.math.system.struct," +
|
|
"-edu.wpi.first.math.system.plant.proto," +
|
|
"-edu.wpi.first.math.system.plant.struct," +
|
|
"-edu.wpi.first.math.trajectory.proto," +
|
|
// The .measure package contains generated source files for which automatic javadoc
|
|
// generation is very difficult to do meaningfully.
|
|
"-edu.wpi.first.units.measure", true)
|
|
options.addBooleanOption("Xdoclint:html,missing,reference,syntax", true)
|
|
options.addBooleanOption('html5', true)
|
|
options.linkSource(true)
|
|
dependsOn project(':wpilibj').generateJavaVersion
|
|
source project(':apriltag').sourceSets.main.java
|
|
source project(':cameraserver').sourceSets.main.java
|
|
source project(':cscore').sourceSets.main.java
|
|
source project(':epilogue-runtime').sourceSets.main.java
|
|
source project(':hal').sourceSets.main.java
|
|
source project(':ntcore').sourceSets.main.java
|
|
source project(':wpilibNewCommands').sourceSets.main.java
|
|
source project(':wpilibj').sourceSets.main.java
|
|
source project(':wpimath').sourceSets.main.java
|
|
source project(':wpinet').sourceSets.main.java
|
|
source project(':wpiunits').sourceSets.main.java
|
|
source project(':wpiutil').sourceSets.main.java
|
|
source configurations.javaSource.collect { zipTree(it) }
|
|
include '**/*.java'
|
|
failOnError = true
|
|
|
|
title = "WPILib API ${wpilibVersioning.version.get()}"
|
|
ext.entryPoint = "$destinationDir/index.html"
|
|
|
|
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.
|
|
options.addStringOption('Werror', '-quiet')
|
|
}
|
|
}
|
|
|
|
tasks.register("zipJavaDocs", Zip) {
|
|
archiveBaseName = zipBaseNameJava
|
|
destinationDirectory = outputsFolder
|
|
dependsOn generateJavaDocs
|
|
from ("$buildDir/docs/javadoc")
|
|
into '/'
|
|
}
|
|
|
|
tasks.register("zipDocs") {
|
|
dependsOn zipCppDocs
|
|
dependsOn zipJavaDocs
|
|
}
|
|
|
|
apply plugin: 'maven-publish'
|
|
|
|
publishing {
|
|
publications {
|
|
java(MavenPublication) {
|
|
artifact zipJavaDocs
|
|
|
|
artifactId = "${baseArtifactIdJava}"
|
|
groupId artifactGroupIdJava
|
|
version wpilibVersioning.version.get()
|
|
}
|
|
cpp(MavenPublication) {
|
|
artifact zipCppDocs
|
|
|
|
artifactId = "${baseArtifactIdCpp}"
|
|
groupId artifactGroupIdCpp
|
|
version wpilibVersioning.version.get()
|
|
}
|
|
}
|
|
}
|