Drop unused DefaultIdeTargetPlatformKindProvider class
KMA-455 This class was used in intellij but usages was dropped in a55a62106e40f8545d654d5519576fa4e732d0fd (intellij repo). DefaultIdeTargetPlatformKindProvider is useless because `DefaultIdeTargetPlatformKindProvider.defaultPlatform` implementation always returns `JvmPlatforms.defaultJvmPlatform`
This commit is contained in:
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.platform.impl.FakeK2NativeCompilerArguments
|
||||
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.jvm.JdkPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import org.jetbrains.kotlin.platform.konan.*
|
||||
import java.lang.reflect.Modifier
|
||||
@@ -113,7 +114,7 @@ fun Element.getFacetPlatformByConfigurationElement(): TargetPlatform {
|
||||
getAttributeValue("allPlatforms").deserializeTargetPlatformByComponentPlatforms()?.let { return it }
|
||||
|
||||
// failed to read list of all platforms. Fallback to legacy algorithm
|
||||
val platformName = getAttributeValue("platform") ?: return DefaultIdeTargetPlatformKindProvider.defaultPlatform
|
||||
val platformName = getAttributeValue("platform") ?: return JvmPlatforms.defaultJvmPlatform
|
||||
|
||||
return CommonPlatforms.allSimplePlatforms.firstOrNull {
|
||||
// first, look for exact match through all simple platforms
|
||||
@@ -124,7 +125,7 @@ fun Element.getFacetPlatformByConfigurationElement(): TargetPlatform {
|
||||
} ?: NativePlatforms.unspecifiedNativePlatform.takeIf {
|
||||
// if none of the above succeeded, check if it's an old-style record about native platform (without suffix with target name)
|
||||
it.oldFashionedDescription.startsWith(platformName)
|
||||
}.orDefault() // finally, fallback to the default platform
|
||||
} ?: JvmPlatforms.defaultJvmPlatform // finally, fallback to the default platform
|
||||
}
|
||||
|
||||
private fun readV2AndLaterConfig(
|
||||
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.platform
|
||||
|
||||
import org.jetbrains.kotlin.config.APPLICATION_MANAGER_CLASS_NAME
|
||||
import org.jetbrains.kotlin.config.isJps
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
|
||||
interface DefaultIdeTargetPlatformKindProvider {
|
||||
val defaultPlatform: TargetPlatform
|
||||
|
||||
companion object {
|
||||
val defaultPlatform: TargetPlatform
|
||||
get() {
|
||||
if (isJps) {
|
||||
// TODO support passing custom platforms in JPS
|
||||
return JvmPlatforms.defaultJvmPlatform
|
||||
}
|
||||
|
||||
val application = Class.forName(APPLICATION_MANAGER_CLASS_NAME).getMethod("getApplication").invoke(null)
|
||||
val service = application::class.java.getMethod("getService", Class::class.java)
|
||||
.invoke(application, DefaultIdeTargetPlatformKindProvider::class.java) as DefaultIdeTargetPlatformKindProvider
|
||||
return service.defaultPlatform
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun TargetPlatform?.orDefault(): TargetPlatform {
|
||||
return this ?: DefaultIdeTargetPlatformKindProvider.defaultPlatform
|
||||
}
|
||||
|
||||
fun IdePlatformKind?.orDefault(): IdePlatformKind {
|
||||
return this ?: DefaultIdeTargetPlatformKindProvider.defaultPlatform.idePlatformKind
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.platform.impl
|
||||
|
||||
import org.jetbrains.kotlin.platform.DefaultIdeTargetPlatformKindProvider
|
||||
|
||||
class IdeaDefaultIdeTargetPlatformKindProvider private constructor() : DefaultIdeTargetPlatformKindProvider {
|
||||
override val defaultPlatform = JvmIdePlatformKind.defaultPlatform
|
||||
}
|
||||
Reference in New Issue
Block a user