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 /plugins/base/src | |
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 'plugins/base/src')
5 files changed, 11 insertions, 13 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 1ac4edf7..383a3715 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -95,7 +95,7 @@ private class DokkaDescriptorVisitor( private fun Collection<DeclarationDescriptor>.filterDescriptorsInSourceSet() = filter { it.toSourceElement.containingFile.toString().let { path -> path.isNotBlank() && sourceSet.sourceRoots.any { root -> - Paths.get(path).startsWith(root.directory.toPath()) + Paths.get(path).startsWith(root.toPath()) } } } diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index cd43e635..71c19bbe 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -44,7 +44,7 @@ class DefaultPsiToDocumentableTranslator( override fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule { fun isFileInSourceRoots(file: File): Boolean { - return sourceSet.sourceRoots.any { root -> file.startsWith(root.directory) } + return sourceSet.sourceRoots.any { root -> file.startsWith(root) } } val (environment, _) = kotlinAnalysis[sourceSet] diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt index 8ab277f1..b4de5aed 100644 --- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt @@ -1,12 +1,10 @@ package renderers.html -import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.SourceRootImpl import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.ContentDivergentGroup import org.junit.jupiter.api.Test -import renderers.* +import renderers.TestPage import utils.Div import utils.Span import utils.match diff --git a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt index ae494929..eea4dc0c 100644 --- a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt +++ b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt @@ -2,7 +2,6 @@ package renderers.html import org.jetbrains.dokka.DokkaConfigurationImpl import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.SourceRootImpl import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.DefaultTabSortingStrategy import org.jetbrains.dokka.base.renderers.RootCreator @@ -17,6 +16,7 @@ import org.jsoup.nodes.TextNode import renderers.RenderingOnlyTestBase import utils.TestOutputWriter import renderers.defaultSourceSet +import java.io.File abstract class HtmlRenderingOnlyTestBase : RenderingOnlyTestBase<Element>() { @@ -25,7 +25,7 @@ abstract class HtmlRenderingOnlyTestBase : RenderingOnlyTestBase<Element>() { "JS", defaultSourceSet.sourceSetID.copy(sourceSetName = "js"), analysisPlatform = Platform.js, - sourceRoots = listOf(SourceRootImpl("pl1")) + sourceRoots = setOf(File("pl1")) ) protected val jvm = defaultSourceSet.copy( "root", @@ -33,14 +33,14 @@ abstract class HtmlRenderingOnlyTestBase : RenderingOnlyTestBase<Element>() { defaultSourceSet.sourceSetID.copy(sourceSetName = "jvm"), analysisPlatform = Platform.jvm, - sourceRoots = listOf(SourceRootImpl("pl1")) + sourceRoots = setOf(File("pl1")) ) protected val native = defaultSourceSet.copy( "root", "NATIVE", defaultSourceSet.sourceSetID.copy(sourceSetName = "native"), analysisPlatform = Platform.native, - sourceRoots = listOf(SourceRootImpl("pl1")) + sourceRoots = setOf(File("pl1")) ) val files = TestOutputWriter() diff --git a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt index cf7f47e6..77ba390e 100644 --- a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt @@ -1,7 +1,6 @@ package renderers.html import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.SourceRootImpl import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.pages.TextStyle import org.junit.jupiter.api.Test @@ -10,6 +9,7 @@ import renderers.defaultSourceSet import renderers.RenderingOnlyTestBase import utils.Div import utils.match +import java.io.File class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() { @@ -18,21 +18,21 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() { "pl1", defaultSourceSet.sourceSetID.copy(sourceSetName = "pl1"), analysisPlatform = Platform.js, - sourceRoots = listOf(SourceRootImpl("pl1")) + sourceRoots = setOf(File("pl1")) ) private val pl2 = defaultSourceSet.copy( "root", "pl2", defaultSourceSet.sourceSetID.copy(sourceSetName = "pl2"), analysisPlatform = Platform.jvm, - sourceRoots = listOf(SourceRootImpl("pl1")) + sourceRoots = setOf(File("pl1")) ) private val pl3 = defaultSourceSet.copy( "root", "pl3", defaultSourceSet.sourceSetID.copy(sourceSetName = "pl3"), analysisPlatform = Platform.native, - sourceRoots = listOf(SourceRootImpl("pl1")) + sourceRoots = setOf(File("pl1")) ) @Test |