aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt7
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt1
-rw-r--r--core/src/main/kotlin/ant/dokka.kt20
-rw-r--r--core/src/main/kotlin/main.kt24
4 files changed, 26 insertions, 26 deletions
diff --git a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
index c1c301f2..c62f9cbf 100644
--- a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
+++ b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
@@ -14,7 +14,8 @@ import org.jetbrains.kotlin.resolve.source.PsiSourceElement
class DeclarationLinkResolver
@Inject constructor(val resolutionFacade: DokkaResolutionFacade,
val refGraph: NodeReferenceGraph,
- val logger: DokkaLogger) {
+ val logger: DokkaLogger,
+ val options: DocumentationOptions) {
fun resolveContentLink(fromDescriptor: DeclarationDescriptor, href: String): ContentBlock {
val symbol = try {
val symbols = resolveKDocLink(resolutionFacade, fromDescriptor, null, href.split('.').toList())
@@ -71,5 +72,5 @@ class DeclarationLinkResolver
return null
}
- private val javadocRoot = "http://docs.oracle.com/javase/6/docs/api/"
-} \ No newline at end of file
+ private val javadocRoot = "http://docs.oracle.com/javase/${options.jdkVersion}/docs/api/"
+}
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index 4694bcdf..f91f160b 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -41,6 +41,7 @@ data class DocumentationOptions(val outputDir: String,
val reportUndocumented: Boolean = true,
val skipEmptyPackages: Boolean = true,
val skipDeprecated: Boolean = false,
+ val jdkVersion: Int = 6,
val sourceLinks: List<SourceLinkDefinition>)
private fun isExtensionForExternalClass(extensionFunctionDescriptor: DeclarationDescriptor,
diff --git a/core/src/main/kotlin/ant/dokka.kt b/core/src/main/kotlin/ant/dokka.kt
index 713bd193..f7441463 100644
--- a/core/src/main/kotlin/ant/dokka.kt
+++ b/core/src/main/kotlin/ant/dokka.kt
@@ -5,6 +5,7 @@ import org.apache.tools.ant.Project
import org.apache.tools.ant.Task
import org.apache.tools.ant.types.Path
import org.apache.tools.ant.types.Reference
+import org.jetbrains.dokka.DocumentationOptions
import org.jetbrains.dokka.DokkaGenerator
import org.jetbrains.dokka.DokkaLogger
import org.jetbrains.dokka.SourceLinkDefinition
@@ -22,6 +23,7 @@ class DokkaAntTask(): Task() {
var moduleName: String? = null
var outputDir: String? = null
var outputFormat: String = "html"
+ var jdkVersion: Int = 6
var skipDeprecated: Boolean = false
@@ -77,14 +79,8 @@ class DokkaAntTask(): Task() {
throw BuildException("Output directory needs to be specified")
}
val sourceLinks = antSourceLinks.map {
- val path = it.path
- if (path == null) {
- throw BuildException("Path attribute of a <sourceLink> element is required")
- }
- val url = it.url
- if (url == null) {
- throw BuildException("Path attribute of a <sourceLink> element is required")
- }
+ val path = it.path ?: throw BuildException("'path' attribute of a <sourceLink> element is required")
+ val url = it.url ?: throw BuildException("'url' attribute of a <sourceLink> element is required")
SourceLinkDefinition(File(path).canonicalFile.absolutePath, url, it.lineSuffix)
}
@@ -98,10 +94,10 @@ class DokkaAntTask(): Task() {
samplesPath.list().toList(),
includesPath.list().toList(),
moduleName!!,
- outputDir!!,
- outputFormat,
- sourceLinks,
- skipDeprecated
+ DocumentationOptions(outputDir!!, outputFormat,
+ skipDeprecated = skipDeprecated,
+ sourceLinks = sourceLinks,
+ jdkVersion = jdkVersion)
)
generator.generate()
}
diff --git a/core/src/main/kotlin/main.kt b/core/src/main/kotlin/main.kt
index 91f30bb0..c54255f5 100644
--- a/core/src/main/kotlin/main.kt
+++ b/core/src/main/kotlin/main.kt
@@ -60,6 +60,8 @@ class DokkaArguments {
@set:Argument(value = "nodeprecated", description = "Exclude deprecated members from documentation")
var nodeprecated: Boolean = false
+ @set:Argument(value = "jdkVersion", description = "Version of JDK to use for linking to JDK JavaDoc")
+ var jdkVersion: Int = 6
}
private fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition {
@@ -86,6 +88,14 @@ fun main(args: Array<String>) {
}
val classPath = arguments.classpath.split(File.pathSeparatorChar).toList()
+
+ val documentationOptions = DocumentationOptions(
+ arguments.outputDir.let { if (it.endsWith('/')) it else it + '/' },
+ arguments.outputFormat,
+ skipDeprecated = arguments.nodeprecated,
+ sourceLinks = sourceLinks
+ )
+
val generator = DokkaGenerator(
DokkaConsoleLogger,
classPath,
@@ -93,10 +103,7 @@ fun main(args: Array<String>) {
samples,
includes,
arguments.moduleName,
- arguments.outputDir.let { if (it.endsWith('/')) it else it + '/' },
- arguments.outputFormat,
- sourceLinks,
- arguments.nodeprecated)
+ documentationOptions)
generator.generate()
DokkaConsoleLogger.report()
@@ -140,23 +147,18 @@ class DokkaGenerator(val logger: DokkaLogger,
val samples: List<String>,
val includes: List<String>,
val moduleName: String,
- val outputDir: String,
- val outputFormat: String,
- val sourceLinks: List<SourceLinkDefinition>,
- val skipDeprecated: Boolean = false) {
+ val options: DocumentationOptions) {
fun generate() {
val environment = createAnalysisEnvironment()
logger.info("Module: $moduleName")
- logger.info("Output: ${File(outputDir)}")
+ logger.info("Output: ${File(options.outputDir)}")
logger.info("Sources: ${environment.sources.joinToString()}")
logger.info("Classpath: ${environment.classpath.joinToString()}")
logger.info("Analysing sources and libraries... ")
val startAnalyse = System.currentTimeMillis()
- val options = DocumentationOptions(outputDir, outputFormat, false, sourceLinks = sourceLinks, skipDeprecated = skipDeprecated)
-
val injector = Guice.createInjector(DokkaModule(environment, options, logger))
val documentation = buildDocumentationModule(injector, moduleName, { isSample(it) }, includes)