From 37c87b0a8470f9b26a8bd4cf7cc3f77bdd48713c Mon Sep 17 00:00:00 2001 From: Pavel Kirpichenkov Date: Tue, 24 Jan 2023 15:12:02 +0200 Subject: [PATCH] [MPP] Don't report HMPP deprecation warnings on subprojects MPP plugin applied to a root project leads to false positive reports in its subprojects. Also, granular metadata flag is not supposed to be set in subprojects. Reporting only for the root project should cover most of the cases. KT-55891 --- .../mppDeprecatedProperties/settings.gradle.kts | 1 + .../mppDeprecatedProperties/subproject/build.gradle.kts | 7 +++++++ .../gradle/plugin/mpp/internal/deprecationDiagnostics.kt | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/settings.gradle.kts create mode 100644 libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/subproject/build.gradle.kts diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/settings.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/settings.gradle.kts new file mode 100644 index 00000000000..39022621b5c --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/settings.gradle.kts @@ -0,0 +1 @@ +include(":subproject") \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/subproject/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/subproject/build.gradle.kts new file mode 100644 index 00000000000..84ed38adf19 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mppDeprecatedProperties/subproject/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + kotlin("multiplatform") +} + +kotlin { + jvm() +} diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/internal/deprecationDiagnostics.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/internal/deprecationDiagnostics.kt index c4a91c8d147..39854704221 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/internal/deprecationDiagnostics.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/internal/deprecationDiagnostics.kt @@ -38,6 +38,8 @@ internal fun checkAndReportDeprecatedNativeTargets(project: Project) { * Warnings have to be reported only for successfully evaluated projects without errors. */ internal fun checkAndReportDeprecatedMppProperties(project: Project) { + if (project !== project.rootProject) return + val projectProperties = project.kotlinPropertiesProvider if (projectProperties.ignoreHmppDeprecationWarnings == true) return