[Platform API] Introduce fundamental abstraction of Platform
This is a large commit, which introduces general API for working with
abstraction of Platform.
- Add new abstraction to 'core' - SimplePlatform - which represents
exactly one platform
- Clients are strongly prohibited to create instances of SimplePlatform
by hand, instead, corresponding *Platforms abstraction should be used
(e.g. JvmPlatforms, JsPlatforms, KonanPlatforms)
- Move TargetPlatform to 'core', it represents now a collection of
SimplePlatforms
- Clients are strongly encouraged to use TargetPlatform
(not SimplePlatform) in API, to enforce checks for multiplatform
- Provide a helper-extensions to work with TargetPlatform
(in particular, for getting a specific component platform)
- Remove MultiTargetPlatform in favour of TargetPlatform
- Notably, this commit leaves another widely used duplicated abstraction,
namely, IdePlatform. For the sake sanity, removal of IdePlatform is
extracted in the separate commit.
This commit is contained in:
+2
-2
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.ide.konan.hasKotlinNativeRuntimeInScope
|
||||
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinStatus
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithGradleConfigurator
|
||||
import org.jetbrains.kotlin.idea.configuration.ModuleSourceRootGroup
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.KonanPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
|
||||
open class KotlinNativeGradleConfigurator : KotlinWithGradleConfigurator() {
|
||||
override fun getKotlinPluginExpression(forKotlinDsl: Boolean): String = ""
|
||||
@@ -28,7 +28,7 @@ open class KotlinNativeGradleConfigurator : KotlinWithGradleConfigurator() {
|
||||
|
||||
override val name: String get() = NAME
|
||||
|
||||
override val targetPlatform get() = KonanPlatform
|
||||
override val targetPlatform get() = KonanPlatforms.defaultKonanPlatform
|
||||
|
||||
override val presentableText get() = PRESENTABLE_TEXT
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.idea.project.platform
|
||||
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
|
||||
import org.jetbrains.kotlin.konan.library.konanCommonLibraryPath
|
||||
import org.jetbrains.kotlin.konan.library.konanPlatformLibraryPath
|
||||
import org.jetbrains.kotlin.platform.impl.isKotlinNative
|
||||
import org.jetbrains.kotlin.platform.konan.isNative
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
@@ -111,7 +111,7 @@ private fun assertValidModule(module: Module, projectRoot: String) {
|
||||
detectLibraryKind(library.getFiles(OrderRootType.CLASSES)) == NativeLibraryKind
|
||||
}
|
||||
|
||||
if (module.platform.isKotlinNative) {
|
||||
if (module.platform.isNative()) {
|
||||
assertFalse("No Kotlin/Native libraries in $module", nativeLibraries.isEmpty())
|
||||
nativeLibraries.forEach { assertValidNativeLibrary(it, projectRoot) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user