From 9f8b7d34ceda57c2a52e183dc277f0d21d2c5825 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Tue, 4 Sep 2018 15:42:32 +0200 Subject: [PATCH] Closes #691: Dokka: Generate aggregated API docs Co-authored-by: Christian Sadilek --- build.gradle | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 2e847175345..922ee8ff63b 100644 --- a/build.gradle +++ b/build.gradle @@ -108,12 +108,6 @@ subprojects { warningsAsErrors true abortOnError true } - - task docs(type: org.jetbrains.dokka.gradle.DokkaAndroidTask) { - outputFormat = 'html' - reportUndocumented = false - outputDirectory = "${project.rootDir}/build/javadoc/${project.name}" - } } if (project.hasProperty("coverage") && project.name != "support-test") { @@ -163,6 +157,40 @@ subprojects { } } +evaluationDependsOnChildren() + +task dokka(type: org.jetbrains.dokka.gradle.DokkaAndroidTask, overwrite: true) { + moduleName = "$rootProject.name" + outputDirectory = "$buildDir/javadoc" + outputFormat = "html" + jdkVersion = 7 + + subprojects.findAll { + it.hasProperty("android") && !it.name.startsWith("samples") + }.each { + classpath += files(it.android.getBootClasspath().join(File.pathSeparator)) + it.android.libraryVariants.all { variant -> + classpath += files(variant.javaCompile.classpath.files) + } + } + + sourceDirs = files(subprojects.findAll { + !it.name.startsWith("samples") + }.collect { p -> + def path = new File(p.projectDir, "/src/main/java") + + def relativePath = rootDir.toPath().relativize(path.toPath()).toString() + linkMapping { + dir = path + url = "https://github.com/mozilla-mobile/android-components/blob/master/$relativePath" + suffix = "#L" + } + + return path + }) +} + + task clean(type: Delete) { delete rootProject.buildDir }