2019-01-29 13:21:02 +00:00
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
|
|
2019-01-28 17:32:29 +00:00
|
|
|
import java.nio.file.Files
|
|
|
|
|
2017-03-24 14:43:45 +00:00
|
|
|
apply plugin: 'org.jetbrains.dokka'
|
2017-03-28 15:12:38 +00:00
|
|
|
apply plugin: 'kotlin'
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile rootProject
|
|
|
|
}
|
2017-03-24 14:43:45 +00:00
|
|
|
|
2018-01-25 15:26:13 +00:00
|
|
|
def internalPackagePrefixes(sourceDirs) {
|
|
|
|
def prefixes = []
|
|
|
|
// Kotlin allows packages to deviate from the directory structure, but let's assume they don't:
|
|
|
|
sourceDirs.collect { sourceDir ->
|
|
|
|
sourceDir.traverse(type: groovy.io.FileType.DIRECTORIES) {
|
|
|
|
if (it.name == 'internal') {
|
|
|
|
prefixes.add sourceDir.toPath().relativize(it.toPath()).toString().replace(File.separator, '.')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prefixes
|
|
|
|
}
|
|
|
|
|
2017-10-20 09:06:53 +00:00
|
|
|
ext {
|
|
|
|
// TODO: Add '../client/jfx/src/main/kotlin' and '../client/mock/src/main/kotlin' if we decide to make them into public API
|
2018-12-19 18:02:51 +00:00
|
|
|
dokkaSourceDirs = files('../core/src/main/kotlin', '../client/rpc/src/main/kotlin', '../finance/workflows/src/main/kotlin', '../finance/contracts/src/main/kotlin', '../client/jackson/src/main/kotlin',
|
2019-01-29 13:21:02 +00:00
|
|
|
'../testing/test-utils/src/main/kotlin', '../testing/node-driver/src/main/kotlin')
|
2018-01-25 15:26:13 +00:00
|
|
|
internalPackagePrefixes = internalPackagePrefixes(dokkaSourceDirs)
|
2017-10-20 09:06:53 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 14:43:45 +00:00
|
|
|
dokka {
|
2017-03-28 15:12:38 +00:00
|
|
|
outputDirectory = file("${rootProject.rootDir}/docs/build/html/api/kotlin")
|
2017-03-24 14:43:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
|
|
|
|
outputFormat = "javadoc"
|
2017-03-28 15:12:38 +00:00
|
|
|
outputDirectory = file("${rootProject.rootDir}/docs/build/html/api/javadoc")
|
2018-01-25 15:26:13 +00:00
|
|
|
}
|
2017-09-04 10:33:21 +00:00
|
|
|
|
2018-01-25 15:26:13 +00:00
|
|
|
[dokka, dokkaJavadoc].collect {
|
|
|
|
it.configure {
|
|
|
|
moduleName = 'corda'
|
|
|
|
processConfigurations = ['compile']
|
|
|
|
sourceDirs = dokkaSourceDirs
|
|
|
|
includes = ['packages.md']
|
|
|
|
jdkVersion = 8
|
|
|
|
externalDocumentationLink {
|
|
|
|
url = new URL("http://fasterxml.github.io/jackson-core/javadoc/2.8/")
|
|
|
|
}
|
|
|
|
externalDocumentationLink {
|
|
|
|
url = new URL("https://docs.oracle.com/javafx/2/api/")
|
|
|
|
}
|
|
|
|
externalDocumentationLink {
|
|
|
|
url = new URL("http://www.bouncycastle.org/docs/docs1.5on/")
|
|
|
|
}
|
|
|
|
internalPackagePrefixes.collect { packagePrefix ->
|
|
|
|
packageOptions {
|
|
|
|
prefix = packagePrefix
|
|
|
|
suppress = true
|
|
|
|
}
|
|
|
|
}
|
2017-09-04 10:33:21 +00:00
|
|
|
}
|
2017-03-24 14:43:45 +00:00
|
|
|
}
|
|
|
|
|
2017-03-28 13:59:16 +00:00
|
|
|
task buildDocs(dependsOn: ['apidocs', 'makeDocs'])
|
2017-03-28 15:12:38 +00:00
|
|
|
task apidocs(dependsOn: ['dokka', 'dokkaJavadoc'])
|
|
|
|
|
2019-01-29 13:21:02 +00:00
|
|
|
task makeDocs(type: Exec) {
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
2019-01-29 16:29:16 +00:00
|
|
|
commandLine "docker", "run", "--rm", "-v", "${project.projectDir}:/opt/docs_builder", "corda/docs-builder:latest", "bash", "-c", "make-docsite.sh"
|
2019-01-29 13:21:02 +00:00
|
|
|
} else {
|
|
|
|
commandLine "bash", "-c", "docker run --rm --user \$(id -u):\$(id -g) -v ${project.projectDir}:/opt/docs_builder corda/docs-builder:latest bash -c make-docsite.sh"
|
2019-01-28 17:32:29 +00:00
|
|
|
}
|
2017-03-24 14:43:45 +00:00
|
|
|
}
|
|
|
|
|
2017-04-03 15:45:55 +00:00
|
|
|
apidocs.shouldRunAfter makeDocs
|