aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-plugin/src/main')
-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/configurationImplementations.kt17
2 files changed, 18 insertions, 1 deletions
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 fa2e690e..38073c99 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
@@ -239,7 +239,7 @@ open class DokkaTask : DefaultTask() {
private fun mergeUserConfigurationAndPlatformData(userConfig: GradlePassConfigurationImpl,
autoConfig: ConfigurationExtractor.PlatformData): GradlePassConfigurationImpl {
- val merged = GradlePassConfigurationImpl(userConfig.name)
+ val merged = userConfig.copy()
merged.apply {
sourceRoots.addAll(userConfig.sourceRoots.union(autoConfig.sourceRoots.toSourceRoots()).distinct())
classpath = userConfig.classpath.union(autoConfig.classpath.map { it.absolutePath }).distinct()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
index c9c0d15d..8ed24ed9 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
@@ -9,6 +9,8 @@ import org.jetbrains.dokka.Platform
import java.io.File
import java.io.Serializable
import java.net.URL
+import kotlin.reflect.KMutableProperty
+import kotlin.reflect.full.memberProperties
class GradleSourceRootImpl: SourceRoot, Serializable {
override var path: String = ""
@@ -116,4 +118,19 @@ class GradlePackageOptionsImpl: PackageOptions {
override val reportUndocumented: Boolean = true
override val skipDeprecated: Boolean = true
override val suppress: Boolean = false
+}
+
+fun GradlePassConfigurationImpl.copy(): GradlePassConfigurationImpl {
+ val newObj = GradlePassConfigurationImpl(this.name)
+ this::class.memberProperties.forEach { field ->
+ if (field is KMutableProperty<*>) {
+ val value = field.getter.call(this)
+ if (value is Collection<*>) {
+ field.setter.call(newObj, value.toMutableList())
+ } else {
+ field.setter.call(newObj, field.getter.call(this))
+ }
+ }
+ }
+ return newObj
} \ No newline at end of file