Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 1 | plugins { |
| 2 | id 'java' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 3 | id "org.ysb33r.doxygen" version "0.7.0" |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 4 | } |
| 5 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 6 | evaluationDependsOn(':apriltag') |
| 7 | evaluationDependsOn(':cameraserver') |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 8 | evaluationDependsOn(':cscore') |
| 9 | evaluationDependsOn(':hal') |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 10 | evaluationDependsOn(':ntcore') |
| 11 | evaluationDependsOn(':wpilibNewCommands') |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 12 | evaluationDependsOn(':wpilibc') |
| 13 | evaluationDependsOn(':wpilibj') |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 14 | evaluationDependsOn(':wpimath') |
| 15 | evaluationDependsOn(':wpinet') |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 16 | evaluationDependsOn(':wpiunits') |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 17 | evaluationDependsOn(':wpiutil') |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 18 | |
| 19 | def baseArtifactIdCpp = 'documentation' |
| 20 | def artifactGroupIdCpp = 'edu.wpi.first.wpilibc' |
| 21 | def zipBaseNameCpp = '_GROUP_edu_wpi_first_wpilibc_ID_documentation_CLS' |
| 22 | |
| 23 | def baseArtifactIdJava = 'documentation' |
| 24 | def artifactGroupIdJava = 'edu.wpi.first.wpilibj' |
| 25 | def zipBaseNameJava = '_GROUP_edu_wpi_first_wpilibj_ID_documentation_CLS' |
| 26 | |
| 27 | def outputsFolder = file("$project.buildDir/outputs") |
| 28 | |
| 29 | def cppProjectZips = [] |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 30 | def cppIncludeRoots = [] |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 31 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 32 | cppProjectZips.add(project(':apriltag').cppHeadersZip) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 33 | cppProjectZips.add(project(':cameraserver').cppHeadersZip) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 34 | cppProjectZips.add(project(':cscore').cppHeadersZip) |
| 35 | cppProjectZips.add(project(':hal').cppHeadersZip) |
| 36 | cppProjectZips.add(project(':ntcore').cppHeadersZip) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 37 | cppProjectZips.add(project(':wpilibNewCommands').cppHeadersZip) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 38 | cppProjectZips.add(project(':wpilibc').cppHeadersZip) |
| 39 | cppProjectZips.add(project(':wpimath').cppHeadersZip) |
| 40 | cppProjectZips.add(project(':wpinet').cppHeadersZip) |
| 41 | cppProjectZips.add(project(':wpiutil').cppHeadersZip) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 42 | |
| 43 | doxygen { |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 44 | // Doxygen binaries are only provided for x86_64 platforms |
| 45 | // Other platforms will need to provide doxygen via their system |
| 46 | // See below maven and https://doxygen.nl/download.html for provided binaries |
| 47 | |
| 48 | String arch = System.getProperty("os.arch"); |
| 49 | if (arch.equals("x86_64") || arch.equals("amd64")) { |
| 50 | executables { |
| 51 | doxygen version : '1.9.4', |
| 52 | baseURI : 'https://frcmaven.wpi.edu/artifactory/generic-release-mirror/doxygen' |
| 53 | } |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 54 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | doxygen { |
| 58 | generate_html true |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 59 | html_extra_stylesheet 'theme.css' |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 60 | |
| 61 | cppProjectZips.each { |
| 62 | dependsOn it |
| 63 | source it.source |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 64 | it.ext.includeDirs.each { |
| 65 | cppIncludeRoots.add(it.absolutePath) |
| 66 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 67 | } |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 68 | cppIncludeRoots << '../ntcore/build/generated/main/native/include/' |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 69 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 70 | if (project.hasProperty('docWarningsAsErrors')) { |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 71 | // Eigen |
| 72 | exclude 'Eigen/**' |
| 73 | exclude 'unsupported/**' |
| 74 | |
| 75 | // LLVM |
| 76 | exclude 'wpi/AlignOf.h' |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 77 | exclude 'wpi/Casting.h' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 78 | exclude 'wpi/Chrono.h' |
| 79 | exclude 'wpi/Compiler.h' |
| 80 | exclude 'wpi/ConvertUTF.h' |
| 81 | exclude 'wpi/DenseMap.h' |
| 82 | exclude 'wpi/DenseMapInfo.h' |
| 83 | exclude 'wpi/Endian.h' |
| 84 | exclude 'wpi/EpochTracker.h' |
| 85 | exclude 'wpi/Errc.h' |
| 86 | exclude 'wpi/Errno.h' |
| 87 | exclude 'wpi/ErrorHandling.h' |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 88 | exclude 'wpi/bit.h' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 89 | exclude 'wpi/fs.h' |
| 90 | exclude 'wpi/FunctionExtras.h' |
| 91 | exclude 'wpi/function_ref.h' |
| 92 | exclude 'wpi/Hashing.h' |
| 93 | exclude 'wpi/iterator.h' |
| 94 | exclude 'wpi/iterator_range.h' |
| 95 | exclude 'wpi/ManagedStatic.h' |
| 96 | exclude 'wpi/MapVector.h' |
| 97 | exclude 'wpi/MathExtras.h' |
| 98 | exclude 'wpi/MemAlloc.h' |
| 99 | exclude 'wpi/PointerIntPair.h' |
| 100 | exclude 'wpi/PointerLikeTypeTraits.h' |
| 101 | exclude 'wpi/PointerUnion.h' |
| 102 | exclude 'wpi/raw_os_ostream.h' |
| 103 | exclude 'wpi/raw_ostream.h' |
| 104 | exclude 'wpi/SmallPtrSet.h' |
| 105 | exclude 'wpi/SmallSet.h' |
| 106 | exclude 'wpi/SmallString.h' |
| 107 | exclude 'wpi/SmallVector.h' |
| 108 | exclude 'wpi/StringExtras.h' |
| 109 | exclude 'wpi/StringMap.h' |
| 110 | exclude 'wpi/SwapByteOrder.h' |
| 111 | exclude 'wpi/type_traits.h' |
| 112 | exclude 'wpi/VersionTuple.h' |
| 113 | exclude 'wpi/WindowsError.h' |
| 114 | |
| 115 | // fmtlib |
| 116 | exclude 'fmt/**' |
| 117 | |
| 118 | // libuv |
| 119 | exclude 'uv.h' |
| 120 | exclude 'uv/**' |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 121 | exclude 'wpinet/uv/**' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 122 | |
| 123 | // json |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 124 | exclude 'wpi/adl_serializer.h' |
| 125 | exclude 'wpi/byte_container_with_subtype.h' |
| 126 | exclude 'wpi/detail/**' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 127 | exclude 'wpi/json.h' |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 128 | exclude 'wpi/json_fwd.h' |
| 129 | exclude 'wpi/ordered_map.h' |
| 130 | exclude 'wpi/thirdparty/**' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 131 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 132 | // memory |
| 133 | exclude 'wpi/memory/**' |
| 134 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 135 | // mpack |
| 136 | exclude 'wpi/mpack.h' |
| 137 | |
| 138 | // units |
| 139 | exclude 'units/**' |
| 140 | } |
| 141 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 142 | //TODO: building memory docs causes search to break |
| 143 | exclude 'wpi/memory/**' |
| 144 | |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 145 | exclude '*.pb.h' |
| 146 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 147 | aliases 'effects=\\par <i>Effects:</i>^^', |
| 148 | 'notes=\\par <i>Notes:</i>^^', |
| 149 | 'requires=\\par <i>Requires:</i>^^', |
| 150 | 'requiredbe=\\par <i>Required Behavior:</i>^^', |
| 151 | 'concept{2}=<a href=\"md_doc_concepts.html#\1\">\2</a>', |
| 152 | 'defaultbe=\\par <i>Default Behavior:</i>^^' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 153 | case_sense_names false |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 154 | extension_mapping 'inc=C++', 'no_extension=C++' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 155 | extract_all true |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 156 | extract_static true |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 157 | file_patterns '*' |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 158 | full_path_names true |
| 159 | generate_html true |
| 160 | generate_latex false |
| 161 | generate_treeview true |
| 162 | html_extra_stylesheet 'theme.css' |
| 163 | html_timestamp true |
| 164 | javadoc_autobrief true |
| 165 | project_name 'WPILibC++' |
| 166 | project_logo '../wpiutil/src/main/native/resources/wpilib-128.png' |
| 167 | project_number wpilibVersioning.version.get() |
| 168 | quiet true |
| 169 | recursive true |
| 170 | strip_code_comments false |
| 171 | strip_from_inc_path cppIncludeRoots as String[] |
| 172 | strip_from_path cppIncludeRoots as String[] |
| 173 | use_mathjax true |
| 174 | warnings false |
| 175 | warn_if_incomplete_doc true |
| 176 | warn_if_undocumented false |
| 177 | warn_no_paramdoc true |
| 178 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 179 | //enable doxygen preprocessor expansion of WPI_DEPRECATED to fix MotorController docs |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 180 | enable_preprocessing true |
| 181 | macro_expansion true |
| 182 | expand_only_predef true |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 183 | predefined "WPI_DEPRECATED(x)=[[deprecated(x)]]\"\\\n" + |
| 184 | "\"__cplusplus\"\\\n" + |
| 185 | "\"HAL_ENUM(name)=enum name : int32_t" |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 186 | |
| 187 | if (project.hasProperty('docWarningsAsErrors')) { |
| 188 | warn_as_error 'FAIL_ON_WARNINGS' |
| 189 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | tasks.register("zipCppDocs", Zip) { |
| 193 | archiveBaseName = zipBaseNameCpp |
| 194 | destinationDirectory = outputsFolder |
| 195 | dependsOn doxygen |
| 196 | from ("$buildDir/docs/doxygen/html") |
| 197 | into '/' |
| 198 | } |
| 199 | |
| 200 | // Java |
| 201 | configurations { |
| 202 | javaSource { |
| 203 | transitive false |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | ext { |
| 208 | sharedCvConfigs = [:] |
| 209 | staticCvConfigs = [:] |
| 210 | useJava = true |
| 211 | useCpp = false |
| 212 | skipDev = true |
| 213 | useDocumentation = true |
| 214 | } |
| 215 | |
| 216 | apply from: "${rootDir}/shared/opencv.gradle" |
| 217 | |
| 218 | task generateJavaDocs(type: Javadoc) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 219 | classpath += project(":wpimath").sourceSets.main.compileClasspath |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 220 | options.links("https://docs.oracle.com/en/java/javase/17/docs/api/") |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 221 | options.addStringOption("tag", "pre:a:Pre-Condition") |
| 222 | options.addBooleanOption("Xdoclint:html,missing,reference,syntax", true) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 223 | options.addBooleanOption('html5', true) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 224 | options.linkSource(true) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 225 | dependsOn project(':hal').generateUsageReporting |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 226 | dependsOn project(':ntcore').ntcoreGenerateJavaTypes |
| 227 | dependsOn project(':wpilibj').generateJavaVersion |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 228 | dependsOn project(':wpimath').generateNat |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 229 | source project(':apriltag').sourceSets.main.java |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 230 | source project(':cameraserver').sourceSets.main.java |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 231 | source project(':cscore').sourceSets.main.java |
| 232 | source project(':hal').sourceSets.main.java |
| 233 | source project(':ntcore').sourceSets.main.java |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 234 | source project(':wpilibNewCommands').sourceSets.main.java |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 235 | source project(':wpilibj').sourceSets.main.java |
| 236 | source project(':wpimath').sourceSets.main.java |
| 237 | source project(':wpinet').sourceSets.main.java |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 238 | source project(':wpiunits').sourceSets.main.java |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 239 | source project(':wpiutil').sourceSets.main.java |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 240 | source configurations.javaSource.collect { zipTree(it) } |
| 241 | include '**/*.java' |
| 242 | failOnError = true |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 243 | |
| 244 | title = "WPILib API ${wpilibVersioning.version.get()}" |
| 245 | ext.entryPoint = "$destinationDir/index.html" |
| 246 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 247 | if (JavaVersion.current().isJava8Compatible() && project.hasProperty('docWarningsAsErrors')) { |
| 248 | // Treat javadoc warnings as errors. |
| 249 | // |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 250 | // The second argument '-quiet' is a hack. The one parameter |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 251 | // addStringOption() doesn't work, so we add '-quiet', which is added |
| 252 | // anyway by gradle. See https://github.com/gradle/gradle/issues/2354. |
| 253 | // |
| 254 | // See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363) |
| 255 | // for information about the nonstandard -Xwerror option. JDK 15+ has |
| 256 | // -Werror. |
| 257 | options.addStringOption('Xwerror', '-quiet') |
| 258 | } |
| 259 | |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 260 | if (JavaVersion.current().isJava11Compatible()) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 261 | if (!JavaVersion.current().isJava12Compatible()) { |
| 262 | options.addBooleanOption('-no-module-directories', true) |
| 263 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 264 | doLast { |
| 265 | // 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 |
| 266 | // 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 |
| 267 | // Here we generate this file manually |
| 268 | new File(destinationDir, 'package-list').text = new File(destinationDir, 'element-list').text |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | tasks.register("zipJavaDocs", Zip) { |
| 274 | archiveBaseName = zipBaseNameJava |
| 275 | destinationDirectory = outputsFolder |
| 276 | dependsOn generateJavaDocs |
| 277 | from ("$buildDir/docs/javadoc") |
| 278 | into '/' |
| 279 | } |
| 280 | |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 281 | tasks.register("zipDocs") { |
| 282 | dependsOn zipCppDocs |
| 283 | dependsOn zipJavaDocs |
| 284 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 285 | |
| 286 | apply plugin: 'maven-publish' |
| 287 | |
| 288 | publishing { |
| 289 | publications { |
| 290 | java(MavenPublication) { |
| 291 | artifact zipJavaDocs |
| 292 | |
| 293 | artifactId = "${baseArtifactIdJava}" |
| 294 | groupId artifactGroupIdJava |
| 295 | version wpilibVersioning.version.get() |
| 296 | } |
| 297 | cpp(MavenPublication) { |
| 298 | artifact zipCppDocs |
| 299 | |
| 300 | artifactId = "${baseArtifactIdCpp}" |
| 301 | groupId artifactGroupIdCpp |
| 302 | version wpilibVersioning.version.get() |
| 303 | } |
| 304 | } |
| 305 | } |