aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-plugin/src')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt8
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt11
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt38
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt6
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt10
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt10
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt16
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/TaskDependencyInternalWithAdditions.kt5
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/KotlinSourceSetGist.kt25
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt51
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt6
12 files changed, 83 insertions, 105 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
index 5deaac49..89308e2a 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
@@ -49,13 +49,9 @@ abstract class AbstractDokkaTask(
@Classpath
val runtime: Configuration = project.maybeCreateDokkaRuntimeConfiguration(name)
- final override fun doFirst(action: Action<in Task>): Task {
- return super.doFirst(action)
- }
+ final override fun doFirst(action: Action<in Task>): Task = super.doFirst(action)
- final override fun doFirst(action: Closure<*>): Task {
- return super.doFirst(action)
- }
+ final override fun doFirst(action: Closure<*>): Task = super.doFirst(action)
@TaskAction
internal open fun generateDocumentation() {
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt
index 9da9352c..b2fd9924 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt
@@ -22,9 +22,9 @@ interface DokkaMultiModuleFileLayout {
* Will link to the original [AbstractDokkaTask.outputDirectory]. This requires no copying of the output files.
*/
object NoCopy : DokkaMultiModuleFileLayout {
- override fun targetChildOutputDirectory(parent: DokkaMultiModuleTask, child: AbstractDokkaTask): File {
- return child.outputDirectory.getSafe()
- }
+ override fun targetChildOutputDirectory(parent: DokkaMultiModuleTask, child: AbstractDokkaTask): File =
+ child.outputDirectory.getSafe()
+
}
/**
@@ -46,9 +46,8 @@ interface DokkaMultiModuleFileLayout {
internal fun DokkaMultiModuleTask.targetChildOutputDirectory(
child: AbstractDokkaTask
-): File {
- return fileLayout.get().targetChildOutputDirectory(this, child)
-}
+): File = fileLayout.get().targetChildOutputDirectory(this, child)
+
internal fun DokkaMultiModuleTask.copyChildOutputDirectories() {
childDokkaTasks.forEach { child ->
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 ba55dc31..5f9f5a10 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
@@ -40,9 +40,9 @@ open class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBootst
get() = childDokkaTasks.map { task -> targetChildOutputDirectory(task) }
@Internal
- override fun getTaskDependencies(): TaskDependencyInternal {
- return super.getTaskDependencies() + childDokkaTasks
- }
+ override fun getTaskDependencies(): TaskDependencyInternal =
+ super.getTaskDependencies() + childDokkaTasks
+
override fun generateDocumentation() {
checkChildDokkaTasksIsNotEmpty()
@@ -50,23 +50,21 @@ open class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBootst
super.generateDocumentation()
}
- override fun buildDokkaConfiguration(): DokkaConfigurationImpl {
- return DokkaConfigurationImpl(
- outputDir = outputDirectory.getSafe(),
- cacheRoot = cacheRoot.getSafe(),
- pluginsConfiguration = pluginsConfiguration.getSafe(),
- failOnWarning = failOnWarning.getSafe(),
- offlineMode = offlineMode.getSafe(),
- pluginsClasspath = plugins.resolve().toList(),
- modules = childDokkaTasks.map { dokkaTask ->
- DokkaModuleDescriptionImpl(
- name = dokkaTask.project.name,
- path = targetChildOutputDirectory(dokkaTask).relativeTo(outputDirectory.getSafe()),
- docFile = dokkaTask.project.projectDir.resolve(documentationFileName.get()).absoluteFile
- )
- }
- )
- }
+ override fun buildDokkaConfiguration(): DokkaConfigurationImpl = DokkaConfigurationImpl(
+ outputDir = outputDirectory.getSafe(),
+ cacheRoot = cacheRoot.getSafe(),
+ pluginsConfiguration = pluginsConfiguration.getSafe(),
+ failOnWarning = failOnWarning.getSafe(),
+ offlineMode = offlineMode.getSafe(),
+ pluginsClasspath = plugins.resolve().toList(),
+ modules = childDokkaTasks.map { dokkaTask ->
+ DokkaModuleDescriptionImpl(
+ name = dokkaTask.project.name,
+ path = targetChildOutputDirectory(dokkaTask).relativeTo(outputDirectory.getSafe()),
+ docFile = dokkaTask.project.projectDir.resolve(documentationFileName.get()).absoluteFile
+ )
+ }
+ )
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt
index c24e369c..b7e87c6c 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt
@@ -15,7 +15,7 @@ internal inline fun <reified T : Any> Property<T?>.safeConvention(value: T): Pro
}
@OptIn(ExperimentalStdlibApi::class)
-internal inline fun <reified T> Provider<T>.getSafe(): T {
- return if (typeOf<T>().isMarkedNullable) orNull as T
+internal inline fun <reified T> Provider<T>.getSafe(): T =
+ if (typeOf<T>().isMarkedNullable) orNull as T
else get()
-}
+
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 59c5e9f8..881f9cf8 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
@@ -121,9 +121,9 @@ open class GradleDokkaSourceSetBuilder constructor(
val platform: Property<Platform> = project.objects.safeProperty<Platform>()
.safeConvention(Platform.DEFAULT)
- fun DokkaSourceSetID(sourceSetName: String): DokkaSourceSetID {
- return DokkaSourceSetID(project, sourceSetName)
- }
+ fun DokkaSourceSetID(sourceSetName: String): DokkaSourceSetID =
+ DokkaSourceSetID(project, sourceSetName)
+
fun dependsOn(sourceSet: SourceSet) {
dependsOn(DokkaSourceSetID(sourceSet.name))
@@ -205,9 +205,7 @@ open class GradleDokkaSourceSetBuilder constructor(
)
}
- override fun build(): DokkaSourceSetImpl {
- return toDokkaSourceSetImpl()
- }
+ override fun build(): DokkaSourceSetImpl = toDokkaSourceSetImpl()
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt
index 23017917..65e23654 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt
@@ -18,10 +18,8 @@ class GradleExternalDocumentationLinkBuilder(
@Input
val packageListUrl: Property<URL?> = project.objects.safeProperty()
- override fun build(): ExternalDocumentationLinkImpl {
- return ExternalDocumentationLink(
- url = checkNotNull(url.getSafe()) { "url not specified " },
- packageListUrl = packageListUrl.getSafe()
- )
- }
+ override fun build(): ExternalDocumentationLinkImpl = ExternalDocumentationLink(
+ url = checkNotNull(url.getSafe()) { "url not specified " },
+ packageListUrl = packageListUrl.getSafe()
+ )
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
index ba66ad45..6485c8ed 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
@@ -34,13 +34,11 @@ class GradlePackageOptionsBuilder(
val suppress: Property<Boolean> = project.objects.safeProperty<Boolean>()
.safeConvention(DokkaDefaults.suppress)
- override fun build(): PackageOptionsImpl {
- return PackageOptionsImpl(
- prefix = checkNotNull(prefix.getSafe()) { "prefix not specified" },
- includeNonPublic = includeNonPublic.getSafe(),
- reportUndocumented = reportUndocumented.getSafe(),
- skipDeprecated = skipDeprecated.getSafe(),
- suppress = suppress.getSafe()
- )
- }
+ override fun build(): PackageOptionsImpl = PackageOptionsImpl(
+ prefix = checkNotNull(prefix.getSafe()) { "prefix not specified" },
+ includeNonPublic = includeNonPublic.getSafe(),
+ reportUndocumented = reportUndocumented.getSafe(),
+ skipDeprecated = skipDeprecated.getSafe(),
+ suppress = suppress.getSafe()
+ )
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/TaskDependencyInternalWithAdditions.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/TaskDependencyInternalWithAdditions.kt
index 969b1aa1..559484aa 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/TaskDependencyInternalWithAdditions.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/TaskDependencyInternalWithAdditions.kt
@@ -5,9 +5,8 @@ import org.gradle.api.internal.tasks.AbstractTaskDependency
import org.gradle.api.internal.tasks.TaskDependencyInternal
import org.gradle.api.internal.tasks.TaskDependencyResolveContext
-internal operator fun TaskDependencyInternal.plus(tasks: Iterable<Task>): TaskDependencyInternal {
- return TaskDependencyInternalWithAdditions(this, tasks.toSet())
-}
+internal operator fun TaskDependencyInternal.plus(tasks: Iterable<Task>): TaskDependencyInternal =
+ TaskDependencyInternalWithAdditions(this, tasks.toSet())
private class TaskDependencyInternalWithAdditions(
private val dependency: TaskDependencyInternal,
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/KotlinSourceSetGist.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/KotlinSourceSetGist.kt
index f889b5e8..c534b24e 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/KotlinSourceSetGist.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/KotlinSourceSetGist.kt
@@ -15,16 +15,15 @@ internal data class KotlinSourceSetGist(
val dependentSourceSetNames: Provider<Set<String>>,
)
-internal fun Project.gistOf(sourceSet: KotlinSourceSet): KotlinSourceSetGist {
- return KotlinSourceSetGist(
- name = sourceSet.name,
- platform = platformOf(sourceSet),
- isMain = isMainSourceSet(sourceSet),
- classpath = classpathOf(sourceSet).filter { it.exists() },
- // TODO: Needs to respect filters.
- // We probably need to change from "sourceRoots" to support "sourceFiles"
- // https://github.com/Kotlin/dokka/issues/1215
- sourceRoots = sourceSet.kotlin.sourceDirectories.filter { it.exists() },
- dependentSourceSetNames = project.provider { sourceSet.dependsOn.map { it.name }.toSet() },
- )
-}
+internal fun Project.gistOf(sourceSet: KotlinSourceSet): KotlinSourceSetGist = KotlinSourceSetGist(
+ name = sourceSet.name,
+ platform = platformOf(sourceSet),
+ isMain = isMainSourceSet(sourceSet),
+ classpath = classpathOf(sourceSet).filter { it.exists() },
+ // TODO: Needs to respect filters.
+ // We probably need to change from "sourceRoots" to support "sourceFiles"
+ // https://github.com/Kotlin/dokka/issues/1215
+ sourceRoots = sourceSet.kotlin.sourceDirectories.filter { it.exists() },
+ dependentSourceSetNames = project.provider { sourceSet.dependsOn.map { it.name }.toSet() },
+)
+
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 3162b614..dff61f68 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
@@ -1,5 +1,3 @@
-@file:Suppress("UnstableApiUsage")
-
package org.jetbrains.dokka.gradle
import org.jetbrains.dokka.Platform
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
index 5ec21988..0f9d4053 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
@@ -4,32 +4,31 @@ import org.jetbrains.dokka.*
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
import java.io.File
-internal fun GradleDokkaSourceSetBuilder.toDokkaSourceSetImpl(): DokkaSourceSetImpl {
- return DokkaSourceSetImpl(
- classpath = classpath.toList(),
- moduleDisplayName = moduleNameOrDefault(),
- displayName = displayNameOrDefault(),
- sourceSetID = sourceSetID,
- sourceRoots = sourceRoots.toSet(),
- dependentSourceSets = dependentSourceSets.getSafe().toSet(),
- samples = samples.toSet(),
- includes = includes.toSet(),
- includeNonPublic = includeNonPublic.getSafe(),
- reportUndocumented = reportUndocumented.getSafe(),
- skipEmptyPackages = skipEmptyPackages.getSafe(),
- skipDeprecated = skipDeprecated.getSafe(),
- jdkVersion = jdkVersion.getSafe(),
- sourceLinks = sourceLinks.getSafe().build().toSet(),
- perPackageOptions = perPackageOptions.getSafe().build(),
- externalDocumentationLinks = externalDocumentationLinksWithDefaults(),
- languageVersion = languageVersion.getSafe(),
- apiVersion = apiVersion.getSafe(),
- noStdlibLink = noStdlibLink.getSafe(),
- noJdkLink = noJdkLink.getSafe(),
- suppressedFiles = suppressedFilesWithDefaults(),
- analysisPlatform = platform.getSafe()
- )
-}
+internal fun GradleDokkaSourceSetBuilder.toDokkaSourceSetImpl(): DokkaSourceSetImpl = DokkaSourceSetImpl(
+ classpath = classpath.toList(),
+ moduleDisplayName = moduleNameOrDefault(),
+ displayName = displayNameOrDefault(),
+ sourceSetID = sourceSetID,
+ sourceRoots = sourceRoots.toSet(),
+ dependentSourceSets = dependentSourceSets.getSafe().toSet(),
+ samples = samples.toSet(),
+ includes = includes.toSet(),
+ includeNonPublic = includeNonPublic.getSafe(),
+ reportUndocumented = reportUndocumented.getSafe(),
+ skipEmptyPackages = skipEmptyPackages.getSafe(),
+ skipDeprecated = skipDeprecated.getSafe(),
+ jdkVersion = jdkVersion.getSafe(),
+ sourceLinks = sourceLinks.getSafe().build().toSet(),
+ perPackageOptions = perPackageOptions.getSafe().build(),
+ externalDocumentationLinks = externalDocumentationLinksWithDefaults(),
+ languageVersion = languageVersion.getSafe(),
+ apiVersion = apiVersion.getSafe(),
+ noStdlibLink = noStdlibLink.getSafe(),
+ noJdkLink = noJdkLink.getSafe(),
+ suppressedFiles = suppressedFilesWithDefaults(),
+ analysisPlatform = platform.getSafe()
+)
+
private fun GradleDokkaSourceSetBuilder.moduleNameOrDefault(): String {
return moduleDisplayName.getSafe() ?: project.name
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
index 7a69c409..ba311cfe 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
@@ -24,9 +24,7 @@ internal infix fun <T> HasMultipleValues<in T>.by(values: Iterable<T>) {
this.set(values)
}
-internal fun parsePath(path: String): Path {
- return Path.path(path)
-}
+internal fun parsePath(path: String): Path = Path.path(path)
internal val Project.kotlinOrNull: KotlinProjectExtension?
get() = try {
@@ -47,8 +45,6 @@ internal fun Project.isAndroidProject() = try {
false
}
-internal fun Project.isNotMultiplatformProject() = !isMultiplatformProject()
-
internal fun Project.isMultiplatformProject() = try {
project.extensions.getByType(KotlinMultiplatformExtension::class.java)
true