aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2019-06-11 14:10:26 +0200
committerKamil Doległo <kamilok1965@interia.pl>2019-06-11 14:10:58 +0200
commitc27d5369b3732aaa158e5e19a2efd4895bd1b650 (patch)
treef840b61bbdb75f83626b72764ea99e9e21ae1498 /runners/gradle-plugin/src/main/kotlin
parent3873f0d3f0f5df1f2d42d365df0b3b618f60b324 (diff)
downloaddokka-c27d5369b3732aaa158e5e19a2efd4895bd1b650.tar.gz
dokka-c27d5369b3732aaa158e5e19a2efd4895bd1b650.tar.bz2
dokka-c27d5369b3732aaa158e5e19a2efd4895bd1b650.zip
Fix for bug in #5aace9
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin')
-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