aboutsummaryrefslogtreecommitdiff
path: root/integration/src/main/kotlin/org/jetbrains
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-01-31 00:37:29 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-01-31 15:27:26 +0100
commite99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944 (patch)
tree7e3eb4f67d36d3b7b6db6aec08c58de2e1b678d3 /integration/src/main/kotlin/org/jetbrains
parent0073c4c547dafaae5d465d4c410a52fd7fdc818d (diff)
downloaddokka-e99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944.tar.gz
dokka-e99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944.tar.bz2
dokka-e99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944.zip
Bump Gradle version, migrate to Kotlin DSL, refactor publishing
Diffstat (limited to 'integration/src/main/kotlin/org/jetbrains')
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt10
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt72
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt98
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt74
4 files changed, 0 insertions, 254 deletions
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt b/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
deleted file mode 100644
index b78eb9c6..00000000
--- a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.jetbrains.dokka
-
-import java.util.function.BiConsumer
-
-interface DokkaBootstrap {
-
- 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/ReflectDsl.kt b/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt
deleted file mode 100644
index 1984a3e5..00000000
--- a/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.jetbrains.dokka
-
-import kotlin.reflect.*
-import kotlin.reflect.full.memberFunctions
-import kotlin.reflect.full.memberProperties
-import kotlin.reflect.jvm.isAccessible
-
-object ReflectDsl {
-
- class CallOrPropAccess(private val receiver: Any?,
- private val clz: KClass<*>,
- private val selector: String) {
-
- @Suppress("UNCHECKED_CAST")
- operator fun <T : Any?> invoke(vararg a: Any?): T {
- return func!!.call(receiver, *a) as T
- }
-
- operator fun get(s: String): CallOrPropAccess {
- return v<Any?>()!![s]
- }
-
- val func: KFunction<*>? by lazy { clz.memberFunctions.find { it.name == selector } }
- val prop: KProperty<*>? by lazy { clz.memberProperties.find { it.name == selector } }
-
- fun takeIfIsFunc(): CallOrPropAccess? = if (func != null) this else null
-
- fun takeIfIsProp(): CallOrPropAccess? = if (prop != null) this else null
-
- @Suppress("UNCHECKED_CAST")
- fun <T : Any?> v(): T {
- val prop = prop!!
- return try {
- prop.getter.apply { isAccessible = true }.call(receiver) as T
- } catch (e: KotlinNullPointerException) {
- // Hack around kotlin-reflect bug KT-18480
- val jclass = clz.java
- val customGetterName = prop.getter.name
- val getterName = if (customGetterName.startsWith("<")) "get" + prop.name.capitalize() else customGetterName
- val getter = jclass.getDeclaredMethod(getterName)
- getter.isAccessible = true
-
- getter.invoke(receiver) as T
-
- }
- }
-
- @Suppress("UNCHECKED_CAST")
- fun v(x: Any?) {
- (prop as KMutableProperty).setter.apply { isAccessible = true }.call(receiver, x)
- }
-
-
- }
-
- operator fun Any.get(s: String): CallOrPropAccess {
- val clz = this.javaClass.kotlin
- return CallOrPropAccess(this, clz, s)
- }
-
- operator fun Any.get(s: String, clz: Class<*>): CallOrPropAccess {
- val kclz = clz.kotlin
- return CallOrPropAccess(this, kclz, s)
- }
-
- operator fun Any.get(s: String, clz: KClass<*>): CallOrPropAccess {
- return CallOrPropAccess(this, clz, s)
- }
-
- inline infix fun Any.isInstance(clz: Class<*>?): Boolean = clz != null && clz.isAssignableFrom(this.javaClass)
- inline infix fun Any.isNotInstance(clz: Class<*>?): Boolean = !(this isInstance clz)
-} \ 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
deleted file mode 100644
index 8c6d35e8..00000000
--- a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.jetbrains.dokka
-
-import java.io.File
-import java.net.URL
-
-enum class Platform(val key: String) {
- jvm("jvm"),
- js("js"),
- native("native"),
- common("common");
-
- 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")
- }
- }
- }
-}
-
-interface DokkaConfiguration {
- val outputDir: String
- val format: String
- val generateIndexPages: Boolean
- val cacheRoot: String?
- val passesConfigurations: List<PassConfiguration>
- val impliedPlatforms: List<String>
- var pluginsClasspath: List<File>
-
- 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<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
- }
-
- interface SourceLinkDefinition {
- val path: String
- val url: String
- val lineSuffix: String?
- }
-
- interface PackageOptions {
- val prefix: String
- val includeNonPublic: Boolean
- val reportUndocumented: Boolean
- val skipDeprecated: Boolean
- val suppress: Boolean
- }
-
- interface ExternalDocumentationLink {
- val url: URL
- val packageListUrl: URL
-
- open class Builder(open var url: URL? = null,
- open var packageListUrl: URL? = null) {
-
- constructor(root: String, packageList: String? = null) : this(URL(root), packageList?.let { URL(it) })
-
- fun build(): 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")
- }
- }
-}
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt b/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt
deleted file mode 100644
index 6c797fcd..00000000
--- a/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-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>,
- override var pluginsClasspath: List<File>
-) : 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