From 02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Thu, 31 Aug 2023 20:16:01 +0200 Subject: Enable explicit API mode (#3139) --- core/src/main/kotlin/configuration.kt | 211 +++++++++++++++++----------------- 1 file changed, 106 insertions(+), 105 deletions(-) (limited to 'core/src/main/kotlin/configuration.kt') diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index 9cbc6ea2..65035d04 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -9,53 +9,55 @@ import java.io.File import java.io.Serializable import java.net.URL -object DokkaDefaults { - val moduleName: String = "root" - val moduleVersion: String? = null - val outputDir = File("./dokka") - const val failOnWarning: Boolean = false - const val suppressObviousFunctions = true - const val suppressInheritedMembers = false - const val offlineMode: Boolean = false +public object DokkaDefaults { + public val moduleName: String = "root" + public val moduleVersion: String? = null + public val outputDir: File = File("./dokka") + public const val failOnWarning: Boolean = false + public const val suppressObviousFunctions: Boolean = true + public const val suppressInheritedMembers: Boolean = false + public const val offlineMode: Boolean = false - const val sourceSetDisplayName = "JVM" - const val sourceSetName = "main" - val analysisPlatform: Platform = Platform.DEFAULT + public const val sourceSetDisplayName: String = "JVM" + public const val sourceSetName: String = "main" + public val analysisPlatform: Platform = Platform.DEFAULT - const val suppress: Boolean = false - const val suppressGeneratedFiles: Boolean = true + public const val suppress: Boolean = false + public const val suppressGeneratedFiles: Boolean = true - const val skipEmptyPackages: Boolean = true - const val skipDeprecated: Boolean = false + public const val skipEmptyPackages: Boolean = true + public const val skipDeprecated: Boolean = false - const val reportUndocumented: Boolean = false + public const val reportUndocumented: Boolean = false - const val noStdlibLink: Boolean = false - const val noAndroidSdkLink: Boolean = false - const val noJdkLink: Boolean = false - const val jdkVersion: Int = 8 + public const val noStdlibLink: Boolean = false + public const val noAndroidSdkLink: Boolean = false + public const val noJdkLink: Boolean = false + public const val jdkVersion: Int = 8 - const val includeNonPublic: Boolean = false - val documentedVisibilities: Set = setOf(DokkaConfiguration.Visibility.PUBLIC) + public const val includeNonPublic: Boolean = false + public val documentedVisibilities: Set = setOf(DokkaConfiguration.Visibility.PUBLIC) - val pluginsConfiguration = mutableListOf() + public val pluginsConfiguration: List = mutableListOf() - const val delayTemplateSubstitution: Boolean = false + public const val delayTemplateSubstitution: Boolean = false - val cacheRoot: File? = null + public val cacheRoot: File? = null } -enum class Platform(val key: String) { +public enum class Platform( + public val key: String +) { jvm("jvm"), js("js"), wasm("wasm"), native("native"), common("common"); - companion object { - val DEFAULT = jvm + public companion object { + public val DEFAULT: Platform = jvm - fun fromString(key: String): Platform { + public fun fromString(key: String): Platform { return when (key.toLowerCase()) { jvm.key -> jvm js.key -> js @@ -70,14 +72,13 @@ enum class Platform(val key: String) { } } -fun interface DokkaConfigurationBuilder { - fun build(): T +public fun interface DokkaConfigurationBuilder { + public fun build(): T } -fun Iterable>.build(): List = this.map { it.build() } +public fun Iterable>.build(): List = this.map { it.build() } - -data class DokkaSourceSetID( +public data class DokkaSourceSetID( /** * Unique identifier of the scope that this source set is placed in. * Each scope provide only unique source set names. @@ -102,13 +103,13 @@ data class DokkaSourceSetID( * * @see [apply] to learn how to apply global configuration */ -data class GlobalDokkaConfiguration( +public data class GlobalDokkaConfiguration( val perPackageOptions: List?, val externalDocumentationLinks: List?, val sourceLinks: List? ) -fun DokkaConfiguration.apply(globals: GlobalDokkaConfiguration): DokkaConfiguration = this.apply { +public fun DokkaConfiguration.apply(globals: GlobalDokkaConfiguration): DokkaConfiguration = this.apply { sourceSets.forEach { it.perPackageOptions.cast>() .addAll(globals.perPackageOptions ?: emptyList()) @@ -124,21 +125,21 @@ fun DokkaConfiguration.apply(globals: GlobalDokkaConfiguration): DokkaConfigurat } } -interface DokkaConfiguration : Serializable { - val moduleName: String - val moduleVersion: String? - val outputDir: File - val cacheRoot: File? - val offlineMode: Boolean - val failOnWarning: Boolean - val sourceSets: List - val modules: List - val pluginsClasspath: List - val pluginsConfiguration: List - val delayTemplateSubstitution: Boolean - val suppressObviousFunctions: Boolean - val includes: Set - val suppressInheritedMembers: Boolean +public interface DokkaConfiguration : Serializable { + public val moduleName: String + public val moduleVersion: String? + public val outputDir: File + public val cacheRoot: File? + public val offlineMode: Boolean + public val failOnWarning: Boolean + public val sourceSets: List + public val modules: List + public val pluginsClasspath: List + public val pluginsConfiguration: List + public val delayTemplateSubstitution: Boolean + public val suppressObviousFunctions: Boolean + public val includes: Set + public val suppressInheritedMembers: Boolean /** * Whether coroutines dispatchers should be shutdown after @@ -157,46 +158,46 @@ interface DokkaConfiguration : Serializable { * and closing it down will leave the build in an inoperable state. * One such example is unit tests, for which finalization should be disabled. */ - val finalizeCoroutines: Boolean + public val finalizeCoroutines: Boolean - enum class SerializationFormat : Serializable { + public enum class SerializationFormat : Serializable { JSON, XML } - interface PluginConfiguration : Serializable { - val fqPluginName: String - val serializationFormat: SerializationFormat - val values: String + public interface PluginConfiguration : Serializable { + public val fqPluginName: String + public val serializationFormat: SerializationFormat + public val values: String } - interface DokkaSourceSet : Serializable { - val sourceSetID: DokkaSourceSetID - val displayName: String - val classpath: List - val sourceRoots: Set - val dependentSourceSets: Set - val samples: Set - val includes: Set + public interface DokkaSourceSet : Serializable { + public val sourceSetID: DokkaSourceSetID + public val displayName: String + public val classpath: List + public val sourceRoots: Set + public val dependentSourceSets: Set + public val samples: Set + public val includes: Set @Deprecated(message = "Use [documentedVisibilities] property for a more flexible control over documented visibilities") - val includeNonPublic: Boolean - val reportUndocumented: Boolean - val skipEmptyPackages: Boolean - val skipDeprecated: Boolean - val jdkVersion: Int - val sourceLinks: Set - val perPackageOptions: List - val externalDocumentationLinks: Set - val languageVersion: String? - val apiVersion: String? - val noStdlibLink: Boolean - val noJdkLink: Boolean - val suppressedFiles: Set - val analysisPlatform: Platform - val documentedVisibilities: Set + public val includeNonPublic: Boolean + public val reportUndocumented: Boolean + public val skipEmptyPackages: Boolean + public val skipDeprecated: Boolean + public val jdkVersion: Int + public val sourceLinks: Set + public val perPackageOptions: List + public val externalDocumentationLinks: Set + public val languageVersion: String? + public val apiVersion: String? + public val noStdlibLink: Boolean + public val noJdkLink: Boolean + public val suppressedFiles: Set + public val analysisPlatform: Platform + public val documentedVisibilities: Set } - enum class Visibility { + public enum class Visibility { /** * `public` modifier for Java, default visibility for Kotlin */ @@ -222,45 +223,45 @@ interface DokkaConfiguration : Serializable { */ PACKAGE; - companion object { - fun fromString(value: String) = valueOf(value.toUpperCase()) + public companion object { + public fun fromString(value: String): Visibility = valueOf(value.toUpperCase()) } } - interface SourceLinkDefinition : Serializable { - val localDirectory: String - val remoteUrl: URL - val remoteLineSuffix: String? + public interface SourceLinkDefinition : Serializable { + public val localDirectory: String + public val remoteUrl: URL + public val remoteLineSuffix: String? } - interface DokkaModuleDescription : Serializable { - val name: String - val relativePathToOutputDirectory: File - val sourceOutputDirectory: File - val includes: Set + public interface DokkaModuleDescription : Serializable { + public val name: String + public val relativePathToOutputDirectory: File + public val sourceOutputDirectory: File + public val includes: Set } - interface PackageOptions : Serializable { - val matchingRegex: String + public interface PackageOptions : Serializable { + public val matchingRegex: String @Deprecated("Use [documentedVisibilities] property for a more flexible control over documented visibilities") - val includeNonPublic: Boolean - val reportUndocumented: Boolean? - val skipDeprecated: Boolean - val suppress: Boolean - val documentedVisibilities: Set + public val includeNonPublic: Boolean + public val reportUndocumented: Boolean? + public val skipDeprecated: Boolean + public val suppress: Boolean + public val documentedVisibilities: Set } - interface ExternalDocumentationLink : Serializable { - val url: URL - val packageListUrl: URL + public interface ExternalDocumentationLink : Serializable { + public val url: URL + public val packageListUrl: URL - companion object + public companion object } } @Suppress("FunctionName") -fun ExternalDocumentationLink( +public fun ExternalDocumentationLink( url: URL? = null, packageListUrl: URL? = null ): ExternalDocumentationLinkImpl { @@ -273,7 +274,7 @@ fun ExternalDocumentationLink( } @Suppress("FunctionName") -fun ExternalDocumentationLink( +public fun ExternalDocumentationLink( url: String, packageListUrl: String? = null ): ExternalDocumentationLinkImpl = ExternalDocumentationLink(url.let(::URL), packageListUrl?.let(::URL)) -- cgit