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