Skip to content

Commit

Permalink
Closes mozilla-mobile#691: Dokka: Generate aggregated API docs
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
  • Loading branch information
pocmo and csadilek committed Sep 6, 2018
1 parent 5e76969 commit 8348777
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ allprojects {
}
}

configurations {
dokkapath
dokkapath.description = "dokka project classpath"
}

subprojects {
apply plugin: 'jacoco'
apply plugin: 'org.jetbrains.dokka-android'
Expand All @@ -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") {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 8348777

Please sign in to comment.