Minor: Rename "Default" platform to "Common"

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