diff --git a/libraries/stdlib/gradle.properties b/libraries/stdlib/gradle.properties index 49005b4378647..7ac86c2a54662 100644 --- a/libraries/stdlib/gradle.properties +++ b/libraries/stdlib/gradle.properties @@ -1,3 +1,4 @@ kotlin.internal.suppressGradlePluginErrors=PreHMPPFlagsError kotlin.mpp.enableCompatibilityMetadataVariant=true -kotlin.internal.mpp.createDefaultMultiplatformPublications=false \ No newline at end of file +kotlin.internal.mpp.createDefaultMultiplatformPublications=false +kotlin.internal.archivesTaskOutputAsFriendModule=false \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/PropertiesProvider.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/PropertiesProvider.kt index e69ba0b56b5ad..05974d1be63d2 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/PropertiesProvider.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/PropertiesProvider.kt @@ -601,6 +601,9 @@ internal class PropertiesProvider private constructor(private val project: Proje val enableFusMetricsCollection: Boolean get() = booleanProperty(PropertyNames.KOTLIN_COLLECT_FUS_METRICS_ENABLED) ?: true + val archivesTaskOutputAsFriendModule: Boolean + get() = booleanProperty(PropertyNames.KOTLIN_ARCHIVES_TASK_OUTPUT_AS_FRIEND_ENABLED) ?: true + /** * Retrieves a comma-separated list of browsers to use when running karma tests for [target] * @see KOTLIN_JS_KARMA_BROWSERS @@ -725,6 +728,7 @@ internal class PropertiesProvider private constructor(private val project: Proje property("$KOTLIN_INTERNAL_NAMESPACE.incremental.enableUnsafeOptimizationsForMultiplatform") val KOTLIN_KLIBS_KT64115_WORKAROUND_ENABLED = property("$KOTLIN_INTERNAL_NAMESPACE.klibs.enableWorkaroundForKT64115") val KOTLIN_COLLECT_FUS_METRICS_ENABLED = property("$KOTLIN_INTERNAL_NAMESPACE.collectFUSMetrics") + val KOTLIN_ARCHIVES_TASK_OUTPUT_AS_FRIEND_ENABLED = property("$KOTLIN_INTERNAL_NAMESPACE.archivesTaskOutputAsFriendModule") } companion object { diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/compilationImpl/KotlinCompilationFriendPathsResolver.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/compilationImpl/KotlinCompilationFriendPathsResolver.kt index ffc76b20697ca..ba2892bc8b31d 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/compilationImpl/KotlinCompilationFriendPathsResolver.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/compilationImpl/KotlinCompilationFriendPathsResolver.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl import org.gradle.api.file.FileCollection import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.bundling.AbstractArchiveTask +import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.Companion.kotlinPropertiesProvider import org.jetbrains.kotlin.gradle.plugin.mpp.* import org.jetbrains.kotlin.gradle.plugin.sources.getVisibleSourceSetsFromAssociateCompilations import org.jetbrains.kotlin.gradle.tasks.KotlinCompileTool @@ -61,6 +62,8 @@ internal class DefaultKotlinCompilationFriendPathsResolver( object DefaultFriendArtifactResolver : FriendArtifactResolver { override fun resolveFriendArtifacts(compilation: InternalKotlinCompilation<*>): FileCollection { + if (!compilation.project.kotlinPropertiesProvider.archivesTaskOutputAsFriendModule) return compilation.project.files() + return with(compilation.project) { val friendArtifactsTaskProvider = resolveFriendArtifactsTask(compilation) ?: return files() filesProvider { friendArtifactsTaskProvider.flatMap { it.archiveFile } }