Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 1 | plugins { |
| 2 | id 'java' |
| 3 | id "org.ysb33r.doxygen" version "0.5" |
| 4 | } |
| 5 | |
| 6 | evaluationDependsOn(':wpiutil') |
| 7 | evaluationDependsOn(':ntcore') |
| 8 | evaluationDependsOn(':cscore') |
| 9 | evaluationDependsOn(':hal') |
| 10 | evaluationDependsOn(':cameraserver') |
| 11 | evaluationDependsOn(':wpilibc') |
| 12 | evaluationDependsOn(':wpilibj') |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 13 | evaluationDependsOn(':wpilibOldCommands') |
| 14 | evaluationDependsOn(':wpilibNewCommands') |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 15 | |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 16 | def baseArtifactIdCpp = 'documentation' |
| 17 | def artifactGroupIdCpp = 'edu.wpi.first.wpilibc' |
| 18 | def zipBaseNameCpp = '_GROUP_edu_wpi_first_wpilibc_ID_documentation_CLS' |
| 19 | |
| 20 | def baseArtifactIdJava = 'documentation' |
| 21 | def artifactGroupIdJava = 'edu.wpi.first.wpilibj' |
| 22 | def zipBaseNameJava = '_GROUP_edu_wpi_first_wpilibj_ID_documentation_CLS' |
| 23 | |
| 24 | def outputsFolder = file("$project.buildDir/outputs") |
| 25 | |
| 26 | def cppProjectZips = [] |
| 27 | |
| 28 | cppProjectZips.add(project(':hal').cppHeadersZip) |
| 29 | cppProjectZips.add(project(':wpiutil').cppHeadersZip) |
| 30 | cppProjectZips.add(project(':ntcore').cppHeadersZip) |
| 31 | cppProjectZips.add(project(':cscore').cppHeadersZip) |
| 32 | cppProjectZips.add(project(':cameraserver').cppHeadersZip) |
| 33 | cppProjectZips.add(project(':wpilibc').cppHeadersZip) |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 34 | cppProjectZips.add(project(':wpilibOldCommands').cppHeadersZip) |
| 35 | cppProjectZips.add(project(':wpilibNewCommands').cppHeadersZip) |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 36 | |
| 37 | doxygen { |
| 38 | executables { |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 39 | doxygen version : '1.8.16' |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 40 | } |
| 41 | } |
| 42 | |
| 43 | doxygen { |
| 44 | generate_html true |
| 45 | |
| 46 | cppProjectZips.each { |
| 47 | dependsOn it |
| 48 | source it.source |
| 49 | } |
| 50 | |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 51 | exclude 'Eigen/**' |
| 52 | exclude 'unsupported/**' |
| 53 | exclude 'units/**' |
| 54 | exclude 'uv.h' |
| 55 | exclude 'uv/**' |
| 56 | |
| 57 | |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 58 | extension_mapping 'inc=C++' |
| 59 | project_name 'WPILibC++' |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 60 | project_number wpilibVersioning.version.get() |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 61 | javadoc_autobrief true |
| 62 | recursive true |
| 63 | quiet true |
| 64 | warnings false |
| 65 | warn_if_doc_error false |
| 66 | warn_no_paramdoc false |
| 67 | warn_format false |
| 68 | warn_logfile false |
| 69 | warn_if_undocumented false |
| 70 | generate_latex false |
| 71 | use_mathjax true |
| 72 | html_timestamp true |
| 73 | generate_treeview true |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 74 | extract_static true |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | tasks.register("zipCppDocs", Zip) { |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 78 | archiveBaseName = zipBaseNameCpp |
| 79 | destinationDirectory = outputsFolder |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 80 | dependsOn doxygen |
| 81 | from ("$buildDir/docs/doxygen/html") |
| 82 | into '/' |
| 83 | } |
| 84 | |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 85 | // Java |
| 86 | configurations { |
| 87 | javaSource { |
| 88 | transitive false |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | ext { |
| 93 | sharedCvConfigs = [:] |
| 94 | staticCvConfigs = [:] |
| 95 | useJava = true |
| 96 | useCpp = false |
| 97 | skipDev = true |
| 98 | useDocumentation = true |
| 99 | } |
| 100 | |
| 101 | apply from: "${rootDir}/shared/opencv.gradle" |
| 102 | |
| 103 | task generateJavaDocs(type: Javadoc) { |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 104 | classpath += project(":wpiutil").sourceSets.main.compileClasspath |
| 105 | options.links("https://docs.oracle.com/en/java/javase/11/docs/api/") |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 106 | options.addStringOption "tag", "pre:a:Pre-Condition" |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 107 | options.addBooleanOption "Xdoclint:html,missing,reference,syntax", true |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 108 | options.addBooleanOption('html5', true) |
| 109 | dependsOn project(':wpilibj').generateJavaVersion |
| 110 | dependsOn project(':hal').generateUsageReporting |
| 111 | source project(':hal').sourceSets.main.java |
| 112 | source project(':wpiutil').sourceSets.main.java |
| 113 | source project(':cscore').sourceSets.main.java |
| 114 | source project(':ntcore').sourceSets.main.java |
| 115 | source project(':wpilibj').sourceSets.main.java |
| 116 | source project(':cameraserver').sourceSets.main.java |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 117 | source project(':wpilibOldCommands').sourceSets.main.java |
| 118 | source project(':wpilibNewCommands').sourceSets.main.java |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 119 | source configurations.javaSource.collect { zipTree(it) } |
| 120 | include '**/*.java' |
| 121 | failOnError = true |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 122 | options.encoding = 'UTF-8' |
Brian Silverman | 6024609 | 2019-03-02 13:29:58 -0800 | [diff] [blame] | 123 | |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 124 | title = "WPILib API ${wpilibVersioning.version.get()}" |
Brian Silverman | 6024609 | 2019-03-02 13:29:58 -0800 | [diff] [blame] | 125 | ext.entryPoint = "$destinationDir/index.html" |
| 126 | |
| 127 | if (JavaVersion.current().isJava11Compatible()) { |
Brian Silverman | 6024609 | 2019-03-02 13:29:58 -0800 | [diff] [blame] | 128 | doLast { |
| 129 | // 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 |
| 130 | // 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 |
| 131 | // Here we generate this file manually |
| 132 | new File(destinationDir, 'package-list').text = new File(destinationDir, 'element-list').text |
| 133 | } |
| 134 | } |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | tasks.register("zipJavaDocs", Zip) { |
James Kuszmaul | 4b81d30 | 2019-12-14 20:53:14 -0800 | [diff] [blame] | 138 | archiveBaseName = zipBaseNameJava |
| 139 | destinationDirectory = outputsFolder |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 140 | dependsOn generateJavaDocs |
| 141 | from ("$buildDir/docs/javadoc") |
| 142 | into '/' |
| 143 | } |
| 144 | |
| 145 | addTaskToCopyAllOutputs(zipCppDocs) |
| 146 | addTaskToCopyAllOutputs(zipJavaDocs) |
| 147 | |
| 148 | build.dependsOn zipCppDocs |
| 149 | build.dependsOn zipJavaDocs |
| 150 | |
| 151 | apply plugin: 'maven-publish' |
| 152 | |
| 153 | publishing { |
| 154 | publications { |
| 155 | java(MavenPublication) { |
| 156 | artifact zipJavaDocs |
| 157 | |
| 158 | artifactId = "${baseArtifactIdJava}" |
| 159 | groupId artifactGroupIdJava |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 160 | version wpilibVersioning.version.get() |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 161 | } |
| 162 | cpp(MavenPublication) { |
| 163 | artifact zipCppDocs |
| 164 | |
| 165 | artifactId = "${baseArtifactIdCpp}" |
| 166 | groupId artifactGroupIdCpp |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame] | 167 | version wpilibVersioning.version.get() |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 168 | } |
| 169 | } |
| 170 | } |