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