aboutsummaryrefslogtreecommitdiff
path: root/integration/src/main/kotlin/org
diff options
context:
space:
mode:
Diffstat (limited to 'integration/src/main/kotlin/org')
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt122
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt73
2 files changed, 127 insertions, 68 deletions
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt b/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
index 90e5b5fc..b41479cf 100644
--- a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
+++ b/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
@@ -1,50 +1,66 @@
package org.jetbrains.dokka
-import ru.yole.jkid.CustomSerializer
-import ru.yole.jkid.ValueSerializer
-import ru.yole.jkid.deserialization.JKidException
-import java.io.Serializable
import java.net.URL
+enum class Platform(val key: String) {
+ jvm("jvm"),
+ js("js"),
+ native("native"),
+ common("common");
-class UrlSerializer : ValueSerializer<URL?> {
- override fun fromJsonValue(jsonValue: Any?): URL? {
- if (jsonValue !is String?)
- throw JKidException("Expected string representation of URL, got: $jsonValue")
- return jsonValue?.let { URL(jsonValue) }
+
+ companion object {
+ val DEFAULT = jvm
+
+ fun fromString(key: String): Platform {
+ return when (key.toLowerCase()) {
+ jvm.key -> jvm
+ js.key -> js
+ native.key -> native
+ common.key -> common
+ else -> throw IllegalArgumentException("Unrecognized platform: $key")
+ }
+ }
}
- override fun toJsonValue(value: URL?): Any? = value?.toExternalForm()
}
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>
- val impliedPlatforms: List<String>
- val perPackageOptions: List<PackageOptions>
- val externalDocumentationLinks: List<DokkaConfiguration.ExternalDocumentationLink>
- val languageVersion: String?
- val apiVersion: String?
- val noStdlibLink: Boolean
val cacheRoot: String?
- val suppressedFiles: List<String>
+ val passesConfigurations: List<PassConfiguration>
+ val impliedPlatforms: List<String>
+
+ interface PassConfiguration {
+ val moduleName: String
+ val classpath: List<String>
+ val sourceRoots: List<SourceRoot>
+ val samples: List<String>
+ val includes: List<String>
+ val includeNonPublic: Boolean
+ val includeRootPackage: Boolean
+ val reportUndocumented: Boolean
+ val skipEmptyPackages: Boolean
+ val skipDeprecated: Boolean
+ val jdkVersion: Int
+ val sourceLinks: List<SourceLinkDefinition>
+ val perPackageOptions: List<PackageOptions>
+ val externalDocumentationLinks: List<DokkaConfiguration.ExternalDocumentationLink>
+ val languageVersion: String?
+ val apiVersion: String?
+ val noStdlibLink: Boolean
+ val noJdkLink: Boolean
+ val suppressedFiles: List<String>
+ val collectInheritedExtensionsFromLibraries: Boolean
+ val analysisPlatform: Platform
+ val targets: List<String>
+ val sinceKotlin: String?
+ }
interface SourceRoot {
val path: String
- val platforms: List<String>
}
interface SourceLinkDefinition {
@@ -62,8 +78,8 @@ interface DokkaConfiguration {
}
interface ExternalDocumentationLink {
- @CustomSerializer(UrlSerializer::class) val url: URL
- @CustomSerializer(UrlSerializer::class) val packageListUrl: URL
+ val url: URL
+ val packageListUrl: URL
open class Builder(open var url: URL? = null,
open var packageListUrl: URL? = null) {
@@ -71,42 +87,12 @@ interface DokkaConfiguration {
constructor(root: String, packageList: String? = null) : this(URL(root), packageList?.let { URL(it) })
fun build(): DokkaConfiguration.ExternalDocumentationLink =
- if (packageListUrl != null && url != null)
- ExternalDocumentationLinkImpl(url!!, packageListUrl!!)
- else if (url != null)
- ExternalDocumentationLinkImpl(url!!, URL(url!!, "package-list"))
- else
- throw IllegalArgumentException("url or url && packageListUrl must not be null for external documentation link")
+ if (packageListUrl != null && url != null)
+ ExternalDocumentationLinkImpl(url!!, packageListUrl!!)
+ else if (url != null)
+ ExternalDocumentationLinkImpl(url!!, URL(url!!, "package-list"))
+ else
+ throw IllegalArgumentException("url or url && packageListUrl must not be null for external documentation link")
}
}
}
-
-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>,
- override val impliedPlatforms: List<String>,
- override val perPackageOptions: List<DokkaConfiguration.PackageOptions>,
- override val externalDocumentationLinks: List<DokkaConfiguration.ExternalDocumentationLink>,
- override val noStdlibLink: Boolean,
- override val cacheRoot: String?,
- override val suppressedFiles: List<String>,
- override val languageVersion: String?,
- override val apiVersion: String?
-) : DokkaConfiguration
-
-
-data class ExternalDocumentationLinkImpl(@CustomSerializer(UrlSerializer::class) override val url: URL,
- @CustomSerializer(UrlSerializer::class) override val packageListUrl: URL) : Serializable, DokkaConfiguration.ExternalDocumentationLink \ No newline at end of file
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt b/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt
new file mode 100644
index 00000000..78112904
--- /dev/null
+++ b/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt
@@ -0,0 +1,73 @@
+package org.jetbrains.dokka
+
+import java.io.File
+import java.net.URL
+
+data class DokkaConfigurationImpl(
+ override val outputDir: String,
+ override val format: String,
+ override val generateIndexPages: Boolean,
+ override val cacheRoot: String?,
+ override val impliedPlatforms: List<String>,
+ override val passesConfigurations: List<PassConfigurationImpl>
+) : DokkaConfiguration
+
+data class PassConfigurationImpl (
+ 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 includeNonPublic: Boolean,
+ override val includeRootPackage: Boolean,
+ override val reportUndocumented: Boolean,
+ override val skipEmptyPackages: Boolean,
+ override val skipDeprecated: Boolean,
+ override val jdkVersion: Int,
+ override val sourceLinks: List<SourceLinkDefinitionImpl>,
+ override val perPackageOptions: List<PackageOptionsImpl>,
+ override var externalDocumentationLinks: List<ExternalDocumentationLinkImpl>,
+ override val languageVersion: String?,
+ override val apiVersion: String?,
+ override val noStdlibLink: Boolean,
+ override val noJdkLink: Boolean,
+ override val suppressedFiles: List<String>,
+ override val collectInheritedExtensionsFromLibraries: Boolean,
+ override val analysisPlatform: Platform,
+ override val targets: List<String>,
+ override val sinceKotlin: String?
+) : DokkaConfiguration.PassConfiguration
+
+
+data class SourceRootImpl(
+ override val path: String
+): DokkaConfiguration.SourceRoot
+
+data class SourceLinkDefinitionImpl(
+ override val path: String,
+ override val url: String,
+ override val lineSuffix: String?
+): DokkaConfiguration.SourceLinkDefinition {
+ companion object {
+ fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinitionImpl {
+ val (path, urlAndLine) = srcLink.split('=')
+ return SourceLinkDefinitionImpl(
+ File(path).canonicalPath,
+ urlAndLine.substringBefore("#"),
+ urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#$it" })
+ }
+ }
+}
+
+data class PackageOptionsImpl(
+ override val prefix: String,
+ override val includeNonPublic: Boolean,
+ override val reportUndocumented: Boolean,
+ override val skipDeprecated: Boolean,
+ override val suppress: Boolean
+): DokkaConfiguration.PackageOptions
+
+
+data class ExternalDocumentationLinkImpl(override val url: URL,
+ override val packageListUrl: URL
+) : DokkaConfiguration.ExternalDocumentationLink \ No newline at end of file