aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-22 11:12:16 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-14 17:51:11 +0200
commit37d12bed40edc226d96d0e1a4b28a24583ece94f (patch)
tree424ec0e7f60fc9a9c0eb9a9747a99faea714fdf9 /runners
parenteae1ce49d18c2978b49166ea502bf2c109a85504 (diff)
downloaddokka-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 'runners')
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt40
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt4
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt54
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceRootBuilder.kt15
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGist.kt1
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt7
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt1
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt2
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt33
11 files changed, 68 insertions, 93 deletions
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index df763596..a9c15ec1 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -36,11 +36,13 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
description = "Configuration for plugins in format fqPluginName=json^^fqPluginName=json..."
).default(emptyMap())
- override val pluginsClasspath by parser.option(
+ private val pluginsClasspathList by parser.option(
ArgTypeFile,
+ fullName = "pluginsClasspath",
description = "List of jars with dokka plugins (allows many paths separated by the semicolon `;`)"
).delimiter(";")
+ override val pluginsClasspath: Set<File> by lazy { pluginsClasspathList.toMutableSet() }
override val offlineMode by parser.option(
ArgType.Boolean,
@@ -77,19 +79,19 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
init {
parser.parse(args)
- sourceSets.all {
+ sourceSets.forEach {
it.perPackageOptions.cast<MutableList<DokkaConfiguration.PackageOptions>>()
.addAll(parsePerPackageOptions(globalPackageOptions))
}
- sourceSets.all {
- it.externalDocumentationLinks.cast<MutableList<ExternalDocumentationLink>>().addAll(parseLinks(globalLinks))
+ sourceSets.forEach {
+ it.externalDocumentationLinks.cast<MutableSet<ExternalDocumentationLink>>().addAll(parseLinks(globalLinks))
}
globalSrcLink.forEach {
if (it.isNotEmpty() && it.contains("="))
sourceSets.all { sourceSet ->
- sourceSet.sourceLinks.cast<MutableList<SourceLinkDefinitionImpl>>()
+ sourceSet.sourceLinks.cast<MutableSet<SourceLinkDefinitionImpl>>()
.add(SourceLinkDefinitionImpl.parseSourceLinkDefinition(it))
}
else {
@@ -98,10 +100,7 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
}
sourceSets.forEach {
- it.externalDocumentationLinks.cast<MutableList<ExternalDocumentationLink>>().addAll(defaultLinks(it))
- it.externalDocumentationLinks.cast<MutableList<ExternalDocumentationLink>>().replaceAll { link ->
- ExternalDocumentationLink.Builder(link.url, link.packageListUrl).build()
- }
+ it.externalDocumentationLinks.cast<MutableSet<ExternalDocumentationLink>>().addAll(defaultLinks(it))
}
}
}
@@ -227,28 +226,28 @@ private fun parseSourceSet(args: Array<String>): DokkaConfiguration.DokkaSourceS
override val moduleDisplayName = moduleDisplayName ?: moduleName
override val displayName = displayName
override val sourceSetID = DokkaSourceSetID(moduleName, sourceSetName)
- override val classpath = classpath
- override val sourceRoots = sourceRoots.map { SourceRootImpl(it) }
- override val dependentSourceSets: Set<DokkaSourceSetID> = dependentSourceSets
+ override val classpath = classpath.toMutableSet()
+ override val sourceRoots = sourceRoots.toMutableSet()
+ override val dependentSourceSets = dependentSourceSets
.map { dependentSourceSetName -> dependentSourceSetName.split('/').let { DokkaSourceSetID(it[0], it[1]) } }
- .toSet()
- override val samples = samples
- override val includes = includes
+ .toMutableSet()
+ override val samples = samples.toMutableSet()
+ override val includes = includes.toMutableSet()
override val includeNonPublic = includeNonPublic
override val includeRootPackage = includeRootPackage
override val reportUndocumented = reportUndocumented
override val skipEmptyPackages = skipEmptyPackages
override val skipDeprecated = skipDeprecated
override val jdkVersion = jdkVersion
- override val sourceLinks = sourceLinks
+ override val sourceLinks = sourceLinks.toMutableSet()
override val analysisPlatform = analysisPlatform
override val perPackageOptions = parsePerPackageOptions(perPackageOptions)
- override val externalDocumentationLinks = parseLinks(externalDocumentationLinks)
+ override val externalDocumentationLinks = parseLinks(externalDocumentationLinks).toMutableSet()
override val languageVersion = languageVersion
override val apiVersion = apiVersion
override val noStdlibLink = noStdlibLink
override val noJdkLink = noJdkLink
- override val suppressedFiles = suppressedFiles
+ override val suppressedFiles = suppressedFiles.toMutableSet()
}
}
@@ -307,13 +306,14 @@ object ArgTypeHelpSourceSet : ArgType<Any>(false) {
fun defaultLinks(config: DokkaConfiguration.DokkaSourceSet): MutableList<ExternalDocumentationLink> =
mutableListOf<ExternalDocumentationLink>().apply {
if (!config.noJdkLink) {
+ // TODO NOW: Duplication
val javadocLink =
if (config.jdkVersion < 11) "https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/"
else "https://docs.oracle.com/en/java/javase/${config.jdkVersion}/docs/api/java.base/"
val packageListLink =
if (config.jdkVersion < 11) "${javadocLink}/package-list"
else "https://docs.oracle.com/en/java/javase/${config.jdkVersion}/docs/api/element-list"
- this += DokkaConfiguration.ExternalDocumentationLink
+ this += ExternalDocumentationLink
.Builder(javadocLink, packageListLink)
.build()
}
@@ -324,7 +324,6 @@ fun defaultLinks(config: DokkaConfiguration.DokkaSourceSet): MutableList<Externa
.build()
}
-private fun String.toAbsolutePath() = Paths.get(this).toAbsolutePath().toString()
fun parseLinks(links: List<String>): List<ExternalDocumentationLink> {
val (parsedLinks, parsedOfflineLinks) = links
@@ -355,3 +354,4 @@ fun main(args: Array<String>) {
globalArguments
DokkaGenerator(configuration, DokkaConsoleLogger).generate()
}
+
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
index 7a73d633..4762c333 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
@@ -10,7 +10,7 @@ open class DokkaCollectorTask : AbstractDokkaParentTask() {
cacheRoot = cacheRoot,
failOnWarning = failOnWarning,
offlineMode = offlineMode,
- pluginsClasspath = plugins.resolve().toList(),
+ pluginsClasspath = plugins.resolve().toSet(),
)
val subprojectDokkaConfigurations = dokkaTasks.map { dokkaTask -> dokkaTask.buildDokkaConfiguration() }
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt
index 8369954b..48a9721f 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka.gradle
import org.gradle.api.internal.tasks.TaskDependencyInternal
import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.Internal
import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.DokkaModuleDescriptionImpl
import org.jetbrains.dokka.DokkaMultimoduleBootstrapImpl
@@ -16,6 +17,7 @@ open class DokkaMultimoduleTask : AbstractDokkaParentTask(DokkaMultimoduleBootst
@Input
var documentationFileName: String = "README.md"
+ @Internal
override fun getTaskDependencies(): TaskDependencyInternal {
return super.getTaskDependencies() + dokkaTasks
}
@@ -27,7 +29,7 @@ open class DokkaMultimoduleTask : AbstractDokkaParentTask(DokkaMultimoduleBootst
pluginsConfiguration = pluginsConfiguration,
failOnWarning = failOnWarning,
offlineMode = offlineMode,
- pluginsClasspath = plugins.resolve().toList(),
+ pluginsClasspath = plugins.resolve().toSet(),
modules = dokkaTasks.map { dokkaTask ->
DokkaModuleDescriptionImpl(
name = dokkaTask.project.name,
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index a74068ae..06b936ce 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -29,7 +29,7 @@ open class DokkaTask : AbstractDokkaTask(DokkaBootstrapImpl::class) {
failOnWarning = failOnWarning,
sourceSets = dokkaSourceSets.build(),
pluginsConfiguration = pluginsConfiguration,
- pluginsClasspath = plugins.resolve().toList()
+ pluginsClasspath = plugins.resolve()
)
}
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt
index e420e1a5..09c9bec9 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt
@@ -27,7 +27,7 @@ open class GradleDokkaSourceSetBuilder constructor(
@Classpath
@Optional
- var classpath: List<File> = emptyList()
+ val classpath: MutableSet<File> = mutableSetOf()
@Input
@Optional
@@ -41,18 +41,18 @@ open class GradleDokkaSourceSetBuilder constructor(
val sourceSetID: DokkaSourceSetID = DokkaSourceSetID(project, name)
@Nested
- var sourceRoots: MutableList<GradleSourceRootBuilder> = mutableListOf()
+ val sourceRoots: MutableSet<File> = mutableSetOf()
@Input
- var dependentSourceSets: MutableSet<DokkaSourceSetID> = mutableSetOf()
+ val dependentSourceSets: MutableSet<DokkaSourceSetID> = mutableSetOf()
@InputFiles
@Optional
- var samples: List<File> = emptyList()
+ val samples: MutableSet<File> = mutableSetOf()
@InputFiles
@Optional
- var includes: List<File> = emptyList()
+ val includes: MutableSet<File> = mutableSetOf()
@Input
var includeNonPublic: Boolean = DokkaDefaults.includeNonPublic
@@ -73,13 +73,13 @@ open class GradleDokkaSourceSetBuilder constructor(
var jdkVersion: Int = DokkaDefaults.jdkVersion
@Nested
- var sourceLinks: MutableList<GradleSourceLinkBuilder> = mutableListOf()
+ val sourceLinks: MutableSet<GradleSourceLinkBuilder> = mutableSetOf()
@Nested
- var perPackageOptions: MutableList<GradlePackageOptionsBuilder> = mutableListOf()
+ val perPackageOptions: MutableList<GradlePackageOptionsBuilder> = mutableListOf()
@Nested
- var externalDocumentationLinks: MutableList<GradleExternalDocumentationLinkBuilder> = mutableListOf()
+ val externalDocumentationLinks: MutableSet<GradleExternalDocumentationLinkBuilder> = mutableSetOf()
@Input
@Optional
@@ -99,7 +99,7 @@ open class GradleDokkaSourceSetBuilder constructor(
var noAndroidSdkLink: Boolean = false
@Input
- var suppressedFiles: List<File> = emptyList()
+ val suppressedFiles: MutableSet<File> = mutableSetOf()
@Input
@Optional
@@ -134,15 +134,13 @@ open class GradleDokkaSourceSetBuilder constructor(
}
// TODO NOW: Cover with tests
- fun sourceRoot(c: Closure<Unit>) {
- val configured = ConfigureUtil.configure(c, GradleSourceRootBuilder())
- sourceRoots.add(configured)
+
+ fun sourceRoot(file: File) {
+ sourceRoots.add(file)
}
- fun sourceRoot(action: Action<in GradleSourceRootBuilder>) {
- val sourceRoot = GradleSourceRootBuilder()
- action.execute(sourceRoot)
- sourceRoots.add(sourceRoot)
+ fun sourceRoot(path: String) {
+ sourceRoots.add(project.file(path))
}
fun sourceLink(c: Closure<Unit>) {
@@ -241,33 +239,31 @@ open class GradleDokkaSourceSetBuilder constructor(
else -> Platform.DEFAULT
}
- val sourceRoots = sourceRoots.build().distinct()
-
- val suppressedFiles = suppressedFiles + project.collectSuppressedFiles(sourceRoots)
+ val suppressedFiles = suppressedFiles + project.collectSuppressedFiles(sourceRoots.toSet())
return DokkaSourceSetImpl(
- classpath = classpath.distinct().toList(),
+ classpath = classpath.toSet(),
moduleDisplayName = moduleDisplayName,
displayName = displayName,
sourceSetID = sourceSetID,
- sourceRoots = sourceRoots,
+ sourceRoots = sourceRoots.toSet(),
dependentSourceSets = dependentSourceSets.toSet(),
- samples = samples.toList(),
- includes = includes.toList(),
+ samples = samples.toSet(),
+ includes = includes.toSet(),
includeNonPublic = includeNonPublic,
includeRootPackage = includeRootPackage,
reportUndocumented = reportUndocumented,
skipEmptyPackages = skipEmptyPackages,
skipDeprecated = skipDeprecated,
jdkVersion = jdkVersion,
- sourceLinks = sourceLinks.build(),
+ sourceLinks = sourceLinks.build().toSet(),
perPackageOptions = perPackageOptions.build(),
- externalDocumentationLinks = externalDocumentationLinks,
+ externalDocumentationLinks = externalDocumentationLinks.toSet(),
languageVersion = languageVersion,
apiVersion = apiVersion,
noStdlibLink = noStdlibLink,
noJdkLink = noJdkLink,
- suppressedFiles = suppressedFiles,
+ suppressedFiles = suppressedFiles.toSet(),
analysisPlatform = analysisPlatform
)
}
@@ -286,13 +282,13 @@ fun GradleDokkaSourceSetBuilder.dependsOn(sourceSet: AndroidSourceSet) {
}
// TODO NOW: Test
-private fun Project.collectSuppressedFiles(sourceRoots: List<DokkaConfiguration.SourceRoot>): List<File> =
+private fun Project.collectSuppressedFiles(sourceRoots: Set<File>): Set<File> =
if (project.isAndroidProject()) {
val generatedRoot = project.buildDir.resolve("generated").absoluteFile
sourceRoots
- .map { it.directory }
.filter { it.startsWith(generatedRoot) }
.flatMap { it.walk().toList() }
+ .toSet()
} else {
- emptyList()
+ emptySet()
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceRootBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceRootBuilder.kt
deleted file mode 100644
index 687dec9c..00000000
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceRootBuilder.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.jetbrains.dokka.gradle
-
-import org.gradle.api.tasks.InputDirectory
-import org.jetbrains.dokka.DokkaConfigurationBuilder
-import org.jetbrains.dokka.SourceRootImpl
-import java.io.File
-
-class GradleSourceRootBuilder : DokkaConfigurationBuilder<SourceRootImpl> {
- @InputDirectory
- var directory: File? = null
-
- override fun build(): SourceRootImpl {
- return SourceRootImpl(checkNotNull(directory) { "directory not set" })
- }
-}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGist.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGist.kt
index 334aae15..6e202ac3 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGist.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGist.kt
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
+// TODO NOW: Test this all
private typealias KotlinCompilation =
org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<KotlinCommonOptions>
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt
index 9bb11f36..88833a76 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt
@@ -9,13 +9,12 @@ fun GradleDokkaSourceSetBuilder.configureWithKotlinSourceSet(sourceSet: KotlinSo
}
internal fun GradleDokkaSourceSetBuilder.configureWithKotlinSourceSetGist(sourceSet: KotlinSourceSetGist) {
- sourceRoots.addAll(sourceRoots.union(sourceSet.sourceRoots.toSourceRoots()).distinct())
+ sourceRoots.addAll(sourceRoots.union(sourceSet.sourceRoots).distinct())
dependentSourceSets.addAll(dependentSourceSets)
dependentSourceSets.addAll(sourceSet.dependentSourceSets.map { DokkaSourceSetID(project, it) })
- classpath = classpath.union(sourceSet.classpath).distinct()
+ classpath.addAll(sourceSet.classpath)
if (platform == null && sourceSet.platform != "")
platform = sourceSet.platform
}
-private fun Iterable<File>.toSourceRoots(): List<GradleSourceRootBuilder> =
- this.filter { it.exists() }.map { GradleSourceRootBuilder().apply { directory = it } }
+
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt
index 2d8dc21a..58a44a5c 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt
@@ -50,7 +50,6 @@ class DokkaCollectorTaskTest {
pluginsClasspath = task.dokkaTasks
.map { it.plugins.resolve() }
.reduce { acc, mutableSet -> acc + mutableSet }
- .toList()
),
dokkaConfiguration
)
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
index ff318bdf..8814a897 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
@@ -69,7 +69,7 @@ class DokkaMultiModuleTaskTest {
outputDir = task.project.buildDir.resolve("customOutputDirectory"),
cacheRoot = File("customCacheRoot"),
pluginsConfiguration = mapOf("pluginA" to "configA"),
- pluginsClasspath = emptyList(),
+ pluginsClasspath = emptySet(),
failOnWarning = true,
offlineMode = true,
modules = listOf(
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index 3df2a17e..4dc9020a 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -53,13 +53,6 @@ class ExternalDocumentationLinkBuilder : DokkaConfiguration.ExternalDocumentatio
}
abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependency>) : AbstractMojo() {
- class SourceRoot : DokkaConfigurationBuilder<DokkaConfiguration.SourceRoot> {
- @Parameter(required = true)
- var path: String = ""
- override fun build(): DokkaConfiguration.SourceRoot {
- return SourceRootImpl(File(path))
- }
- }
@Parameter(defaultValue = "\${project}", readonly = true)
private var mavenProject: MavenProject? = null
@@ -185,17 +178,17 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
throw MojoExecutionException("Incorrect path property, only Unix based path allowed.")
}
}
- fun defaultLinks(config: DokkaSourceSetImpl): List<ExternalDocumentationLinkImpl> {
- val links = mutableListOf<ExternalDocumentationLinkImpl>()
+ fun defaultLinks(config: DokkaSourceSetImpl): Set<ExternalDocumentationLinkImpl> {
+ val links = mutableSetOf<ExternalDocumentationLinkImpl>()
if (!config.noJdkLink)
links += DokkaConfiguration.ExternalDocumentationLink
.Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/")
- .build() as ExternalDocumentationLinkImpl
+ .build()
if (!config.noStdlibLink)
links += DokkaConfiguration.ExternalDocumentationLink
.Builder("https://kotlinlang.org/api/latest/jvm/stdlib/")
- .build() as ExternalDocumentationLinkImpl
+ .build()
return links
}
@@ -203,18 +196,18 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
moduleDisplayName = moduleDisplayName.takeIf(String::isNotBlank) ?: moduleName,
displayName = displayName,
sourceSetID = DokkaSourceSetID(moduleName, sourceSetName),
- classpath = classpath.map(::File),
- sourceRoots = sourceDirectories.map(::File).map(::SourceRootImpl),
+ classpath = classpath.map(::File).toSet(),
+ sourceRoots = sourceDirectories.map(::File).toSet(),
dependentSourceSets = emptySet(),
- samples = samples.map(::File),
- includes = includes.map(::File),
+ samples = samples.map(::File).toSet(),
+ includes = includes.map(::File).toSet(),
includeNonPublic = includeNonPublic,
includeRootPackage = includeRootPackage,
reportUndocumented = reportUndocumented,
skipEmptyPackages = skipEmptyPackages,
skipDeprecated = skipDeprecated,
jdkVersion = jdkVersion,
- sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, it.url, it.lineSuffix) },
+ sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, it.url, it.lineSuffix) }.toSet(),
perPackageOptions = perPackageOptions.map {
PackageOptionsImpl(
prefix = it.prefix,
@@ -224,12 +217,12 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
suppress = it.suppress
)
},
- externalDocumentationLinks = externalDocumentationLinks.map { it.build() as ExternalDocumentationLinkImpl },
+ externalDocumentationLinks = externalDocumentationLinks.map { it.build() }.toSet(),
languageVersion = languageVersion,
apiVersion = apiVersion,
noStdlibLink = noStdlibLink,
noJdkLink = noJdkLink,
- suppressedFiles = suppressedFiles.map(::File),
+ suppressedFiles = suppressedFiles.map(::File).toSet(),
analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT
).let {
it.copy(
@@ -278,7 +271,7 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
groupId: String,
artifactId: String,
version: String
- ): List<File> {
+ ): Set<File> {
val repoSystem: RepositorySystem = newRepositorySystem()
val session: RepositorySystemSession = newSession(repoSystem)
val dependency =
@@ -303,7 +296,7 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
repoSystem.resolveDependencies(session, dependencyRequest)
val nlg = PreorderNodeListGenerator()
node.accept(nlg)
- return nlg.files
+ return nlg.files.toSet()
}
private val dokkaVersion: String by lazy {