[Gradle] Make check for illegal target names case-insensitive
^KT-59733 Verification Pending
This commit is contained in:
committed by
Space Team
parent
0b912b0200
commit
27600eecb3
+5
-2
@@ -85,8 +85,11 @@ private suspend fun Project.illegalTargetNamesUsed(): Set<String> {
|
|||||||
val targetNames = targets.map { it.name }.toSet()
|
val targetNames = targets.map { it.name }.toSet()
|
||||||
return targets.flatMap { it.compilations }.mapNotNull { compilation ->
|
return targets.flatMap { it.compilations }.mapNotNull { compilation ->
|
||||||
val hierarchy = KotlinHierarchyTemplate.default.buildHierarchy(compilation) ?: return@mapNotNull null
|
val hierarchy = KotlinHierarchyTemplate.default.buildHierarchy(compilation) ?: return@mapNotNull null
|
||||||
val nodeNames = hierarchy.childrenClosure.mapNotNull { it.node as? KotlinHierarchy.Node.Group }.map { it.name }.toSet()
|
val nodeNames = hierarchy.childrenClosure
|
||||||
nodeNames.intersect(targetNames)
|
.mapNotNull { it.node as? KotlinHierarchy.Node.Group }
|
||||||
|
.map { it.name }
|
||||||
|
.toSortedSet(String.CASE_INSENSITIVE_ORDER)
|
||||||
|
targetNames.intersect(nodeNames)
|
||||||
}.flatten().toSet()
|
}.flatten().toSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ class DefaultHierarchySetupDiagnosticTest {
|
|||||||
fun `test - warning KotlinTargetHierarchyFallbackIllegalTargetNames`() = buildProjectWithMPP().runLifecycleAwareTest {
|
fun `test - warning KotlinTargetHierarchyFallbackIllegalTargetNames`() = buildProjectWithMPP().runLifecycleAwareTest {
|
||||||
val kotlin = multiplatformExtension
|
val kotlin = multiplatformExtension
|
||||||
kotlin.linuxX64("linux") // <- illegal: Will clash with 'linux' group
|
kotlin.linuxX64("linux") // <- illegal: Will clash with 'linux' group
|
||||||
kotlin.linuxArm64("native") // <-- illegal: Will clash with 'native' group
|
kotlin.linuxArm64("Native") // <-- illegal: Will clash with 'native' group
|
||||||
kotlin.jvm()
|
kotlin.jvm()
|
||||||
|
|
||||||
project.launchInStage(KotlinPluginLifecycle.Stage.ReadyForExecution) {
|
project.launchInStage(KotlinPluginLifecycle.Stage.ReadyForExecution) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[KotlinDefaultHierarchyFallbackIllegalTargetNames | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
|
[KotlinDefaultHierarchyFallbackIllegalTargetNames | WARNING] The Default Kotlin Hierarchy was not applied to 'root project 'test'':
|
||||||
Illegal target names were found:
|
Illegal target names were found:
|
||||||
[native, linux]
|
[Native, linux]
|
||||||
|
|
||||||
To suppress the 'Default Hierarchy Template' add
|
To suppress the 'Default Hierarchy Template' add
|
||||||
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
|
'kotlin.mpp.applyDefaultHierarchyTemplate=false'
|
||||||
|
|||||||
Reference in New Issue
Block a user