-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Kotlin Multiplatform Plugin
Refactored the Kotlin Multiplatform Plugin and added plugin parameters in a generated static class. Changes include modifications and relocations of several utilities methods related to KMP attributes and conditions. Environment variables have been introduced to control runtime behavior.
- Loading branch information
Showing
12 changed files
with
85 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
plugin/core/src/main/kotlin/com/jetbrains/packagesearch/plugin/core/utils/KMPAttributes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.jetbrains.packagesearch.plugin.core.utils | ||
|
||
import com.jetbrains.packagesearch.plugin.core.data.PackageSearchModuleVariant | ||
|
||
|
||
data class KmpAttributesGroups( | ||
val displayName: String, | ||
val aggregationKeyword: String = displayName, | ||
) | ||
|
||
val KMP_ATTRIBUTES_GROUPS = listOf( | ||
KmpAttributesGroups("iOS"), | ||
KmpAttributesGroups("macOS"), | ||
KmpAttributesGroups("tvOS"), | ||
KmpAttributesGroups("watchOS"), | ||
KmpAttributesGroups("JS"), | ||
KmpAttributesGroups("JVM"), | ||
KmpAttributesGroups("Linux"), | ||
KmpAttributesGroups("Android"), | ||
KmpAttributesGroups("WASM"), | ||
KmpAttributesGroups("Windows", "mingw"), | ||
) | ||
|
||
fun Set<String>.parseAttributesFromRawStrings() = buildList { | ||
var queue = this@parseAttributesFromRawStrings.toList() | ||
for (attributeTitle in KMP_ATTRIBUTES_GROUPS) { | ||
val (targets, rest) = queue | ||
.partition { it.contains(attributeTitle.aggregationKeyword, true) } | ||
|
||
if (targets.isEmpty()) continue | ||
this.add( | ||
PackageSearchModuleVariant.Attribute.NestedAttribute( | ||
attributeTitle.displayName, | ||
targets.map { PackageSearchModuleVariant.Attribute.StringAttribute(it) }) | ||
) | ||
queue = rest | ||
} | ||
addAll(queue.map { PackageSearchModuleVariant.Attribute.StringAttribute(it) }) | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
plugin/gradle/kmp/src/main/kotlin/com/jetbrains/packagesearch/plugin/gradle/KMPAttributes.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters