From ac6c42da7b3e435bdc766cd97fa996d932ed316f Mon Sep 17 00:00:00 2001 From: Sebastian Sellmair Date: Mon, 28 Aug 2023 17:55:15 +0200 Subject: [PATCH] [Gradle] KMP: Disable support of 'idea.gradle.download.sources' property ... as support within IntelliJ currently is poor for .knm files and IntelliJ instructs Gradle sync to not download sources by default for now. ^KT-61520 Verification Pending --- .../plugin/ide/IdeMultiplatformImportImpl.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/ide/IdeMultiplatformImportImpl.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/ide/IdeMultiplatformImportImpl.kt index 0d0b109717a..bff8cd7897b 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/ide/IdeMultiplatformImportImpl.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/ide/IdeMultiplatformImportImpl.kt @@ -65,7 +65,16 @@ internal class IdeMultiplatformImportImpl( * If 'true' the import is instructed to download all sources.jar eagerly. * If 'false' the import is instructed to not download any sources.jar */ - private val ideaGradleDownloadSourcesProperty = extension.project.providers.systemProperty("idea.gradle.download.sources") + private val ideaGradleDownloadSourcesProperty = + extension.project.providers.systemProperty("idea.gradle.download.sources") + + /** + * As of right now (08.2023), IntelliJ does not fully support lazy downloading of sources of knm files. + * To prevent user confusion, we do not support the 'idea.gradle.download.sources' by default. + * This property is internal and for testing of this component only. + */ + private val ideaGradleDownloadSourcesEnabledProperty = + extension.project.providers.gradleProperty("kotlin.mpp.idea.gradle.download.sources.enabled") @OptIn(Idea222Api::class) override fun registerDependencyResolver( @@ -153,7 +162,10 @@ internal class IdeMultiplatformImportImpl( /* Skip resolving sources if IDE instructs us to (ideaGradleDownloadSourcesProperty is passed by the IDE, reflecting user settings) */ - if (phase == SourcesAndDocumentationResolution && ideaGradleDownloadSourcesProperty.orNull?.toBoolean() == false) { + if (phase == SourcesAndDocumentationResolution && + ideaGradleDownloadSourcesEnabledProperty.orNull?.toBoolean() == true && + ideaGradleDownloadSourcesProperty.orNull?.toBoolean() == false + ) { return IdeAdditionalArtifactResolver.empty }