diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2022-08-25 18:23:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 18:23:41 +0300 |
commit | c37c9716857d78589a9e6faba27d2c596f2384de (patch) | |
tree | cc0c1de4575b76f06e1d95ddecf2c30fdfe06adb /runners/gradle-plugin/src/main/kotlin/org | |
parent | 09c220e678f0a8dde3450da58fab57523fcfc047 (diff) | |
download | dokka-c37c9716857d78589a9e6faba27d2c596f2384de.tar.gz dokka-c37c9716857d78589a9e6faba27d2c596f2384de.tar.bz2 dokka-c37c9716857d78589a9e6faba27d2c596f2384de.zip |
Ignore compatibility metadata variant if HMPP is enabled (#2634)
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org')
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt index 1d0fa4a3..b934d206 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt @@ -6,12 +6,25 @@ import org.jetbrains.dokka.gradle.isAndroidTarget import org.jetbrains.dokka.utilities.cast import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCommonCompilation import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +val Project.isHMPPEnabled + // [KotlinCommonCompilation.isKlibCompilation] is internal, so we use this + get() = (this.findProperty("kotlin.mpp.enableGranularSourceSetsMetadata") as? String)?.toBoolean() ?: false + internal fun Project.classpathOf(sourceSet: KotlinSourceSet): FileCollection { val compilations = compilationsOf(sourceSet) return if (compilations.isNotEmpty()) { compilations + /** + * If the project has enabled Compatibility Metadata Variant (produces legacy variant), + * we don't touch it due to some dependant library + * might be published without Compatibility Metadata Variant. + * Dokka needs only HMPP variant + * Ignore [org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCommonCompilation] for `commonMain` sourceSet with name `main` + */ + .filterNot { compilation -> isHMPPEnabled && compilation is KotlinCommonCompilation && compilation.name == "main" } .map { compilation -> compileClasspathOf(compilation) } .reduce { acc, fileCollection -> acc + fileCollection } } else { |