[mpp] Minor: diagnostic messages clean-up

- Mention link to docs about templates in warning messages
^KT-60491 Fixed

- Make sure that each warning mentions some way to solve the problem
  aside from disabling default template

- Fix small syntactical bug in code sample

- fix incorrect indentation in trimMargin after joinToString

- Use kotl.in in Kotlin12XMppDeprecation
This commit is contained in:
Dmitry Savvinov
2023-08-03 13:09:10 +02:00
committed by Space Team
parent edbaed0da9
commit e8289181e6
9 changed files with 62 additions and 40 deletions
@@ -9,13 +9,15 @@ Read the details here: https://kotlinlang.org/docs/multiplatform-compatibility-g
e: [CommonMainOrTestWithDependsOnDiagnostic | ERROR] commonMain can't declare dependsOn on other source sets
#diagnostic-end
w: [KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy was not applied to 'project ':subprojectA'':
Manual .dependsOn() edges were configured for the following source sets:
w: [KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy Template was not applied to 'project ':subprojectA'':
Explicit .dependsOn() edges were configured for the following source sets:
[commonMain]
To suppress the 'Default Hierarchy Template' add
Consider removing dependsOn-calls or disabling the default template by adding
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
#diagnostic-end
@@ -23,13 +25,15 @@ to your gradle.properties
e: [CommonMainOrTestWithDependsOnDiagnostic | ERROR] commonMain can't declare dependsOn on other source sets
#diagnostic-end
w: [KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy was not applied to 'project ':subprojectB'':
Manual .dependsOn() edges were configured for the following source sets:
w: [KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy Template was not applied to 'project ':subprojectB'':
Explicit .dependsOn() edges were configured for the following source sets:
[commonMain]
To suppress the 'Default Hierarchy Template' add
Consider removing dependsOn-calls or disabling the default template by adding
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
#diagnostic-end
w: [UnusedSourceSetsWarning | WARNING] The Kotlin source set unusedCreatedInAfterEvaluate was configured but not added to any Kotlin compilation.
@@ -215,7 +215,7 @@ object KotlinToolingDiagnostics {
"""
The 'org.jetbrains.kotlin.platform.*' plugins are no longer available.
Please migrate the project to the 'org.jetbrains.kotlin.multiplatform' plugin.
See: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html
See: https://kotl.in/legacy-multiplatform-plugins
""".trimIndent()
)
}
@@ -327,7 +327,7 @@ object KotlinToolingDiagnostics {
|kotlin {
| js {
| // To build distributions for and run tests on browser or Node.js use one or both of:
| ${availableEnvironments.joinToString(separator = "\n")}
| ${availableEnvironments.joinToString(separator = "\n ")}
| }
|}
""".trimMargin()
@@ -455,10 +455,10 @@ object KotlinToolingDiagnostics {
| iosX64()
| iosArm64()
| iosSimulatorArm64()
|
| /* Use convention
|
| /* Use convention */
| sourceSets.${sourceSet.name}.dependencies {
|
|
| }
| }
""".trimMargin(),
@@ -469,13 +469,15 @@ object KotlinToolingDiagnostics {
object KotlinDefaultHierarchyFallbackDependsOnUsageDetected : ToolingDiagnosticFactory(WARNING) {
operator fun invoke(project: Project, sourceSetsWithDependsOnEdges: Iterable<KotlinSourceSet>) = build(
"""
The Default Kotlin Hierarchy was not applied to '${project.displayName}':
Manual .dependsOn() edges were configured for the following source sets:
The Default Kotlin Hierarchy Template was not applied to '${project.displayName}':
Explicit .dependsOn() edges were configured for the following source sets:
${sourceSetsWithDependsOnEdges.toSet().map { it.name }}
To suppress the 'Default Hierarchy Template' add
Consider removing dependsOn-calls or disabling the default template by adding
'$KOTLIN_MPP_APPLY_DEFAULT_HIERARCHY_TEMPLATE=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
""".trimIndent()
)
}
@@ -483,14 +485,14 @@ object KotlinToolingDiagnostics {
object KotlinDefaultHierarchyFallbackNativeTargetShortcutUsageDetected : ToolingDiagnosticFactory(WARNING) {
internal operator fun invoke(project: Project, trace: NativeTargetShortcutTrace) = build(
"""
The Default Kotlin Hierarchy was not applied to '${project.displayName}':
The Default Kotlin Hierarchy Template was not applied to '${project.displayName}':
Deprecated '${trace.shortcut}()' shortcut was used:
kotlin {
${trace.shortcut}()
}
Could be replaced by declaring the supported ${trace.shortcut} targets directly:
Please declare the required targets explicitly:
kotlin {
${trace.shortcut}X64()
@@ -502,6 +504,8 @@ object KotlinToolingDiagnostics {
To suppress the 'Default Hierarchy Template' add
'$KOTLIN_MPP_APPLY_DEFAULT_HIERARCHY_TEMPLATE=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
""".trimIndent(),
throwable = trace
)
@@ -510,13 +514,15 @@ object KotlinToolingDiagnostics {
object KotlinDefaultHierarchyFallbackIllegalTargetNames : ToolingDiagnosticFactory(WARNING) {
operator fun invoke(project: Project, illegalTargetNamesUsed: Iterable<String>) = build(
"""
The Default Kotlin Hierarchy was not applied to '${project.displayName}':
Illegal target names were found:
The Default Kotlin Hierarchy Template was not applied to '${project.displayName}':
Source sets created by the following targets will clash with source sets created by the template:
${illegalTargetNamesUsed.toSet()}
To suppress the 'Default Hierarchy Template' add
Consider renaming the targets or disabling the default template by adding
'$KOTLIN_MPP_APPLY_DEFAULT_HIERARCHY_TEMPLATE=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
""".trimIndent()
)
}
@@ -2,13 +2,15 @@
Learn how to migrate to the version 2 source set layout at: https://kotl.in/android-source-set-layout-v2
----
[KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
Manual .dependsOn() edges were configured for the following source sets:
[KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy Template was not applied to 'root project 'test'':
Explicit .dependsOn() edges were configured for the following source sets:
[androidAndroidTest, androidMain, androidTest]
To suppress the 'Default Hierarchy Template' add
Consider removing dependsOn-calls or disabling the default template by adding
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
----
[KotlinSourceSetTreeDependsOnMismatch | WARNING] Kotlin Source Set 'androidAndroidTest' can't depend on 'commonTest' as they are from different Source Set Trees.
Please remove this dependency edge.
Please remove this dependency edge.
@@ -5,7 +5,7 @@
iosArm64()
iosSimulatorArm64()
/* Use convention
/* Use convention */
sourceSets.iosMain.dependencies {
}
@@ -18,7 +18,7 @@
iosArm64()
iosSimulatorArm64()
/* Use convention
/* Use convention */
sourceSets.iosTest.dependencies {
}
@@ -1,7 +1,9 @@
[KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
Manual .dependsOn() edges were configured for the following source sets:
[KotlinDefaultHierarchyFallbackDependsOnUsageDetected | WARNING] The Default Kotlin Hierarchy Template was not applied to 'root project 'test'':
Explicit .dependsOn() edges were configured for the following source sets:
[intermediateMain, jvmMain]
To suppress the 'Default Hierarchy Template' add
Consider removing dependsOn-calls or disabling the default template by adding
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
@@ -1,7 +1,9 @@
[KotlinDefaultHierarchyFallbackIllegalTargetNames | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
Illegal target names were found:
[KotlinDefaultHierarchyFallbackIllegalTargetNames | WARNING] The Default Kotlin Hierarchy Template was not applied to 'root project 'test'':
Source sets created by the following targets will clash with source sets created by the template:
[Native, linux]
To suppress the 'Default Hierarchy Template' add
Consider renaming the targets or disabling the default template by adding
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
@@ -1,11 +1,11 @@
[KotlinDefaultHierarchyFallbackNativeTargetShortcutUsageDetected | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
[KotlinDefaultHierarchyFallbackNativeTargetShortcutUsageDetected | WARNING] The Default Kotlin Hierarchy Template was not applied to 'root project 'test'':
Deprecated 'ios()' shortcut was used:
kotlin {
ios()
}
Could be replaced by declaring the supported ios targets directly:
Please declare the required targets explicitly:
kotlin {
iosX64()
@@ -17,3 +17,5 @@ Could be replaced by declaring the supported ios targets directly:
To suppress the 'Default Hierarchy Template' add
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
@@ -1,11 +1,11 @@
[KotlinDefaultHierarchyFallbackNativeTargetShortcutUsageDetected | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
[KotlinDefaultHierarchyFallbackNativeTargetShortcutUsageDetected | WARNING] The Default Kotlin Hierarchy Template was not applied to 'root project 'test'':
Deprecated 'tvos()' shortcut was used:
kotlin {
tvos()
}
Could be replaced by declaring the supported tvos targets directly:
Please declare the required targets explicitly:
kotlin {
tvosX64()
@@ -17,3 +17,5 @@ Could be replaced by declaring the supported tvos targets directly:
To suppress the 'Default Hierarchy Template' add
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template
@@ -1,11 +1,11 @@
[KotlinDefaultHierarchyFallbackNativeTargetShortcutUsageDetected | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
[KotlinDefaultHierarchyFallbackNativeTargetShortcutUsageDetected | WARNING] The Default Kotlin Hierarchy Template was not applied to 'root project 'test'':
Deprecated 'watchos()' shortcut was used:
kotlin {
watchos()
}
Could be replaced by declaring the supported watchos targets directly:
Please declare the required targets explicitly:
kotlin {
watchosX64()
@@ -17,3 +17,5 @@ Could be replaced by declaring the supported watchos targets directly:
To suppress the 'Default Hierarchy Template' add
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
to your gradle.properties
Learn more about hierarchy templates: https://kotl.in/hierarchy-template