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