From 4451b8e546584da389da60f73b56ce25d6ac2eaa Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Thu, 28 Apr 2022 15:20:43 +0300 Subject: Make a default value dependent on source set (#2449) * Make a default value dependent on source set * Get a default value from an expect source set * Fix default value for expect properties * Deprecate `DefaultValue.value` * Add test * Refactor * Reformat --- core/src/main/kotlin/model/defaultValues.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'core/src/main/kotlin/model') diff --git a/core/src/main/kotlin/model/defaultValues.kt b/core/src/main/kotlin/model/defaultValues.kt index d9caecd9..a118eb4d 100644 --- a/core/src/main/kotlin/model/defaultValues.kt +++ b/core/src/main/kotlin/model/defaultValues.kt @@ -3,9 +3,15 @@ package org.jetbrains.dokka.model import org.jetbrains.dokka.model.properties.ExtraProperty import org.jetbrains.dokka.model.properties.MergeStrategy -class DefaultValue(val value: Expression): ExtraProperty { +class DefaultValue(val expression: SourceSetDependent): ExtraProperty { + + @Deprecated("Use `expression` property that depends on source set", ReplaceWith("this.expression.values.first()")) + val value: Expression + get() = expression.values.first() companion object : ExtraProperty.Key { - override fun mergeStrategyFor(left: DefaultValue, right: DefaultValue): MergeStrategy = MergeStrategy.Remove // TODO pass a logger somehow and log this + override fun mergeStrategyFor(left: DefaultValue, right: DefaultValue): MergeStrategy = + MergeStrategy.Replace(DefaultValue(left.expression + right.expression)) + } override val key: ExtraProperty.Key -- cgit