-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathgenerate-docs-and-update-website.gradle
56 lines (52 loc) · 1.97 KB
/
generate-docs-and-update-website.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
apply plugin: 'org.jetbrains.dokka'
// versionMajor is defined in build.gradle
def docVersion = "v$versionMajor"
def websiteRootDirectory = "$rootDir/docs"
ext.javadocOutputDirectory = new File("$websiteRootDirectory${File.separator}javadoc${File.separator}$docVersion")
ext.kdocOutputDirectory = new File("$websiteRootDirectory${File.separator}kdoc${File.separator}$docVersion")
/**
* Generates JavaDoc and outputs to $websiteRootDirectory so the library website is auto
* updated on merge to master.
* */
dokkaJavadoc {
outputDirectory = javadocOutputDirectory
suppressInheritedMembers = true
doLast {
new File("$websiteRootDirectory${File.separator}api_doc_versions${File.separator}${docVersion}.javadoc").createNewFile()
}
}
/**
* Generates KotlinDoc and outputs to $websiteRootDirectory so the library website is auto
* updated on merge to master.
* */
dokkaHtml {
outputDirectory = kdocOutputDirectory
suppressInheritedMembers = true
doLast {
new File("$websiteRootDirectory${File.separator}api_doc_versions${File.separator}${docVersion}.kdoc").createNewFile()
}
}
/**
* Generates library documentation in all supported formats. Once these changes are merged to
* master, the library website will be automatically updated.
*
* Dokka (the documentation engine for Kotlin) was still in alpha as of this release, and thus
* contains some bugs and is not fully stable. There is a bug in particular that may happen on
* Windows PCs and cause this task to fail on subsequent runs if there are running Gradle daemons.
*
* To get around this bug, simply run this command with the '--no-daemon' option.
*
* ---------------------
*
* How To Run...
*
* ... on the Command Line:
* ./gradlew --no-daemon clean generateDocsAndUpdateWebsite
*
* ... within Android Studio:
* We recommend not running via AS studio in order to avoid the bug listed above.
* */
task generateDocsAndUpdateWebsite(){
dependsOn dokkaJavadoc
dependsOn dokkaHtml
}