Minor: Rename "Default" platform to "Common"
This commit is contained in:
@@ -49,7 +49,7 @@ val Project.languageVersionSettings: LanguageVersionSettings
|
||||
val apiVersion = ApiVersion.createByLanguageVersion(LanguageVersion.fromVersionString(arguments.apiVersion) ?: languageVersion)
|
||||
val compilerSettings = KotlinCompilerSettings.getInstance(this).settings
|
||||
val extraLanguageFeatures = getExtraLanguageFeatures(
|
||||
TargetPlatformKind.Default,
|
||||
TargetPlatformKind.Common,
|
||||
CoroutineSupport.byCompilerArguments(KotlinCommonCompilerArgumentsHolder.getInstance(this).settings),
|
||||
compilerSettings,
|
||||
null
|
||||
@@ -70,7 +70,7 @@ val Module.languageVersionSettings: LanguageVersionSettings
|
||||
val apiVersion = versionInfo.apiLevel ?: languageVersion
|
||||
|
||||
val extraLanguageFeatures = getExtraLanguageFeatures(
|
||||
versionInfo.targetPlatformKind ?: TargetPlatformKind.Default,
|
||||
versionInfo.targetPlatformKind ?: TargetPlatformKind.Common,
|
||||
facetSettings.compilerInfo.coroutineSupport,
|
||||
facetSettings.compilerInfo.compilerSettings,
|
||||
this
|
||||
@@ -83,8 +83,8 @@ private val Module.targetPlatform: TargetPlatformKind<*>?
|
||||
get() = KotlinFacetSettingsProvider.getInstance(project).getSettings(this).versionInfo.targetPlatformKind
|
||||
|
||||
private val Module.implementsCommonModule: Boolean
|
||||
get() = targetPlatform != TargetPlatformKind.Default
|
||||
&& ModuleRootManager.getInstance(this).dependencies.any { it.targetPlatform == TargetPlatformKind.Default}
|
||||
get() = targetPlatform != TargetPlatformKind.Common
|
||||
&& ModuleRootManager.getInstance(this).dependencies.any { it.targetPlatform == TargetPlatformKind.Common }
|
||||
|
||||
private fun getExtraLanguageFeatures(
|
||||
targetPlatformKind: TargetPlatformKind<*>,
|
||||
@@ -98,7 +98,7 @@ private fun getExtraLanguageFeatures(
|
||||
CoroutineSupport.ENABLED_WITH_WARNING -> add(LanguageFeature.WarnOnCoroutines)
|
||||
CoroutineSupport.DISABLED -> add(LanguageFeature.ErrorOnCoroutines)
|
||||
}
|
||||
if (targetPlatformKind == TargetPlatformKind.Default ||
|
||||
if (targetPlatformKind == TargetPlatformKind.Common ||
|
||||
// TODO: this is a dirty hack, parse arguments correctly here
|
||||
compilerSettings?.additionalArguments?.contains(multiPlatformProjectsArg) == true ||
|
||||
(module != null && module.implementsCommonModule)) {
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ProjectStructureUtil {
|
||||
if (kind instanceof TargetPlatformKind.JavaScript) {
|
||||
return JsPlatform.INSTANCE;
|
||||
}
|
||||
if (kind instanceof TargetPlatformKind.Default) {
|
||||
if (kind instanceof TargetPlatformKind.Common) {
|
||||
return TargetPlatform.Default.INSTANCE;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -37,10 +37,10 @@ sealed class TargetPlatformKind<out Version : DescriptionAware>(
|
||||
|
||||
object JavaScript : TargetPlatformKind<NoVersion>(NoVersion, "JavaScript")
|
||||
|
||||
object Default : TargetPlatformKind<NoVersion>(NoVersion, "Default (experimental)")
|
||||
object Common : TargetPlatformKind<NoVersion>(NoVersion, "Common (experimental)")
|
||||
|
||||
companion object {
|
||||
val ALL_PLATFORMS: List<TargetPlatformKind<*>> by lazy { listOf(Jvm.JVM_1_6, JavaScript, Default) }
|
||||
val ALL_PLATFORMS: List<TargetPlatformKind<*>> by lazy { listOf(Jvm.JVM_1_6, JavaScript, Common) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class KotlinGradleProjectDataService : AbstractProjectDataService<GradleSourceSe
|
||||
when (it.data.plugins.values.map { it.id }.firstOrNull { it.startsWith("kotlin-platform-") }) {
|
||||
"kotlin-platform-jvm" -> TargetPlatformKind.Jvm.JVM_1_6
|
||||
"kotlin-platform-js" -> TargetPlatformKind.JavaScript
|
||||
"kotlin-platform-common" -> TargetPlatformKind.Default
|
||||
"kotlin-platform-common" -> TargetPlatformKind.Common
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
return when (this) {
|
||||
is TargetPlatformKind.Jvm -> JavaRuntimeLibraryDescription(project)
|
||||
is TargetPlatformKind.JavaScript -> JSLibraryStdDescription(project)
|
||||
is TargetPlatformKind.Default -> CommonStandardLibraryDescription(project)
|
||||
is TargetPlatformKind.Common -> CommonStandardLibraryDescription(project)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
if (found) return ValidationResult.OK
|
||||
|
||||
// TODO: propose to configure kotlin-stdlib-common once it's available
|
||||
if (targetPlatform == TargetPlatformKind.Default) return ValidationResult.OK
|
||||
if (targetPlatform == TargetPlatformKind.Common) return ValidationResult.OK
|
||||
|
||||
return ValidationResult(
|
||||
IdeBundle.message("label.missed.libraries.text", libraryCategoryName),
|
||||
|
||||
@@ -46,7 +46,7 @@ private fun getRuntimeLibraryVersions(
|
||||
val presentationProvider = when (targetPlatform) {
|
||||
is TargetPlatformKind.JavaScript -> JSLibraryStdPresentationProvider.getInstance()
|
||||
is TargetPlatformKind.Jvm -> JavaRuntimePresentationProvider.getInstance()
|
||||
is TargetPlatformKind.Default -> return emptyList()
|
||||
is TargetPlatformKind.Common -> return emptyList()
|
||||
}
|
||||
|
||||
KotlinVersionInfoProvider.EP_NAME
|
||||
@@ -67,8 +67,8 @@ private fun getDefaultTargetPlatform(module: Module, rootModel: ModuleRootModel?
|
||||
if (getRuntimeLibraryVersions(module, rootModel, TargetPlatformKind.JavaScript).isNotEmpty()) {
|
||||
return TargetPlatformKind.JavaScript
|
||||
}
|
||||
if (getRuntimeLibraryVersions(module, rootModel, TargetPlatformKind.Default).isNotEmpty()) {
|
||||
return TargetPlatformKind.Default
|
||||
if (getRuntimeLibraryVersions(module, rootModel, TargetPlatformKind.Common).isNotEmpty()) {
|
||||
return TargetPlatformKind.Common
|
||||
}
|
||||
return TargetPlatformKind.Jvm.JVM_1_6
|
||||
}
|
||||
@@ -142,7 +142,7 @@ val TargetPlatformKind<*>.mavenLibraryId: String
|
||||
get() = when (this) {
|
||||
is TargetPlatformKind.Jvm -> MAVEN_STDLIB_ID
|
||||
is TargetPlatformKind.JavaScript -> MAVEN_JS_STDLIB_ID
|
||||
is TargetPlatformKind.Default -> MAVEN_COMMON_STDLIB_ID
|
||||
is TargetPlatformKind.Common -> MAVEN_COMMON_STDLIB_ID
|
||||
}
|
||||
|
||||
fun Module.getOrCreateFacet(modelsProvider: IdeModifiableModelsProvider): KotlinFacet {
|
||||
|
||||
@@ -62,7 +62,7 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
|
||||
fun testPlatform1() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
@@ -74,7 +74,7 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
|
||||
fun testPlatform2() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
@@ -86,7 +86,7 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
|
||||
fun testPlatform3() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
@@ -103,7 +103,7 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
|
||||
fun testPlatform4() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
@@ -115,7 +115,7 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
|
||||
fun testPlatform5() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.config.TargetPlatformKind
|
||||
class MultiModuleLineMarkerTest : AbstractMultiModuleLineMarkerTest() {
|
||||
fun testFromCommonToJvmHeader() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
@@ -33,7 +33,7 @@ class MultiModuleLineMarkerTest : AbstractMultiModuleLineMarkerTest() {
|
||||
|
||||
fun testFromCommonToJvmImpl() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
@@ -45,7 +45,7 @@ class MultiModuleLineMarkerTest : AbstractMultiModuleLineMarkerTest() {
|
||||
|
||||
fun testFromClassToAlias() {
|
||||
val header = module("header")
|
||||
header.setPlatformKind(TargetPlatformKind.Default)
|
||||
header.setPlatformKind(TargetPlatformKind.Common)
|
||||
|
||||
val jvm = module("jvm")
|
||||
jvm.setPlatformKind(TargetPlatformKind.Jvm.JVM_1_6)
|
||||
|
||||
@@ -64,8 +64,8 @@ class JpsKotlinCompilerSettings : JpsElementBase<JpsKotlinCompilerSettings>() {
|
||||
|
||||
private val JpsModule.targetPlatform: TargetPlatformKind<*>?
|
||||
get() {
|
||||
val facetSettings = kotlinFacetExtension?.settings ?: return TargetPlatformKind.Default
|
||||
if (facetSettings.useProjectSettings) return TargetPlatformKind.Default
|
||||
val facetSettings = kotlinFacetExtension?.settings ?: return TargetPlatformKind.Common
|
||||
if (facetSettings.useProjectSettings) return TargetPlatformKind.Common
|
||||
return facetSettings.versionInfo.targetPlatformKind
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class JpsKotlinCompilerSettings : JpsElementBase<JpsKotlinCompilerSettings>() {
|
||||
multiPlatform = module
|
||||
.dependenciesList
|
||||
.dependencies
|
||||
.any { (it as? JpsModuleDependency)?.module?.targetPlatform == TargetPlatformKind.Default }
|
||||
.any { (it as? JpsModuleDependency)?.module?.targetPlatform == TargetPlatformKind.Common }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user