[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
This commit is contained in:
Sebastian Sellmair
2023-08-28 17:55:15 +02:00
parent c8ae22eb66
commit ac6c42da7b
@@ -65,7 +65,16 @@ internal class IdeMultiplatformImportImpl(
* If 'true' the import is instructed to download all sources.jar eagerly. * If 'true' the import is instructed to download all sources.jar eagerly.
* If 'false' the import is instructed to not download any sources.jar * 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) @OptIn(Idea222Api::class)
override fun registerDependencyResolver( 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) 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 return IdeAdditionalArtifactResolver.empty
} }