aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-02 15:08:52 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-02 16:51:03 +0300
commit54c3c87acfb31afc22afc5f20229384f755b677f (patch)
tree276b600a967ab9a2b710ae62e2acc1443d395c7d
parentacbe2f8c47a81c8e6046214f600ffdef24890fa6 (diff)
downloaddokka-54c3c87acfb31afc22afc5f20229384f755b677f.tar.gz
dokka-54c3c87acfb31afc22afc5f20229384f755b677f.tar.bz2
dokka-54c3c87acfb31afc22afc5f20229384f755b677f.zip
Refactoring internal communication for gradle
-rw-r--r--build.gradle9
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt42
-rw-r--r--core/src/main/kotlin/Generation/DokkaGenerator.kt5
-rw-r--r--core/src/main/kotlin/Generation/configurationImpl.kt46
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt3
-rw-r--r--core/src/main/kotlin/Model/SourceLinks.kt2
-rw-r--r--core/src/test/kotlin/TestAPI.kt1
-rw-r--r--integration/build.gradle1
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt17
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt47
-rw-r--r--runners/ant/src/main/kotlin/ant/dokka.kt8
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt4
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt97
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt8
14 files changed, 192 insertions, 98 deletions
diff --git a/build.gradle b/build.gradle
index 4f40690b..31e4f6a1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,12 +27,9 @@ allprojects {
repositories {
mavenCentral()
mavenLocal()
- maven {
- url "http://dl.bintray.com/kotlin/kotlin-eap-1.1"
- }
- maven {
- url "https://dl.bintray.com/kotlin/kotlin-dev"
- }
+ maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" }
+ maven { url "https://dl.bintray.com/kotlin/kotlin-dev" }
+ maven { url 'https://jitpack.io' }
}
}
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
index 8b10a5e8..fafa5daa 100644
--- a/core/src/main/kotlin/DokkaBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -1,14 +1,8 @@
package org.jetbrains.dokka
-import java.io.File
+import ru.yole.jkid.deserialization.deserialize
import java.util.function.BiConsumer
-fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition {
- val (path, urlAndLine) = srcLink.split('=')
- return SourceLinkDefinition(File(path).absolutePath,
- urlAndLine.substringBefore("#"),
- urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it })
-}
fun parsePerPackageOptions(arg: String): List<PackageOptions> {
if (arg.isBlank()) return emptyList()
@@ -25,14 +19,9 @@ fun parsePerPackageOptions(arg: String): List<PackageOptions> {
}
}
-fun parseSourceRoot(sourceRoot: String): SourceRoot {
- val components = sourceRoot.split("::", limit = 2)
- return SourceRoot(components.last(), if (components.size == 1) listOf() else components[0].split(','))
-}
-
class DokkaBootstrapImpl : DokkaBootstrap {
- class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger {
+ private class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger {
override fun info(message: String) {
consumer.accept("info", message)
}
@@ -48,26 +37,14 @@ class DokkaBootstrapImpl : DokkaBootstrap {
lateinit var generator: DokkaGenerator
- override fun configure(logger: BiConsumer<String, String>,
- moduleName: String,
- classpath: List<String>,
- sources: List<String>,
- samples: List<String>,
- includes: List<String>,
- outputDir: String,
- format: String,
- includeNonPublic: Boolean,
- includeRootPackage: Boolean,
- reportUndocumented: Boolean,
- skipEmptyPackages: Boolean,
- skipDeprecated: Boolean,
- jdkVersion: Int,
- generateIndexPages: Boolean,
- sourceLinks: List<String>) {
+ override fun configure(logger: BiConsumer<String, String>, serializedConfigurationJSON: String)
+ = configure(DokkaProxyLogger(logger), deserialize<DokkaConfigurationImpl>(serializedConfigurationJSON))
+
+ fun configure(logger: DokkaLogger, configuration: DokkaConfiguration) = with(configuration) {
generator = DokkaGenerator(
- DokkaProxyLogger(logger),
+ logger,
classpath,
- sources.map(::parseSourceRoot),
+ sourceRoots,
samples,
includes,
moduleName,
@@ -81,10 +58,9 @@ class DokkaBootstrapImpl : DokkaBootstrap {
skipDeprecated,
jdkVersion,
generateIndexPages,
- sourceLinks.map(::parseSourceLinkDefinition)
+ sourceLinks
)
)
-
}
override fun generate() = generator.generate()
diff --git a/core/src/main/kotlin/Generation/DokkaGenerator.kt b/core/src/main/kotlin/Generation/DokkaGenerator.kt
index 6b5df7c9..67c641a0 100644
--- a/core/src/main/kotlin/Generation/DokkaGenerator.kt
+++ b/core/src/main/kotlin/Generation/DokkaGenerator.kt
@@ -7,6 +7,7 @@ import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiJavaFile
import com.intellij.psi.PsiManager
+import org.jetbrains.dokka.DokkaConfiguration.SourceRoot
import org.jetbrains.dokka.Utilities.DokkaAnalysisModule
import org.jetbrains.dokka.Utilities.DokkaOutputModule
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
@@ -23,10 +24,6 @@ import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import kotlin.system.measureTimeMillis
-class SourceRoot(path: String, val defaultPlatforms: List<String> = emptyList()) {
- val path: String = File(path).absolutePath
-}
-
class DokkaGenerator(val logger: DokkaLogger,
val classpath: List<String>,
val sources: List<SourceRoot>,
diff --git a/core/src/main/kotlin/Generation/configurationImpl.kt b/core/src/main/kotlin/Generation/configurationImpl.kt
new file mode 100644
index 00000000..6ed0d639
--- /dev/null
+++ b/core/src/main/kotlin/Generation/configurationImpl.kt
@@ -0,0 +1,46 @@
+package org.jetbrains.dokka
+
+import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition
+import org.jetbrains.dokka.DokkaConfiguration.SourceRoot
+import java.io.File
+
+
+data class SourceLinkDefinitionImpl(override val path: String,
+ override val url: String,
+ override val lineSuffix: String?) : SourceLinkDefinition {
+ companion object {
+ fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition {
+ val (path, urlAndLine) = srcLink.split('=')
+ return SourceLinkDefinitionImpl(File(path).absolutePath,
+ urlAndLine.substringBefore("#"),
+ urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it })
+ }
+ }
+}
+
+class SourceRootImpl(path: String, override val defaultPlatforms: List<String> = emptyList()) : SourceRoot {
+ override val path: String = File(path).absolutePath
+
+ companion object {
+ fun parseSourceRoot(sourceRoot: String): SourceRoot {
+ val components = sourceRoot.split("::", limit = 2)
+ return SourceRootImpl(components.last(), if (components.size == 1) listOf() else components[0].split(','))
+ }
+ }
+}
+
+data class DokkaConfigurationImpl(override val moduleName: String,
+ override val classpath: List<String>,
+ override val sourceRoots: List<SourceRootImpl>,
+ override val samples: List<String>,
+ override val includes: List<String>,
+ override val outputDir: String,
+ override val format: String,
+ override val includeNonPublic: Boolean,
+ override val includeRootPackage: Boolean,
+ override val reportUndocumented: Boolean,
+ override val skipEmptyPackages: Boolean,
+ override val skipDeprecated: Boolean,
+ override val jdkVersion: Int,
+ override val generateIndexPages: Boolean,
+ override val sourceLinks: List<SourceLinkDefinitionImpl>) : DokkaConfiguration \ No newline at end of file
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index 7c4e4531..aa4eed24 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -3,6 +3,7 @@ package org.jetbrains.dokka
import com.google.inject.Inject
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiJavaFile
+import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition
import org.jetbrains.dokka.Kotlin.DescriptorDocumentationParser
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.*
@@ -873,7 +874,7 @@ fun CallableMemberDescriptor.getExtensionClassDescriptor(): ClassifierDescriptor
if (extensionReceiver != null) {
val type = extensionReceiver.type
val receiverClass = type.constructor.declarationDescriptor as? ClassDescriptor
- if ((receiverClass as? ClassDescriptor)?.isCompanionObject ?: false) {
+ if (receiverClass?.isCompanionObject ?: false) {
return receiverClass?.containingDeclaration as? ClassifierDescriptor
}
return receiverClass
diff --git a/core/src/main/kotlin/Model/SourceLinks.kt b/core/src/main/kotlin/Model/SourceLinks.kt
index 99bb8f60..2c75cfda 100644
--- a/core/src/main/kotlin/Model/SourceLinks.kt
+++ b/core/src/main/kotlin/Model/SourceLinks.kt
@@ -3,10 +3,10 @@ package org.jetbrains.dokka
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiNameIdentifierOwner
+import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import java.io.File
-class SourceLinkDefinition(val path: String, val url: String, val lineSuffix: String?)
fun DocumentationNode.appendSourceLink(psi: PsiElement?, sourceLinks: List<SourceLinkDefinition>) {
val path = psi?.containingFile?.virtualFile?.path ?: return
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt
index ee452be3..a33c83f4 100644
--- a/core/src/test/kotlin/TestAPI.kt
+++ b/core/src/test/kotlin/TestAPI.kt
@@ -6,6 +6,7 @@ import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.io.FileUtil
import com.intellij.rt.execution.junit.FileComparisonFailure
import org.jetbrains.dokka.*
+import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition
import org.jetbrains.dokka.Utilities.DokkaAnalysisModule
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
diff --git a/integration/build.gradle b/integration/build.gradle
index 2f6514cb..55ac9dca 100644
--- a/integration/build.gradle
+++ b/integration/build.gradle
@@ -9,4 +9,5 @@ apply plugin: 'kotlin'
dependencies {
compile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: kotlin_for_gradle_version
compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_version
+ compile 'com.github.yole:jkid:7d9c529c87'
} \ No newline at end of file
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt b/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
index 845f86a6..b78eb9c6 100644
--- a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
+++ b/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
@@ -4,22 +4,7 @@ import java.util.function.BiConsumer
interface DokkaBootstrap {
- fun configure(logger: BiConsumer<String, String>,
- moduleName: String,
- classpath: List<String>,
- sources: List<String>,
- samples: List<String>,
- includes: List<String>,
- outputDir: String,
- format: String,
- includeNonPublic: Boolean,
- includeRootPackage: Boolean,
- reportUndocumented: Boolean,
- skipEmptyPackages: Boolean,
- skipDeprecated: Boolean,
- jdkVersion: Int,
- generateIndexPages: Boolean,
- sourceLinks: List<String>)
+ fun configure(logger: BiConsumer<String, String>, serializedConfigurationJSON: String)
fun generate()
} \ No newline at end of file
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt b/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
new file mode 100644
index 00000000..90ba41ce
--- /dev/null
+++ b/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
@@ -0,0 +1,47 @@
+package org.jetbrains.dokka
+
+
+interface DokkaConfiguration {
+ val moduleName: String
+ val classpath: List<String>
+ val sourceRoots: List<SourceRoot>
+ val samples: List<String>
+ val includes: List<String>
+ val outputDir: String
+ val format: String
+ val includeNonPublic: Boolean
+ val includeRootPackage: Boolean
+ val reportUndocumented: Boolean
+ val skipEmptyPackages: Boolean
+ val skipDeprecated: Boolean
+ val jdkVersion: Int
+ val generateIndexPages: Boolean
+ val sourceLinks: List<SourceLinkDefinition>
+
+ interface SourceRoot {
+ val path: String
+ val defaultPlatforms: List<String>
+ }
+
+ interface SourceLinkDefinition {
+ val path: String
+ val url: String
+ val lineSuffix: String?
+ }
+}
+
+data class SerializeOnlyDokkaConfiguration(override val moduleName: String,
+ override val classpath: List<String>,
+ override val sourceRoots: List<DokkaConfiguration.SourceRoot>,
+ override val samples: List<String>,
+ override val includes: List<String>,
+ override val outputDir: String,
+ override val format: String,
+ override val includeNonPublic: Boolean,
+ override val includeRootPackage: Boolean,
+ override val reportUndocumented: Boolean,
+ override val skipEmptyPackages: Boolean,
+ override val skipDeprecated: Boolean,
+ override val jdkVersion: Int,
+ override val generateIndexPages: Boolean,
+ override val sourceLinks: List<DokkaConfiguration.SourceLinkDefinition>) : DokkaConfiguration
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt
index c05cf1cb..54694880 100644
--- a/runners/ant/src/main/kotlin/ant/dokka.kt
+++ b/runners/ant/src/main/kotlin/ant/dokka.kt
@@ -17,9 +17,9 @@ class AntLogger(val task: Task): DokkaLogger {
class AntSourceLinkDefinition(var path: String? = null, var url: String? = null, var lineSuffix: String? = null)
class AntSourceRoot(var path: String? = null, var platforms: String? = null) {
- fun toSourceRoot(): SourceRoot? = path?.let {
+ fun toSourceRoot(): SourceRootImpl? = path?.let {
path ->
- SourceRoot(path, platforms?.split(',').orEmpty())
+ SourceRootImpl(path, platforms?.split(',').orEmpty())
}
}
@@ -104,13 +104,13 @@ class DokkaAntTask: Task() {
val sourceLinks = antSourceLinks.map {
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)
+ SourceLinkDefinitionImpl(File(path).canonicalFile.absolutePath, url, it.lineSuffix)
}
val generator = DokkaGenerator(
AntLogger(this),
compileClasspath.list().toList(),
- sourcePath.list().map { SourceRoot(it) } + antSourceRoots.mapNotNull { it.toSourceRoot() },
+ sourcePath.list().map { SourceRootImpl(it) } + antSourceRoots.mapNotNull { it.toSourceRoot() },
samplesPath.list().toList(),
includesPath.list().toList(),
moduleName!!,
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index 78e3077d..0d1ff76c 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -65,7 +65,7 @@ object MainKt {
val includes = if (arguments.include.isNotEmpty()) arguments.include.split(File.pathSeparatorChar).toList() else listOf()
val sourceLinks = if (arguments.srcLink.isNotEmpty() && arguments.srcLink.contains("="))
- listOf(parseSourceLinkDefinition(arguments.srcLink))
+ listOf(SourceLinkDefinitionImpl.parseSourceLinkDefinition(arguments.srcLink))
else {
if (arguments.srcLink.isNotEmpty()) {
println("Warning: Invalid -srcLink syntax. Expected: <path>=<url>[#lineSuffix]. No source links will be generated.")
@@ -87,7 +87,7 @@ object MainKt {
val generator = DokkaGenerator(
DokkaConsoleLogger,
classPath,
- sources.map(::parseSourceRoot),
+ sources.map(SourceRootImpl.Companion::parseSourceRoot),
samples,
includes,
arguments.moduleName,
diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt
index 959698c3..7aa871ad 100644
--- a/runners/gradle-plugin/src/main/kotlin/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/main.kt
@@ -9,9 +9,13 @@ import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.*
import org.jetbrains.dokka.DokkaBootstrap
+import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.SerializeOnlyDokkaConfiguration
import org.jetbrains.dokka.automagicTypedProxy
import org.jetbrains.dokka.gradle.ClassloaderContainer.fatJarClassLoader
import org.jetbrains.dokka.gradle.DokkaVersion.version
+import ru.yole.jkid.JsonExclude
+import ru.yole.jkid.serialization.serialize
import java.io.File
import java.io.InputStream
import java.io.Serializable
@@ -69,6 +73,9 @@ open class DokkaTask : DefaultTask() {
var jdkVersion: Int = 6
@Input
var sourceDirs: Iterable<File> = emptyList()
+
+ @Input var sourceRoots: MutableList<SourceRoot> = arrayListOf()
+
@Input
var dokkaFatJar: Any = "org.jetbrains.dokka:dokka-fatjar:$version"
@@ -84,7 +91,7 @@ open class DokkaTask : DefaultTask() {
closure.delegate = mapping
closure.call()
- if (mapping.dir.isEmpty()) {
+ if (mapping.path.isEmpty()) {
throw IllegalArgumentException("Link mapping should have dir")
}
if (mapping.url.isEmpty()) {
@@ -94,6 +101,12 @@ open class DokkaTask : DefaultTask() {
linkMappings.add(mapping)
}
+ fun sourceRoot(closure: Closure<Any?>) {
+ val sourceRoot = SourceRoot()
+ closure.delegate = sourceRoot
+ closure.call()
+ sourceRoots.add(sourceRoot)
+ }
fun tryResolveFatJar(project: Project): File {
return try {
@@ -126,7 +139,7 @@ open class DokkaTask : DefaultTask() {
val project = project
val sdkProvider = sdkProvider
- val sourceDirectories = getSourceDirectories()
+ val sourceRoots = collectSourceRoots()
val allConfigurations = project.configurations
val classpath =
@@ -135,7 +148,7 @@ open class DokkaTask : DefaultTask() {
.map { allConfigurations?.getByName(it.toString()) ?: throw IllegalArgumentException("No configuration $it found") }
.flatMap { it }
- if (sourceDirectories.isEmpty()) {
+ if (sourceRoots.isEmpty()) {
logger.warn("No source directories found: skipping dokka generation")
return
}
@@ -146,17 +159,10 @@ open class DokkaTask : DefaultTask() {
val bootstrapProxy: DokkaBootstrap = automagicTypedProxy(javaClass.classLoader, bootstrapInstance)
- bootstrapProxy.configure(
- BiConsumer { level, message ->
- when (level) {
- "info" -> logger.info(message)
- "warn" -> logger.warn(message)
- "error" -> logger.error(message)
- }
- },
+ val configuration = SerializeOnlyDokkaConfiguration(
moduleName,
classpath.map { it.absolutePath },
- sourceDirectories.map { it.absolutePath },
+ sourceRoots,
samples.filterNotNull().map { project.file(it).absolutePath },
includes.filterNotNull().map { project.file(it).absolutePath },
outputDirectory,
@@ -168,10 +174,19 @@ open class DokkaTask : DefaultTask() {
skipDeprecated,
6,
true,
- linkMappings.map {
- val path = project.file(it.dir).absolutePath
- "$path=${it.url}${it.suffix}"
- })
+ linkMappings)
+
+
+ bootstrapProxy.configure(
+ BiConsumer { level, message ->
+ when (level) {
+ "info" -> logger.info(message)
+ "warn" -> logger.warn(message)
+ "error" -> logger.error(message)
+ }
+ },
+ serialize(configuration)
+ )
bootstrapProxy.generate()
@@ -180,7 +195,11 @@ open class DokkaTask : DefaultTask() {
}
}
- fun getSourceDirectories(): Collection<File> {
+ fun collectSourceRoots(): List<SourceRoot> {
+ if (sourceRoots.any()) {
+ return sourceRoots
+ }
+
val provider = sdkProvider
val sourceDirs = if (sourceDirs.any()) {
logger.info("Dokka: Taking source directories provided by the user")
@@ -195,13 +214,13 @@ open class DokkaTask : DefaultTask() {
sourceSets?.allSource?.srcDirs
}
- return sourceDirs?.filter { it.exists() } ?: emptyList()
+ return sourceDirs?.filter { it.exists() }?.map { SourceRoot().apply { path = it.path } } ?: emptyList()
}
@InputFiles
@SkipWhenEmpty
fun getInputFiles(): FileCollection =
- project.files(getSourceDirectories().map { project.fileTree(it) }) +
+ project.files(collectSourceRoots().map { project.fileTree(File(it.path)) }) +
project.files(includes) +
project.files(samples.map { project.fileTree(it) })
@@ -213,10 +232,34 @@ open class DokkaTask : DefaultTask() {
}
}
-open class LinkMapping : Serializable {
- var dir: String = ""
- var url: String = ""
- var suffix: String? = null
+class SourceRoot : DokkaConfiguration.SourceRoot {
+ override var path: String = ""
+ set(value) {
+ field = File(value).absolutePath
+ }
+
+ override var defaultPlatforms: List<String> = arrayListOf()
+}
+
+open class LinkMapping : Serializable, DokkaConfiguration.SourceLinkDefinition {
+ @JsonExclude
+ var dir: String
+ get() = path
+ set(value) {
+ path = value
+ }
+
+ override var path: String = ""
+ override var url: String = ""
+
+ @JsonExclude
+ var suffix: String?
+ get() = lineSuffix
+ set(value) {
+ lineSuffix = value
+ }
+
+ override var lineSuffix: String? = null
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -224,17 +267,17 @@ open class LinkMapping : Serializable {
other as LinkMapping
- if (dir != other.dir) return false
+ if (path != other.path) return false
if (url != other.url) return false
- if (suffix != other.suffix) return false
+ if (lineSuffix != other.lineSuffix) return false
return true
}
override fun hashCode(): Int {
- var result = dir.hashCode()
+ var result = path.hashCode()
result = 31 * result + url.hashCode()
- result = 31 * result + (suffix?.hashCode() ?: 0)
+ result = 31 * result + (lineSuffix?.hashCode() ?: 0)
return result
}
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index c3cf7509..dcccdb1f 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -11,8 +11,8 @@ import org.codehaus.plexus.archiver.Archiver
import org.codehaus.plexus.archiver.jar.JarArchiver
import org.jetbrains.dokka.DocumentationOptions
import org.jetbrains.dokka.DokkaGenerator
-import org.jetbrains.dokka.SourceLinkDefinition
-import org.jetbrains.dokka.SourceRoot
+import org.jetbrains.dokka.SourceLinkDefinitionImpl
+import org.jetbrains.dokka.SourceRootImpl
import java.io.File
class SourceLinkMapItem {
@@ -67,12 +67,12 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
val gen = DokkaGenerator(
MavenDokkaLogger(log),
classpath,
- sourceDirectories.map { SourceRoot(it) },
+ sourceDirectories.map { SourceRootImpl(it) },
samplesDirs,
includeDirs + includes,
moduleName,
DocumentationOptions(getOutDir(), getOutFormat(),
- sourceLinks = sourceLinks.map { SourceLinkDefinition(it.dir, it.url, it.urlSuffix) },
+ sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.dir, it.url, it.urlSuffix) },
jdkVersion = jdkVersion
)
)