From 492af709261ef44a1807cec197de3f930c84c7e9 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 | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 2e847175345..4c90ea701dc 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,11 @@ allprojects { } } +configurations { + dokkapath + dokkapath.description = "dokka project classpath" +} + subprojects { apply plugin: 'jacoco' apply plugin: 'org.jetbrains.dokka-android' @@ -108,12 +113,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 +162,41 @@ subprojects { } } +evaluationDependsOnChildren() + +task dokka(type: org.jetbrains.dokka.gradle.DokkaAndroidTask, overwrite: true) { + moduleName = "$rootProject.name" + outputDirectory = "$buildDir/javadoc" + outputFormat = "html" + processConfigurations = ['dokkapath'] + 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 }