mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
177 lines
5.0 KiB
Groovy
177 lines
5.0 KiB
Groovy
// From allwpilib/docs. Licensed under the WPILib BSD License
|
|
apply plugin: "java"
|
|
apply plugin: "org.ysb33r.doxygen"
|
|
|
|
evaluationDependsOn ':photon-targeting'
|
|
evaluationDependsOn ':photon-core'
|
|
evaluationDependsOn ':photon-server'
|
|
evaluationDependsOn ':photon-lib'
|
|
|
|
|
|
def baseArtifactIdCpp = 'documentation'
|
|
def artifactGroupIdCpp = 'org.photonvision.cppdocs'
|
|
def zipBaseNameCpp = '_GROUP_org.photonvision_cpp_ID_documentation_CLS'
|
|
|
|
def baseArtifactIdJava = 'documentation'
|
|
def artifactGroupIdJava = 'org.photonvision.javadocs'
|
|
def zipBaseNameJava = '_GROUP_org.photonvision_java_ID_documentation_CLS'
|
|
|
|
def outputsFolder = file("$project.buildDir/outputs")
|
|
|
|
def cppProjectZips = []
|
|
def cppIncludeRoots = []
|
|
|
|
cppProjectZips.add(project(':photon-lib').cppHeadersZip)
|
|
cppProjectZips.add(project(':photon-targeting').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
|
|
|
|
String arch = System.getProperty("os.arch");
|
|
if (arch.equals("x86_64") || arch.equals("amd64")) {
|
|
executables {
|
|
doxygen {
|
|
executableByVersion('1.12.0')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
doxygen.sourceSets.main {
|
|
cppProjectZips.each {
|
|
doxygenDox.dependsOn it
|
|
sources it.source
|
|
it.ext.includeDirs.each {
|
|
cppIncludeRoots.add(it.absolutePath)
|
|
}
|
|
}
|
|
option 'case_sense_names', false
|
|
option 'extension_mapping', 'inc=C++ no_extension=C++'
|
|
option 'extract_all', true
|
|
option 'extract_static', true
|
|
option 'file_patterns', '*'
|
|
option 'full_path_names', true
|
|
option 'generate_html', true
|
|
option 'generate_latex', false
|
|
option 'generate_treeview', true
|
|
option 'html_extra_stylesheet', 'theme.css'
|
|
option 'html_timestamp', true
|
|
option 'javadoc_autobrief', true
|
|
option 'project_name', 'PhotonVision C++'
|
|
option 'project_logo', '../docs/source/assets/RoundLogo.png'
|
|
option 'project_number', pubVersion
|
|
option 'quiet', true
|
|
option 'recursive', true
|
|
option 'strip_code_comments', false
|
|
option 'strip_from_inc_path', cppIncludeRoots
|
|
option 'strip_from_path', cppIncludeRoots
|
|
option 'use_mathjax', true
|
|
option 'warnings', false
|
|
option 'warn_if_incomplete_doc', true
|
|
option 'warn_if_undocumented', false
|
|
option 'warn_no_paramdoc', true
|
|
|
|
//enable doxygen preprocessor expansion of WPI_DEPRECATED to fix MotorController docs
|
|
option 'enable_preprocessing', true
|
|
option 'macro_expansion', true
|
|
option 'expand_only_predef', true
|
|
option 'predefined', "WPI_DEPRECATED(x)=[[deprecated(x)]]\"\\\n" +
|
|
"\"__cplusplus\"\\\n" +
|
|
"\"HAL_ENUM(name)=enum name : int32_t"
|
|
|
|
if (project.hasProperty('docWarningsAsErrors')) {
|
|
warn_as_error 'FAIL_ON_WARNINGS'
|
|
}
|
|
}
|
|
|
|
tasks.register("zipCppDocs", Zip) {
|
|
archiveBaseName = zipBaseNameCpp
|
|
destinationDirectory = outputsFolder
|
|
dependsOn doxygen
|
|
from ("$buildDir/docs/doxygen/html")
|
|
into '/'
|
|
}
|
|
|
|
// Java
|
|
configurations {
|
|
javaSource {
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
ext {
|
|
sharedCvConfigs = [:]
|
|
staticCvConfigs = [:]
|
|
useJava = true
|
|
useCpp = false
|
|
skipDev = true
|
|
useDocumentation = true
|
|
}
|
|
|
|
task generateJavaDocs(type: Javadoc) {
|
|
def exportedProjects = [
|
|
':photon-targeting',
|
|
':photon-lib'
|
|
]
|
|
|
|
source exportedProjects.collect { project(it).sourceSets.main.allJava }
|
|
classpath = files(exportedProjects.collect { project(it).sourceSets.main.compileClasspath })
|
|
|
|
options.links "https://docs.oracle.com/en/java/javase/17/docs/api/", "https://github.wpilib.org/allwpilib/docs/release/java/"
|
|
options.addStringOption("tag", "pre:a:Pre-Condition")
|
|
options.addBooleanOption("Xdoclint:html,missing,reference,syntax", true)
|
|
options.addBooleanOption('html5', true)
|
|
options.linkSource(true)
|
|
failOnError = true
|
|
|
|
title = "PhotonVision $pubVersion"
|
|
ext.entryPoint = "$destinationDir/index.html"
|
|
|
|
if (project.hasProperty('docWarningsAsErrors')) {
|
|
options.addBooleanOption('Werror', true)
|
|
}
|
|
}
|
|
|
|
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 = pubVersion
|
|
}
|
|
cpp(MavenPublication) {
|
|
artifact zipCppDocs
|
|
|
|
artifactId = "${baseArtifactIdCpp}"
|
|
groupId = artifactGroupIdCpp
|
|
version = pubVersion
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
// Just throw everything into build/maven
|
|
url = localMavenURL
|
|
}
|
|
}
|
|
}
|