Add using -Xinline-classes by default in IDE intentions

^KT-34209 Fixed
This commit is contained in:
Victor Petukhov
2020-02-17 18:17:11 +03:00
parent 79d7babb57
commit bf23b39d76
5 changed files with 42 additions and 5 deletions
@@ -594,6 +594,21 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
}
}
@Test
fun testEnableFeatureSupportGSKWithoutFoundKotlinVersion() {
val files = importProjectFromTestData()
runInEdtAndWait {
myTestFixture.project.executeWriteCommand("") {
KotlinWithGradleConfigurator.changeFeatureConfiguration(
myTestFixture.module, LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED, false
)
}
checkFiles(files)
}
}
@TargetVersions("4.7+")
@Test
fun testEnableFeatureSupportToExistentArgumentsWithXFlag() = testEnableFeatureSupportToExistentArguments()
@@ -41,12 +41,12 @@ object CliArgumentStringBuilder {
val dedicatedFlag = dedicatedFlagInfo?.run {
val (xFlag, xFlagSinceVersion) = this
// TODO: replace to returning xFlag in 1.4 (behaviour for fallback)
if (kotlinVersion == null) return@run null
if (kotlinVersion == null) return@run xFlag
val isAtLeastSpecifiedVersion = versionRegex.find(kotlinVersion)?.destructured?.let { (major, minor, patch) ->
val parsedVersion = versionRegex.find(kotlinVersion) ?: return@run xFlag
val isAtLeastSpecifiedVersion = parsedVersion.destructured.let { (major, minor, patch) ->
KotlinVersion(major.toInt(), minor.toInt(), patch.toInt()) >= xFlagSinceVersion
} == true
}
if (isAtLeastSpecifiedVersion) xFlag else null
}
@@ -50,7 +50,7 @@
</executions>
<configuration>
<args>
<arg>-XXLanguage:+InlineClasses</arg>
<arg>-Xinline-classes</arg>
</args>
</configuration>
</plugin>
@@ -0,0 +1,8 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
}
apply(plugin ="kotlin")
@@ -0,0 +1,14 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
jcenter()
mavenCentral()
}
}
apply(plugin ="kotlin")
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes")
}