diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-07-22 11:12:16 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-14 17:51:11 +0200 |
commit | 37d12bed40edc226d96d0e1a4b28a24583ece94f (patch) | |
tree | 424ec0e7f60fc9a9c0eb9a9747a99faea714fdf9 /core/src/main | |
parent | eae1ce49d18c2978b49166ea502bf2c109a85504 (diff) | |
download | dokka-37d12bed40edc226d96d0e1a4b28a24583ece94f.tar.gz dokka-37d12bed40edc226d96d0e1a4b28a24583ece94f.tar.bz2 dokka-37d12bed40edc226d96d0e1a4b28a24583ece94f.zip |
DokkaConfiguration: Use `Set` instead of `List` when collections are expected to be distinct
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/kotlin/configuration.kt | 20 | ||||
-rw-r--r-- | core/src/main/kotlin/defaultConfiguration.kt | 24 | ||||
-rw-r--r-- | core/src/main/kotlin/utilities/json.kt | 18 |
3 files changed, 16 insertions, 46 deletions
diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index 67c55861..b26b93a4 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -79,39 +79,35 @@ interface DokkaConfiguration : Serializable { val failOnWarning: Boolean val sourceSets: List<DokkaSourceSet> val modules: List<DokkaModuleDescription> - val pluginsClasspath: List<File> + val pluginsClasspath: Set<File> val pluginsConfiguration: Map<String, String> interface DokkaSourceSet : Serializable { val sourceSetID: DokkaSourceSetID val displayName: String val moduleDisplayName: String - val classpath: List<File> - val sourceRoots: List<SourceRoot> + val classpath: Set<File> + val sourceRoots: Set<File> val dependentSourceSets: Set<DokkaSourceSetID> - val samples: List<File> - val includes: List<File> + val samples: Set<File> + val includes: Set<File> val includeNonPublic: Boolean val includeRootPackage: Boolean val reportUndocumented: Boolean val skipEmptyPackages: Boolean val skipDeprecated: Boolean val jdkVersion: Int - val sourceLinks: List<SourceLinkDefinition> + val sourceLinks: Set<SourceLinkDefinition> val perPackageOptions: List<PackageOptions> - val externalDocumentationLinks: List<ExternalDocumentationLink> + val externalDocumentationLinks: Set<ExternalDocumentationLink> val languageVersion: String? val apiVersion: String? val noStdlibLink: Boolean val noJdkLink: Boolean - val suppressedFiles: List<File> + val suppressedFiles: Set<File> val analysisPlatform: Platform } - interface SourceRoot : Serializable { - val directory: File - } - interface SourceLinkDefinition : Serializable { val path: String val url: String diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index 384ce392..1b79ec61 100644 --- a/core/src/main/kotlin/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt @@ -3,15 +3,13 @@ package org.jetbrains.dokka import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import java.io.File import java.net.URL -import kotlin.reflect.full.memberProperties -import kotlin.reflect.full.primaryConstructor data class DokkaConfigurationImpl( override val outputDir: File = DokkaDefaults.outputDir, override val cacheRoot: File? = DokkaDefaults.cacheRoot, override val offlineMode: Boolean = DokkaDefaults.offlineMode, override val sourceSets: List<DokkaSourceSetImpl> = emptyList(), - override val pluginsClasspath: List<File> = emptyList(), + override val pluginsClasspath: Set<File> = emptySet(), override val pluginsConfiguration: Map<String, String> = emptyMap(), override val modules: List<DokkaModuleDescriptionImpl> = emptyList(), override val failOnWarning: Boolean = DokkaDefaults.failOnWarning @@ -22,25 +20,25 @@ data class DokkaSourceSetImpl( override val moduleDisplayName: String, override val displayName: String = DokkaDefaults.sourceSetDisplayName, override val sourceSetID: DokkaSourceSetID, - override val classpath: List<File> = emptyList(), - override val sourceRoots: List<SourceRootImpl>, + override val classpath: Set<File> = emptySet(), + override val sourceRoots: Set<File> = emptySet(), override val dependentSourceSets: Set<DokkaSourceSetID> = emptySet(), - override val samples: List<File> = emptyList(), - override val includes: List<File> = emptyList(), + override val samples: Set<File> = emptySet(), + override val includes: Set<File> = emptySet(), override val includeNonPublic: Boolean = DokkaDefaults.includeNonPublic, override val includeRootPackage: Boolean = DokkaDefaults.includeRootPackage, override val reportUndocumented: Boolean = DokkaDefaults.reportUndocumented, override val skipEmptyPackages: Boolean = DokkaDefaults.skipEmptyPackages, override val skipDeprecated: Boolean = DokkaDefaults.skipDeprecated, override val jdkVersion: Int = DokkaDefaults.jdkVersion, - override val sourceLinks: List<SourceLinkDefinitionImpl> = emptyList(), + override val sourceLinks: Set<SourceLinkDefinitionImpl> = emptySet(), override val perPackageOptions: List<PackageOptionsImpl> = emptyList(), - override var externalDocumentationLinks: List<ExternalDocumentationLinkImpl> = emptyList(), + override var externalDocumentationLinks: Set<ExternalDocumentationLinkImpl> = emptySet(), override val languageVersion: String? = null, override val apiVersion: String? = null, override val noStdlibLink: Boolean = DokkaDefaults.noStdlibLink, override val noJdkLink: Boolean = DokkaDefaults.noJdkLink, - override val suppressedFiles: List<File> = emptyList(), + override val suppressedFiles: Set<File> = emptySet(), override val analysisPlatform: Platform = DokkaDefaults.analysisPlatform ) : DokkaSourceSet @@ -50,12 +48,6 @@ data class DokkaModuleDescriptionImpl( override val docFile: File ) : DokkaConfiguration.DokkaModuleDescription -data class SourceRootImpl( - override val directory: File -) : DokkaConfiguration.SourceRoot { - constructor(directoryPath: String) : this(File(directoryPath)) -} - data class SourceLinkDefinitionImpl( override val path: String, override val url: String, diff --git a/core/src/main/kotlin/utilities/json.kt b/core/src/main/kotlin/utilities/json.kt index feac2b23..211037d6 100644 --- a/core/src/main/kotlin/utilities/json.kt +++ b/core/src/main/kotlin/utilities/json.kt @@ -1,26 +1,18 @@ package org.jetbrains.dokka.utilities import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.jetbrains.dokka.DokkaConfiguration.SourceRoot -import org.jetbrains.dokka.SourceRootImpl import java.io.File import com.fasterxml.jackson.core.type.TypeReference as JacksonTypeReference private val objectMapper = run { val module = SimpleModule().apply { addSerializer(FileSerializer) - addSerializer(SourceRoot::class.java, SourceRootSerializer) - addDeserializer(SourceRootImpl::class.java, SourceRootImplDeserializer) - addDeserializer(SourceRoot::class.java, SourceRootImplDeserializer) } jacksonObjectMapper() .registerModule(module) @@ -53,13 +45,3 @@ private object FileSerializer : StdScalarSerializer<File>(File::class.java) { g.writeString(value.path) } } - -private object SourceRootSerializer : StdScalarSerializer<SourceRoot>(SourceRoot::class.java) { - override fun serialize(value: SourceRoot, g: JsonGenerator, provider: SerializerProvider) { - g.writeString(value.directory.path) - } -} - -private object SourceRootImplDeserializer : StdScalarDeserializer<SourceRootImpl>(SourceRootImpl::class.java) { - override fun deserialize(p: JsonParser, ctxt: DeserializationContext): SourceRootImpl = SourceRootImpl(File(p.text)) -} |