[CLI] Drop CommonCompilerArguments.coroutinesState
This commit is contained in:
committed by
TeamCityServer
parent
df3b12e13b
commit
e991c9d476
@@ -17,9 +17,6 @@ interface BuildMetaInfo {
|
|||||||
val compilerBuildVersion: String
|
val compilerBuildVersion: String
|
||||||
val languageVersionString: String
|
val languageVersionString: String
|
||||||
val apiVersionString: String
|
val apiVersionString: String
|
||||||
val coroutinesEnable: Boolean
|
|
||||||
val coroutinesWarn: Boolean
|
|
||||||
val coroutinesError: Boolean
|
|
||||||
val multiplatformEnable: Boolean
|
val multiplatformEnable: Boolean
|
||||||
val metadataVersionMajor: Int
|
val metadataVersionMajor: Int
|
||||||
val metadataVersionMinor: Int
|
val metadataVersionMinor: Int
|
||||||
@@ -35,9 +32,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
|
|||||||
compilerBuildVersion: String,
|
compilerBuildVersion: String,
|
||||||
languageVersionString: String,
|
languageVersionString: String,
|
||||||
apiVersionString: String,
|
apiVersionString: String,
|
||||||
coroutinesEnable: Boolean,
|
|
||||||
coroutinesWarn: Boolean,
|
|
||||||
coroutinesError: Boolean,
|
|
||||||
multiplatformEnable: Boolean,
|
multiplatformEnable: Boolean,
|
||||||
ownVersion: Int,
|
ownVersion: Int,
|
||||||
coroutinesVersion: Int,
|
coroutinesVersion: Int,
|
||||||
@@ -53,9 +47,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
|
|||||||
compilerBuildVersion = KotlinCompilerVersion.VERSION,
|
compilerBuildVersion = KotlinCompilerVersion.VERSION,
|
||||||
languageVersionString = languageVersion.versionString,
|
languageVersionString = languageVersion.versionString,
|
||||||
apiVersionString = args.apiVersion ?: languageVersion.versionString,
|
apiVersionString = args.apiVersion ?: languageVersion.versionString,
|
||||||
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
|
|
||||||
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
|
|
||||||
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
|
|
||||||
multiplatformEnable = args.multiPlatform,
|
multiplatformEnable = args.multiPlatform,
|
||||||
ownVersion = OWN_VERSION,
|
ownVersion = OWN_VERSION,
|
||||||
coroutinesVersion = COROUTINES_VERSION,
|
coroutinesVersion = COROUTINES_VERSION,
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ data class CommonBuildMetaInfo(
|
|||||||
override val compilerBuildVersion: String,
|
override val compilerBuildVersion: String,
|
||||||
override val languageVersionString: String,
|
override val languageVersionString: String,
|
||||||
override val apiVersionString: String,
|
override val apiVersionString: String,
|
||||||
override val coroutinesEnable: Boolean,
|
|
||||||
override val coroutinesWarn: Boolean,
|
|
||||||
override val coroutinesError: Boolean,
|
|
||||||
override val multiplatformEnable: Boolean,
|
override val multiplatformEnable: Boolean,
|
||||||
override val metadataVersionMajor: Int,
|
override val metadataVersionMajor: Int,
|
||||||
override val metadataVersionMinor: Int,
|
override val metadataVersionMinor: Int,
|
||||||
@@ -32,9 +29,6 @@ data class CommonBuildMetaInfo(
|
|||||||
compilerBuildVersion: String,
|
compilerBuildVersion: String,
|
||||||
languageVersionString: String,
|
languageVersionString: String,
|
||||||
apiVersionString: String,
|
apiVersionString: String,
|
||||||
coroutinesEnable: Boolean,
|
|
||||||
coroutinesWarn: Boolean,
|
|
||||||
coroutinesError: Boolean,
|
|
||||||
multiplatformEnable: Boolean,
|
multiplatformEnable: Boolean,
|
||||||
ownVersion: Int,
|
ownVersion: Int,
|
||||||
coroutinesVersion: Int,
|
coroutinesVersion: Int,
|
||||||
@@ -47,9 +41,6 @@ data class CommonBuildMetaInfo(
|
|||||||
compilerBuildVersion = compilerBuildVersion,
|
compilerBuildVersion = compilerBuildVersion,
|
||||||
languageVersionString = languageVersionString,
|
languageVersionString = languageVersionString,
|
||||||
apiVersionString = apiVersionString,
|
apiVersionString = apiVersionString,
|
||||||
coroutinesEnable = coroutinesEnable,
|
|
||||||
coroutinesWarn = coroutinesWarn,
|
|
||||||
coroutinesError = coroutinesError,
|
|
||||||
multiplatformEnable = multiplatformEnable,
|
multiplatformEnable = multiplatformEnable,
|
||||||
metadataVersionMajor = metadataVersion.major,
|
metadataVersionMajor = metadataVersion.major,
|
||||||
metadataVersionMinor = metadataVersion.minor,
|
metadataVersionMinor = metadataVersion.minor,
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ data class JsBuildMetaInfo(
|
|||||||
override val compilerBuildVersion: String,
|
override val compilerBuildVersion: String,
|
||||||
override val languageVersionString: String,
|
override val languageVersionString: String,
|
||||||
override val apiVersionString: String,
|
override val apiVersionString: String,
|
||||||
override val coroutinesEnable: Boolean,
|
|
||||||
override val coroutinesWarn: Boolean,
|
|
||||||
override val coroutinesError: Boolean,
|
|
||||||
override val multiplatformEnable: Boolean,
|
override val multiplatformEnable: Boolean,
|
||||||
override val metadataVersionMajor: Int,
|
override val metadataVersionMajor: Int,
|
||||||
override val metadataVersionMinor: Int,
|
override val metadataVersionMinor: Int,
|
||||||
@@ -32,9 +29,6 @@ data class JsBuildMetaInfo(
|
|||||||
compilerBuildVersion: String,
|
compilerBuildVersion: String,
|
||||||
languageVersionString: String,
|
languageVersionString: String,
|
||||||
apiVersionString: String,
|
apiVersionString: String,
|
||||||
coroutinesEnable: Boolean,
|
|
||||||
coroutinesWarn: Boolean,
|
|
||||||
coroutinesError: Boolean,
|
|
||||||
multiplatformEnable: Boolean,
|
multiplatformEnable: Boolean,
|
||||||
ownVersion: Int,
|
ownVersion: Int,
|
||||||
coroutinesVersion: Int,
|
coroutinesVersion: Int,
|
||||||
@@ -47,9 +41,6 @@ data class JsBuildMetaInfo(
|
|||||||
compilerBuildVersion = compilerBuildVersion,
|
compilerBuildVersion = compilerBuildVersion,
|
||||||
languageVersionString = languageVersionString,
|
languageVersionString = languageVersionString,
|
||||||
apiVersionString = apiVersionString,
|
apiVersionString = apiVersionString,
|
||||||
coroutinesEnable = coroutinesEnable,
|
|
||||||
coroutinesWarn = coroutinesWarn,
|
|
||||||
coroutinesError = coroutinesError,
|
|
||||||
multiplatformEnable = multiplatformEnable,
|
multiplatformEnable = multiplatformEnable,
|
||||||
metadataVersionMajor = metadataVersion.major,
|
metadataVersionMajor = metadataVersion.major,
|
||||||
metadataVersionMinor = metadataVersion.minor,
|
metadataVersionMinor = metadataVersion.minor,
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ data class JvmBuildMetaInfo(
|
|||||||
override val compilerBuildVersion: String,
|
override val compilerBuildVersion: String,
|
||||||
override val languageVersionString: String,
|
override val languageVersionString: String,
|
||||||
override val apiVersionString: String,
|
override val apiVersionString: String,
|
||||||
override val coroutinesEnable: Boolean,
|
|
||||||
override val coroutinesWarn: Boolean,
|
|
||||||
override val coroutinesError: Boolean,
|
|
||||||
override val multiplatformEnable: Boolean,
|
override val multiplatformEnable: Boolean,
|
||||||
override val metadataVersionMajor: Int,
|
override val metadataVersionMajor: Int,
|
||||||
override val metadataVersionMinor: Int,
|
override val metadataVersionMinor: Int,
|
||||||
@@ -47,9 +44,6 @@ data class JvmBuildMetaInfo(
|
|||||||
compilerBuildVersion: String,
|
compilerBuildVersion: String,
|
||||||
languageVersionString: String,
|
languageVersionString: String,
|
||||||
apiVersionString: String,
|
apiVersionString: String,
|
||||||
coroutinesEnable: Boolean,
|
|
||||||
coroutinesWarn: Boolean,
|
|
||||||
coroutinesError: Boolean,
|
|
||||||
multiplatformEnable: Boolean,
|
multiplatformEnable: Boolean,
|
||||||
ownVersion: Int,
|
ownVersion: Int,
|
||||||
coroutinesVersion: Int,
|
coroutinesVersion: Int,
|
||||||
@@ -62,9 +56,6 @@ data class JvmBuildMetaInfo(
|
|||||||
compilerBuildVersion = compilerBuildVersion,
|
compilerBuildVersion = compilerBuildVersion,
|
||||||
languageVersionString = languageVersionString,
|
languageVersionString = languageVersionString,
|
||||||
apiVersionString = apiVersionString,
|
apiVersionString = apiVersionString,
|
||||||
coroutinesEnable = coroutinesEnable,
|
|
||||||
coroutinesWarn = coroutinesWarn,
|
|
||||||
coroutinesError = coroutinesError,
|
|
||||||
multiplatformEnable = multiplatformEnable,
|
multiplatformEnable = multiplatformEnable,
|
||||||
metadataVersionMajor = metadataVersion.major,
|
metadataVersionMajor = metadataVersion.major,
|
||||||
metadataVersionMinor = metadataVersion.minor,
|
metadataVersionMinor = metadataVersion.minor,
|
||||||
|
|||||||
-30
@@ -121,13 +121,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
)
|
)
|
||||||
var intellijPluginRoot: String? by NullableStringFreezableVar(null)
|
var intellijPluginRoot: String? by NullableStringFreezableVar(null)
|
||||||
|
|
||||||
@Argument(
|
|
||||||
value = "-Xcoroutines",
|
|
||||||
valueDescription = "{enable|warn|error}",
|
|
||||||
description = "Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier"
|
|
||||||
)
|
|
||||||
var coroutinesState: String? by NullableStringFreezableVar(DEFAULT)
|
|
||||||
|
|
||||||
@Argument(
|
@Argument(
|
||||||
value = "-Xnew-inference",
|
value = "-Xnew-inference",
|
||||||
description = "Enable new experimental generic type inference algorithm"
|
description = "Enable new experimental generic type inference algorithm"
|
||||||
@@ -385,17 +378,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
put(LanguageFeature.MultiPlatformProjects, LanguageFeature.State.ENABLED)
|
put(LanguageFeature.MultiPlatformProjects, LanguageFeature.State.ENABLED)
|
||||||
}
|
}
|
||||||
|
|
||||||
when (coroutinesState) {
|
|
||||||
CommonCompilerArguments.ERROR -> put(LanguageFeature.Coroutines, LanguageFeature.State.ENABLED_WITH_ERROR)
|
|
||||||
CommonCompilerArguments.ENABLE -> put(LanguageFeature.Coroutines, LanguageFeature.State.ENABLED)
|
|
||||||
CommonCompilerArguments.WARN, CommonCompilerArguments.DEFAULT -> {
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
val message = "Invalid value of -Xcoroutines (should be: enable, warn or error): " + coroutinesState
|
|
||||||
collector.report(CompilerMessageSeverity.ERROR, message, null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newInference) {
|
if (newInference) {
|
||||||
put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED)
|
put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED)
|
||||||
put(LanguageFeature.SamConversionPerArgument, LanguageFeature.State.ENABLED)
|
put(LanguageFeature.SamConversionPerArgument, LanguageFeature.State.ENABLED)
|
||||||
@@ -525,7 +507,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
configureLanguageFeatures(collector)
|
configureLanguageFeatures(collector)
|
||||||
)
|
)
|
||||||
|
|
||||||
checkCoroutines(languageVersionSettings, collector)
|
|
||||||
checkIrSupport(languageVersionSettings, collector)
|
checkIrSupport(languageVersionSettings, collector)
|
||||||
|
|
||||||
return languageVersionSettings
|
return languageVersionSettings
|
||||||
@@ -596,17 +577,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkCoroutines(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
|
|
||||||
if (languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)) {
|
|
||||||
if (coroutinesState != DEFAULT) {
|
|
||||||
collector.report(
|
|
||||||
CompilerMessageSeverity.STRONG_WARNING,
|
|
||||||
"-Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
|
protected open fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
|
||||||
// backend-specific
|
// backend-specific
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -30,8 +30,6 @@ where advanced options include:
|
|||||||
Run sticky condition checks on subsequent phases as well. Implies -Xcheck-phase-conditions
|
Run sticky condition checks on subsequent phases as well. Implies -Xcheck-phase-conditions
|
||||||
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
||||||
Should be a subset of sources passed as free arguments
|
Should be a subset of sources passed as free arguments
|
||||||
-Xcoroutines={enable|warn|error}
|
|
||||||
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
|
|
||||||
-Xdisable-default-scripting-plugin
|
-Xdisable-default-scripting-plugin
|
||||||
Do not enable scripting plugin by default
|
Do not enable scripting plugin by default
|
||||||
-Xdisable-phases Disable backend phases
|
-Xdisable-phases Disable backend phases
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
|
warning: flag is not supported by this version of the compiler: -Xcoroutines=enable
|
||||||
OK
|
OK
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
|
warning: flag is not supported by this version of the compiler: -Xcoroutines=error
|
||||||
OK
|
OK
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
warning: argument -Xcoroutines is passed multiple times. Only the last value will be used: enable
|
warning: flag is not supported by this version of the compiler: -Xcoroutines=error
|
||||||
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
|
warning: flag is not supported by this version of the compiler: -Xcoroutines=enable
|
||||||
OK
|
OK
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
|
warning: flag is not supported by this version of the compiler: -Xcoroutines=warn
|
||||||
OK
|
OK
|
||||||
|
|||||||
-2
@@ -130,8 +130,6 @@ where advanced options include:
|
|||||||
Run sticky condition checks on subsequent phases as well. Implies -Xcheck-phase-conditions
|
Run sticky condition checks on subsequent phases as well. Implies -Xcheck-phase-conditions
|
||||||
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
||||||
Should be a subset of sources passed as free arguments
|
Should be a subset of sources passed as free arguments
|
||||||
-Xcoroutines={enable|warn|error}
|
|
||||||
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
|
|
||||||
-Xdisable-default-scripting-plugin
|
-Xdisable-default-scripting-plugin
|
||||||
Do not enable scripting plugin by default
|
Do not enable scripting plugin by default
|
||||||
-Xdisable-phases Disable backend phases
|
-Xdisable-phases Disable backend phases
|
||||||
|
|||||||
@@ -195,19 +195,7 @@ private fun readElementsList(element: Element, rootElementName: String, elementN
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun readV2Config(element: Element): KotlinFacetSettings {
|
private fun readV2Config(element: Element): KotlinFacetSettings {
|
||||||
return readV2AndLaterConfig(element).apply {
|
return readV2AndLaterConfig(element)
|
||||||
element.getChild("compilerArguments")?.children?.let { args ->
|
|
||||||
when {
|
|
||||||
args.any { arg -> arg.attributes[0].value == "coroutinesEnable" && arg.attributes[1].booleanValue } ->
|
|
||||||
compilerArguments!!.coroutinesState = CommonCompilerArguments.ENABLE
|
|
||||||
args.any { arg -> arg.attributes[0].value == "coroutinesWarn" && arg.attributes[1].booleanValue } ->
|
|
||||||
compilerArguments!!.coroutinesState = CommonCompilerArguments.WARN
|
|
||||||
args.any { arg -> arg.attributes[0].value == "coroutinesError" && arg.attributes[1].booleanValue } ->
|
|
||||||
compilerArguments!!.coroutinesState = CommonCompilerArguments.ERROR
|
|
||||||
else -> compilerArguments!!.coroutinesState = CommonCompilerArguments.DEFAULT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readLatestConfig(element: Element): KotlinFacetSettings {
|
private fun readLatestConfig(element: Element): KotlinFacetSettings {
|
||||||
@@ -408,35 +396,10 @@ fun Element.dropVersionsIfNecessary(settings: CommonCompilerArguments) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special treatment of v2 may be dropped after transition to IDEA 172
|
|
||||||
private fun KotlinFacetSettings.writeV2Config(element: Element) {
|
|
||||||
writeLatestConfig(element)
|
|
||||||
element.getChild("compilerArguments")?.let {
|
|
||||||
it.getOption("coroutinesState")?.detach()
|
|
||||||
val coroutineOption = when (compilerArguments?.coroutinesState) {
|
|
||||||
CommonCompilerArguments.ENABLE -> "coroutinesEnable"
|
|
||||||
CommonCompilerArguments.WARN -> "coroutinesWarn"
|
|
||||||
CommonCompilerArguments.ERROR -> "coroutinesError"
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
if (coroutineOption != null) {
|
|
||||||
Element("option").apply {
|
|
||||||
setAttribute("name", coroutineOption)
|
|
||||||
setAttribute("value", "true")
|
|
||||||
it.addContent(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun KotlinFacetSettings.serializeFacetSettings(element: Element) {
|
fun KotlinFacetSettings.serializeFacetSettings(element: Element) {
|
||||||
val versionToWrite = if (version == 2) version else KotlinFacetSettings.CURRENT_VERSION
|
val versionToWrite = if (version == 2) version else KotlinFacetSettings.CURRENT_VERSION
|
||||||
element.setAttribute("version", versionToWrite.toString())
|
element.setAttribute("version", versionToWrite.toString())
|
||||||
if (versionToWrite == 2) {
|
writeLatestConfig(element)
|
||||||
writeV2Config(element)
|
|
||||||
} else {
|
|
||||||
writeLatestConfig(element)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TargetPlatform.serializeComponentPlatforms(): String {
|
private fun TargetPlatform.serializeComponentPlatforms(): String {
|
||||||
|
|||||||
@@ -190,10 +190,6 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
|||||||
arguments.multiPlatform = configuration?.getChild("multiPlatform")?.text?.trim()?.toBoolean() ?: false
|
arguments.multiPlatform = configuration?.getChild("multiPlatform")?.text?.trim()?.toBoolean() ?: false
|
||||||
arguments.suppressWarnings = configuration?.getChild("nowarn")?.text?.trim()?.toBoolean() ?: false
|
arguments.suppressWarnings = configuration?.getChild("nowarn")?.text?.trim()?.toBoolean() ?: false
|
||||||
|
|
||||||
configuration?.getChild("experimentalCoroutines")?.text?.trim()?.let {
|
|
||||||
arguments.coroutinesState = it
|
|
||||||
}
|
|
||||||
|
|
||||||
when (arguments) {
|
when (arguments) {
|
||||||
is K2JVMCompilerArguments -> {
|
is K2JVMCompilerArguments -> {
|
||||||
arguments.classpath = configuration?.getChild("classpath")?.text
|
arguments.classpath = configuration?.getChild("classpath")?.text
|
||||||
@@ -256,7 +252,6 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
|||||||
|
|
||||||
kotlinFacet.configureFacet(
|
kotlinFacet.configureFacet(
|
||||||
compilerVersion,
|
compilerVersion,
|
||||||
LanguageFeature.Coroutines.defaultState,
|
|
||||||
platform,
|
platform,
|
||||||
modifiableModelsProvider
|
modifiableModelsProvider
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -409,7 +409,7 @@ private fun configureLanguageAndApiVersion(
|
|||||||
compilerArguments.apiVersion = null
|
compilerArguments.apiVersion = null
|
||||||
}
|
}
|
||||||
|
|
||||||
facet.configureFacet(languageVersion, LanguageFeature.State.DISABLED, null, modelsProvider)
|
facet.configureFacet(languageVersion, null, modelsProvider)
|
||||||
if (apiVersion != null) {
|
if (apiVersion != null) {
|
||||||
facet.configuration.settings.apiLevel = LanguageVersion.fromVersionString(apiVersion)
|
facet.configuration.settings.apiLevel = LanguageVersion.fromVersionString(apiVersion)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,21 +199,6 @@ private fun Module.externalSystemRunTasks(): List<ExternalSystemRunTask> {
|
|||||||
fun Module.externalSystemTestRunTasks() = externalSystemRunTasks().filterIsInstance<ExternalSystemTestRunTask>()
|
fun Module.externalSystemTestRunTasks() = externalSystemRunTasks().filterIsInstance<ExternalSystemTestRunTask>()
|
||||||
fun Module.externalSystemNativeMainRunTasks() = externalSystemRunTasks().filterIsInstance<ExternalSystemNativeMainRunTask>()
|
fun Module.externalSystemNativeMainRunTasks() = externalSystemRunTasks().filterIsInstance<ExternalSystemNativeMainRunTask>()
|
||||||
|
|
||||||
@Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
|
|
||||||
@Deprecated(
|
|
||||||
message = "IdePlatform is deprecated and will be removed soon, please, migrate to org.jetbrains.kotlin.platform.TargetPlatform",
|
|
||||||
level = DeprecationLevel.ERROR
|
|
||||||
)
|
|
||||||
fun KotlinFacet.configureFacet(
|
|
||||||
compilerVersion: String?,
|
|
||||||
coroutineSupport: LanguageFeature.State,
|
|
||||||
platform: IdePlatform<*, *>,
|
|
||||||
modelsProvider: IdeModifiableModelsProvider
|
|
||||||
) {
|
|
||||||
configureFacet(compilerVersion, coroutineSupport, platform.toNewPlatform(), modelsProvider)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun KotlinFacet.noVersionAutoAdvance() {
|
fun KotlinFacet.noVersionAutoAdvance() {
|
||||||
configuration.settings.compilerArguments?.let {
|
configuration.settings.compilerArguments?.let {
|
||||||
it.autoAdvanceLanguageVersion = false
|
it.autoAdvanceLanguageVersion = false
|
||||||
@@ -226,8 +211,7 @@ fun KotlinFacet.noVersionAutoAdvance() {
|
|||||||
val commonUIExposedFields = listOf(
|
val commonUIExposedFields = listOf(
|
||||||
CommonCompilerArguments::languageVersion.name,
|
CommonCompilerArguments::languageVersion.name,
|
||||||
CommonCompilerArguments::apiVersion.name,
|
CommonCompilerArguments::apiVersion.name,
|
||||||
CommonCompilerArguments::suppressWarnings.name,
|
CommonCompilerArguments::suppressWarnings.name
|
||||||
CommonCompilerArguments::coroutinesState.name
|
|
||||||
)
|
)
|
||||||
private val commonUIHiddenFields = listOf(
|
private val commonUIHiddenFields = listOf(
|
||||||
CommonCompilerArguments::pluginClasspaths.name,
|
CommonCompilerArguments::pluginClasspaths.name,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import junit.framework.TestCase
|
|||||||
import org.jetbrains.kotlin.asJava.elements.KtLightAnnotationForSourceEntry
|
import org.jetbrains.kotlin.asJava.elements.KtLightAnnotationForSourceEntry
|
||||||
import org.jetbrains.kotlin.asJava.elements.KtLightPsiArrayInitializerMemberValue
|
import org.jetbrains.kotlin.asJava.elements.KtLightPsiArrayInitializerMemberValue
|
||||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
|
||||||
import org.jetbrains.kotlin.idea.completion.test.assertInstanceOf
|
import org.jetbrains.kotlin.idea.completion.test.assertInstanceOf
|
||||||
import org.jetbrains.kotlin.idea.facet.configureFacet
|
import org.jetbrains.kotlin.idea.facet.configureFacet
|
||||||
import org.jetbrains.kotlin.idea.facet.getOrCreateFacet
|
import org.jetbrains.kotlin.idea.facet.getOrCreateFacet
|
||||||
@@ -926,7 +925,7 @@ class KtLightAnnotationTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
WriteAction.run<Throwable> {
|
WriteAction.run<Throwable> {
|
||||||
val modelsProvider = IdeModifiableModelsProviderImpl(project)
|
val modelsProvider = IdeModifiableModelsProviderImpl(project)
|
||||||
val facet = module.getOrCreateFacet(modelsProvider, useProjectSettings = false)
|
val facet = module.getOrCreateFacet(modelsProvider, useProjectSettings = false)
|
||||||
facet.configureFacet(version, LanguageFeature.State.DISABLED, null, modelsProvider)
|
facet.configureFacet(version, null, modelsProvider)
|
||||||
modelsProvider.commit()
|
modelsProvider.commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,7 +346,6 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
|||||||
FacetUtilsKt.configureFacet(
|
FacetUtilsKt.configureFacet(
|
||||||
facet,
|
facet,
|
||||||
"1.1",
|
"1.1",
|
||||||
LanguageFeature.State.ENABLED,
|
|
||||||
platform,
|
platform,
|
||||||
modelsProvider
|
modelsProvider
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,15 +7,12 @@ package org.jetbrains.kotlin.idea.quickfix
|
|||||||
|
|
||||||
import com.intellij.facet.FacetManager
|
import com.intellij.facet.FacetManager
|
||||||
import com.intellij.facet.impl.FacetUtil
|
import com.intellij.facet.impl.FacetUtil
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel
|
import com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel
|
||||||
import com.intellij.openapi.roots.OrderRootType
|
import com.intellij.openapi.roots.OrderRootType
|
||||||
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor
|
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import com.intellij.openapi.vfs.JarFileSystem
|
import com.intellij.openapi.vfs.JarFileSystem
|
||||||
import com.intellij.openapi.vfs.LocalFileSystem
|
import com.intellij.openapi.vfs.LocalFileSystem
|
||||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments.Companion.DEFAULT
|
|
||||||
import org.jetbrains.kotlin.config.CompilerSettings.Companion.DEFAULT_ADDITIONAL_ARGUMENTS
|
import org.jetbrains.kotlin.config.CompilerSettings.Companion.DEFAULT_ADDITIONAL_ARGUMENTS
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.config.LanguageVersion
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
@@ -57,28 +54,6 @@ class UpdateConfigurationQuickFixTest : KotlinLightPlatformCodeInsightFixtureTes
|
|||||||
assertEquals(LanguageFeature.State.ENABLED, inlineClassesSupport)
|
assertEquals(LanguageFeature.State.ENABLED, inlineClassesSupport)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testEnableCoroutines() {
|
|
||||||
configureRuntime("mockRuntime11")
|
|
||||||
resetProjectSettings(LanguageVersion.KOTLIN_1_1)
|
|
||||||
myFixture.configureByText("foo.kt", "suspend fun foo()")
|
|
||||||
|
|
||||||
assertEquals(DEFAULT, KotlinCommonCompilerArgumentsHolder.getInstance(project).settings.coroutinesState)
|
|
||||||
assertEquals(LanguageFeature.State.ENABLED_WITH_WARNING, coroutineSupport)
|
|
||||||
myFixture.launchAction(myFixture.findSingleIntention("Enable coroutine support in the project"))
|
|
||||||
assertEquals(LanguageFeature.State.ENABLED, coroutineSupport)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testDisableCoroutines() {
|
|
||||||
configureRuntime("mockRuntime11")
|
|
||||||
resetProjectSettings(LanguageVersion.KOTLIN_1_1)
|
|
||||||
myFixture.configureByText("foo.kt", "suspend fun foo()")
|
|
||||||
|
|
||||||
assertEquals(DEFAULT, KotlinCommonCompilerArgumentsHolder.getInstance(project).settings.coroutinesState)
|
|
||||||
assertEquals(LanguageFeature.State.ENABLED_WITH_WARNING, coroutineSupport)
|
|
||||||
myFixture.launchAction(myFixture.findSingleIntention("Disable coroutine support in the project"))
|
|
||||||
assertEquals(LanguageFeature.State.ENABLED_WITH_ERROR, coroutineSupport)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testIncreaseLangLevel() {
|
fun testIncreaseLangLevel() {
|
||||||
configureRuntime("mockRuntime11")
|
configureRuntime("mockRuntime11")
|
||||||
resetProjectSettings(LanguageVersion.KOTLIN_1_0)
|
resetProjectSettings(LanguageVersion.KOTLIN_1_0)
|
||||||
@@ -189,13 +164,9 @@ class UpdateConfigurationQuickFixTest : KotlinLightPlatformCodeInsightFixtureTes
|
|||||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||||
languageVersion = version.versionString
|
languageVersion = version.versionString
|
||||||
apiVersion = version.versionString
|
apiVersion = version.versionString
|
||||||
coroutinesState = DEFAULT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val coroutineSupport: LanguageFeature.State
|
|
||||||
get() = project.getLanguageVersionSettings().getFeatureSupport(LanguageFeature.Coroutines)
|
|
||||||
|
|
||||||
private val inlineClassesSupport: LanguageFeature.State
|
private val inlineClassesSupport: LanguageFeature.State
|
||||||
get() = project.getLanguageVersionSettings().getFeatureSupport(LanguageFeature.InlineClasses)
|
get() = project.getLanguageVersionSettings().getFeatureSupport(LanguageFeature.InlineClasses)
|
||||||
|
|
||||||
|
|||||||
-9
@@ -53,15 +53,6 @@ internal open class AbstractKotlinCompileArgumentsContributor<T : CommonCompiler
|
|||||||
args: T,
|
args: T,
|
||||||
flags: Collection<CompilerArgumentsConfigurationFlag>
|
flags: Collection<CompilerArgumentsConfigurationFlag>
|
||||||
) {
|
) {
|
||||||
args.coroutinesState = when (coroutines.get()) {
|
|
||||||
Coroutines.ENABLE -> CommonCompilerArguments.ENABLE
|
|
||||||
Coroutines.WARN -> CommonCompilerArguments.WARN
|
|
||||||
Coroutines.ERROR -> CommonCompilerArguments.ERROR
|
|
||||||
Coroutines.DEFAULT -> CommonCompilerArguments.DEFAULT
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.kotlinDebug { "args.coroutinesState=${args.coroutinesState}" }
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled) {
|
if (logger.isDebugEnabled) {
|
||||||
args.verbose = true
|
args.verbose = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user