diff --git a/build.gradle b/build.gradle index 013b47c265..e5e5db2380 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,18 @@ allprojects { repositories { mavenCentral() } + + ext.ntcoreDep = { lang, classifier, extension = null -> + return "edu.wpi.first.wpilib.networktables.$lang:NetworkTables:+:$classifier${extension == null ? '' : '@' + extension}" + } + + ext.cscoreDep = { lang, classifier, extension = null -> + return "edu.wpi.cscore.$lang:cscore:+:$classifier${extension == null ? '' : '@' + extension}" + } + + ext.wpiUtilDep = { classifier -> + return "edu.wpi.first.wpilib:wpiutil:+:$classifier@zip" + } } subprojects { diff --git a/wpilibj/athena.gradle b/wpilibj/athena.gradle index 925356bce3..488c41de8a 100644 --- a/wpilibj/athena.gradle +++ b/wpilibj/athena.gradle @@ -2,7 +2,7 @@ apply plugin: 'cpp' def jniDir = 'src/athena/cpp' def generatedJNIHeaderLoc = "$buildDir/include" -def ntSourceDir = "$buildDir/ntSources" +def docSource = "$buildDir/docSource" debugStripSetup(project) @@ -10,14 +10,18 @@ sourceSets { athena } +configurations.create('doc') + dependencies { athenaCompile sourceSets.shared.output - athenaCompile 'edu.wpi.first.wpilib.networktables.java:NetworkTables:+:arm' - athenaRuntime 'edu.wpi.first.wpilib.networktables.java:NetworkTables:+:arm' - athenaCompile 'edu.wpi.cscore.java:cscore:+:arm' - athenaRuntime 'edu.wpi.cscore.java:cscore:+:arm' + athenaCompile ntcoreDep('java', 'arm') + athenaRuntime ntcoreDep('java', 'arm') + athenaCompile cscoreDep('java', 'arm') + athenaRuntime cscoreDep('java', 'arm') athenaCompile 'org.opencv:opencv-java:+' athenaRuntime 'org.opencv:opencv-java:+' + doc ntcoreDep('java', 'sources') + doc cscoreDep('java', 'sources') } defineWpiUtilProperties() @@ -108,26 +112,16 @@ task wpilibjSources(type: Jar, dependsOn: classes) { from sourceSets.shared.allJava } -task unzipJavaNtSources(type: Copy) { - description = 'Unzips the java networktables sources for doc creation' - group = 'WPILib' - doFirst { - def ntSourcesDependency = - project.dependencies.create('edu.wpi.first.wpilib.networktables.java:NetworkTables:+:sources@jar') - def ntSourcesConfig = project.configurations.detachedConfiguration(ntSourcesDependency) - ntSourcesDependency.setTransitive(false) - def ntSources = ntSourcesConfig.singleFile - } - doLast { - from zipTree(ntSources) - exclude 'META-INF/*' - into ntSourceDir +task unzipDocSources(type: Copy) { + configurations.doc.files.each { + from zipTree(it) } + include '**/*.java' + into docSource } task javadoc(type: Javadoc, overwrite: true) { - dependsOn unzipJavaNtSources - source sourceSets.athena.allJava, sourceSets.shared.allJava, unzipJavaNtSources.outputs.files + source sourceSets.athena.allJava, sourceSets.shared.allJava, unzipDocSources 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" @@ -215,5 +209,5 @@ build.dependsOn wpilibjNativeLibraries clean { delete generatedJNIHeaderLoc - delete ntSourceDir + delete docSource }