diff --git a/.gitignore b/.gitignore index 7d0fcc8b08..d977b2b337 100644 --- a/.gitignore +++ b/.gitignore @@ -175,3 +175,6 @@ __pycache__ #catkin stuff package.xml + +# Doxygen stuff +NO \ No newline at end of file diff --git a/wpilibc/athena.gradle b/wpilibc/athena.gradle index da49c5d7df..26bccfc616 100644 --- a/wpilibc/athena.gradle +++ b/wpilibc/athena.gradle @@ -1,5 +1,7 @@ defineNetworkTablesProperties() +def ntSourceDir = "$buildDir/ntSources" + model { components { wpilib_nonshared(NativeLibrarySpec) { @@ -93,7 +95,6 @@ tasks.whenTaskAdded { task -> } } - // Add the hal static and shared libraries as a dependency project(':hal').tasks.whenTaskAdded { task -> if (task.name == 'hALAthenaStaticLibrary' || task.name == 'hALAthenaSharedLibrary') { @@ -101,10 +102,72 @@ project(':hal').tasks.whenTaskAdded { task -> } } +if (checkDoxygen()) { + + def ntSourcesDependency = project.dependencies.create('edu.wpi.first.wpilib.networktables.cpp:NetworkTables:3.0.0-SNAPSHOT:sources@zip') + def ntSourcesConfig = project.configurations.detachedConfiguration(ntSourcesDependency) + ntSourcesDependency.setTransitive(false) + def ntSources = ntSourcesConfig.singleFile + + task unzipCppNtSources(type: Copy) { + description = 'Unzips the C++ networktables sources for doc creation' + group = 'WPILib' + from zipTree(ntSources) + exclude 'META-INF/*' + into ntSourceDir + } + + doxygen { + def halLocation = '../hal' + source file("${project.shared}/src") + source file("${project.shared}/include") + source file("${project.athena}/src") + source file("${project.athena}/include") + source file("$ntSourceDir/src") + source file("$ntSourceDir/include") + source file("$halLocation/shared") + source file("$halLocation/Athena") + source file("$halLocation/include") + // template file('cpp.doxy') + exclude 'pcre.h' + exclude 'nivision.h' + project_name 'WPILibC++' + javadoc_autobrief true + recursive true + quiet true + warnings false + warn_if_doc_error false + warn_no_paramdoc false + warn_format false + warn_logfile false + warn_if_undocumented false + generate_latex false + html_timestamp true + generate_treeview true + outputDir file("$buildDir/docs") + } + + doxygen.dependsOn unzipCppNtSources + + task doxygenZip(type: Zip) { + description = 'Generates doxygen zip file for publishing' + group = 'WPILib' + dependsOn doxygen + from doxygen.outputDir + } +} + publishing { publications { wpilibc(MavenPublication) { artifact wpilibcZip + + if (checkDoxygen()) { + artifact (doxygenZip) { + classifier = 'doxygen' + } + } + groupId 'edu.wpi.first.wpilib.cmake' artifactId 'cpp-root' version '1.0.0' @@ -113,3 +176,7 @@ publishing { setupWpilibRepo(it) } + +clean { + ntSourceDir +} diff --git a/wpilibc/build.gradle b/wpilibc/build.gradle index b535cad0ad..959aaefe68 100644 --- a/wpilibc/build.gradle +++ b/wpilibc/build.gradle @@ -1,5 +1,8 @@ -apply plugin: 'cpp' -apply plugin: 'maven-publish' +plugins { + id 'org.ysb33r.doxygen' version '0.2' + id 'cpp' + id 'maven-publish' +} evaluationDependsOn(':hal') @@ -9,7 +12,7 @@ ext.simulation = 'simluation' // Attempts to execute the doxygen command. If there is no exception, doxygen exists, so return true. If there's // an IOException, it doesn't exist, so return false -boolean checkDoxygen() { +ext.checkDoxygen = { try { 'doxygen'.execute() true diff --git a/wpilibj/athena.gradle b/wpilibj/athena.gradle index d30d3f654a..9193557a0d 100644 --- a/wpilibj/athena.gradle +++ b/wpilibj/athena.gradle @@ -2,6 +2,7 @@ apply plugin: 'cpp' def jniDir = 'src/athena/cpp' def generatedJNIHeaderLoc = "$buildDir/include" +def ntSourceDir = "$buildDir/ntSources" sourceSets { athena @@ -103,8 +104,23 @@ task wpilibjSources(type: Jar, dependsOn: classes) { from sourceSets.shared.allJava } +def ntSourcesDependency = + project.dependencies.create('edu.wpi.first.wpilib.networktables.java:NetworkTables:3.0.0-SNAPSHOT:sources@jar') +def ntSourcesConfig = project.configurations.detachedConfiguration(ntSourcesDependency) +ntSourcesDependency.setTransitive(false) +def ntSources = ntSourcesConfig.singleFile + +task unzipJavaNtSources(type: Copy) { + description = 'Unzips the java networktables sources for doc creation' + group = 'WPILib' + from zipTree(ntSources) + exclude 'META-INF/*' + into ntSourceDir +} + task javadoc(type: Javadoc, overwrite: true) { - source sourceSets.athena.allJava, sourceSets.shared.allJava + dependsOn unzipJavaNtSources + source sourceSets.athena.allJava, sourceSets.shared.allJava, unzipJavaNtSources.outputs.files classpath = files([sourceSets.athena.compileClasspath, sourceSets.shared.compileClasspath]) javadoc.options.links("http://docs.oracle.com/javase/8/docs/api/") options.addStringOption "tag", "pre:a:Pre-Condition" @@ -158,4 +174,5 @@ task jniHeaders { clean { delete generatedJNIHeaderLoc + delete ntSourceDir }