[IDE] Propagate KotlinFacetSettings version and completely drop isReleaseCoroutines flag
Also this commit removes number of tests related to support experimental coroutines
This commit is contained in:
committed by
TeamCityServer
parent
e991c9d476
commit
af94bcebea
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.junit.Assert.assertNotEquals
|
||||
import org.junit.Test
|
||||
@@ -34,10 +33,7 @@ class BuildMetaInfoTest : TestCase() {
|
||||
"bytecodeVersionMinor",
|
||||
"bytecodeVersionPatch",
|
||||
"compilerBuildVersion",
|
||||
"coroutinesEnable",
|
||||
"coroutinesError",
|
||||
"coroutinesVersion",
|
||||
"coroutinesWarn",
|
||||
"isEAP",
|
||||
"languageVersionString",
|
||||
"metadataVersionMajor",
|
||||
@@ -71,14 +67,12 @@ class BuildMetaInfoTest : TestCase() {
|
||||
@Test
|
||||
fun testJvmEquals() {
|
||||
val args1 = K2JVMCompilerArguments()
|
||||
args1.coroutinesState = CommonCompilerArguments.ENABLE
|
||||
val info1 = JvmBuildMetaInfo.create(args1)
|
||||
|
||||
val args2 = K2JVMCompilerArguments()
|
||||
args2.coroutinesState = CommonCompilerArguments.WARN
|
||||
val info2 = JvmBuildMetaInfo.create(args2)
|
||||
|
||||
assertNotEquals(info1, info2)
|
||||
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
|
||||
assertEquals(info1, info2)
|
||||
assertEquals(info1, info2.copy())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// ADDITIONAL_COMPILER_ARGUMENTS: -Xcoroutines=enable
|
||||
|
||||
fun f(g: suspend () -> Unit): Any = g
|
||||
|
||||
suspend fun h() = f { }
|
||||
|
||||
expect suspend fun k()
|
||||
|
||||
expect fun l(g: suspend () -> Unit): Any
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Common --
|
||||
Exit code: OK
|
||||
Output:
|
||||
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
|
||||
Generated
-5
@@ -34,11 +34,6 @@ public class MultiPlatformIntegrationTestGenerated extends AbstractMultiPlatform
|
||||
runTest("compiler/testData/multiplatform/compatibleProperties/");
|
||||
}
|
||||
|
||||
@TestMetadata("compilerArguments")
|
||||
public void testCompilerArguments() throws Exception {
|
||||
runTest("compiler/testData/multiplatform/compilerArguments/");
|
||||
}
|
||||
|
||||
@TestMetadata("contracts")
|
||||
public void testContracts() throws Exception {
|
||||
runTest("compiler/testData/multiplatform/contracts/");
|
||||
|
||||
-37
@@ -526,43 +526,6 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
)
|
||||
}
|
||||
|
||||
fun testObsoleteInlineSuspend() {
|
||||
val version = intArrayOf(1, 0, 1) // legacy coroutines metadata
|
||||
val options = listOf("-language-version", "1.2", "-Xcoroutines=enable")
|
||||
val library = transformJar(
|
||||
compileLibrary(
|
||||
"library",
|
||||
additionalOptions = options,
|
||||
extraClassPath = listOf(ForTestCompileRuntime.coroutinesCompatForTests()),
|
||||
checkKotlinOutput = { actual ->
|
||||
KotlinTestUtils.assertEqualsToFile(File(testDataDirectory, "library.output.txt"), actual)
|
||||
}
|
||||
),
|
||||
{ _, bytes ->
|
||||
val (resultBytes, removedCounter) = stripSuspensionMarksToImitateLegacyCompiler(
|
||||
WrongBytecodeVersionTest.transformMetadataInClassFile(bytes) { name, _ ->
|
||||
if (name == JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME) version else null
|
||||
})
|
||||
// we expect 4 instructions to be removed in this test library
|
||||
assertEquals(4, removedCounter)
|
||||
resultBytes
|
||||
})
|
||||
compileKotlin(
|
||||
"source.kt", tmpdir, listOf(library, ForTestCompileRuntime.coroutinesCompatForTests()), K2JVMCompiler(),
|
||||
additionalOptions = options
|
||||
)
|
||||
val classLoader = URLClassLoader(
|
||||
arrayOf(library.toURI().toURL(), tmpdir.toURI().toURL(), ForTestCompileRuntime.coroutinesCompatForTests().toURI().toURL()),
|
||||
ForTestCompileRuntime.runtimeJarClassLoader()
|
||||
)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = classLoader
|
||||
.loadClass("SourceKt")
|
||||
.getDeclaredMethod("run")
|
||||
.invoke(null) as Array<String>
|
||||
assertEquals(result[0], result[1])
|
||||
}
|
||||
|
||||
fun testInlineFunctionsWithMatchingJvmSignatures() {
|
||||
val library = compileLibrary(
|
||||
"library",
|
||||
|
||||
-1
@@ -43,7 +43,6 @@ class IdeaResolverForProject(
|
||||
private val syntheticFilesByModule: Map<IdeaModuleInfo, Collection<KtFile>>,
|
||||
delegateResolver: ResolverForProject<IdeaModuleInfo>,
|
||||
fallbackModificationTracker: ModificationTracker? = null,
|
||||
private val isReleaseCoroutines: Boolean? = null,
|
||||
// TODO(dsavvinov): this is needed only for non-composite analysis, extract separate resolver implementation instead
|
||||
private val constantSdkDependencyIfAny: SdkInfo? = null
|
||||
) : AbstractResolverForProject<IdeaModuleInfo>(
|
||||
|
||||
+6
-22
@@ -80,20 +80,16 @@ internal val LOG = Logger.getInstance(KotlinCacheService::class.java)
|
||||
* This mode is currently enabled only for HMPP projects
|
||||
*/
|
||||
sealed class PlatformAnalysisSettings {
|
||||
// Effectively unused as a property. Needed only to distinguish different modes when being put in a map
|
||||
abstract val isReleaseCoroutines: Boolean
|
||||
|
||||
companion object {
|
||||
fun create(
|
||||
project: Project,
|
||||
platform: TargetPlatform,
|
||||
sdk: Sdk?,
|
||||
isAdditionalBuiltInFeaturesSupported: Boolean,
|
||||
isReleaseCoroutines: Boolean
|
||||
isAdditionalBuiltInFeaturesSupported: Boolean
|
||||
) = if (project.useCompositeAnalysis)
|
||||
CompositeAnalysisSettings(isReleaseCoroutines)
|
||||
CompositeAnalysisSettings
|
||||
else
|
||||
PlatformAnalysisSettingsImpl(platform, sdk, isAdditionalBuiltInFeaturesSupported, isReleaseCoroutines)
|
||||
PlatformAnalysisSettingsImpl(platform, sdk, isAdditionalBuiltInFeaturesSupported)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,11 +97,9 @@ data class PlatformAnalysisSettingsImpl(
|
||||
val platform: TargetPlatform,
|
||||
val sdk: Sdk?,
|
||||
val isAdditionalBuiltInFeaturesSupported: Boolean,
|
||||
override val isReleaseCoroutines: Boolean
|
||||
) : PlatformAnalysisSettings()
|
||||
|
||||
data class CompositeAnalysisSettings(override val isReleaseCoroutines: Boolean) : PlatformAnalysisSettings() {
|
||||
}
|
||||
object CompositeAnalysisSettings : PlatformAnalysisSettings()
|
||||
|
||||
class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService {
|
||||
override fun getResolutionFacade(elements: List<KtElement>): ResolutionFacade {
|
||||
@@ -149,10 +143,7 @@ class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService {
|
||||
): ProjectResolutionFacade {
|
||||
val sdk = dependenciesModuleInfo.sdk
|
||||
val platform = JvmPlatforms.defaultJvmPlatform // TODO: Js scripts?
|
||||
val settings = PlatformAnalysisSettings.create(
|
||||
project, platform, sdk, true,
|
||||
LanguageFeature.ReleaseCoroutines.defaultState == LanguageFeature.State.ENABLED
|
||||
)
|
||||
val settings = PlatformAnalysisSettings.create(project, platform, sdk, true)
|
||||
|
||||
val dependenciesForScriptDependencies = listOf(
|
||||
LibraryModificationTracker.getInstance(project),
|
||||
@@ -227,16 +218,9 @@ class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService {
|
||||
|
||||
private fun IdeaModuleInfo.platformSettings(targetPlatform: TargetPlatform) = PlatformAnalysisSettings.create(
|
||||
this@KotlinCacheServiceImpl.project, targetPlatform, sdk,
|
||||
supportsAdditionalBuiltInsMembers(this@KotlinCacheServiceImpl.project),
|
||||
isReleaseCoroutines()
|
||||
supportsAdditionalBuiltInsMembers(this@KotlinCacheServiceImpl.project)
|
||||
)
|
||||
|
||||
private fun IdeaModuleInfo.isReleaseCoroutines(): Boolean {
|
||||
return IDELanguageSettingsProvider
|
||||
.getLanguageVersionSettings(this, this@KotlinCacheServiceImpl.project)
|
||||
.supportsFeature(LanguageFeature.ReleaseCoroutines)
|
||||
}
|
||||
|
||||
private fun facadeForModules(settings: PlatformAnalysisSettings) =
|
||||
getOrBuildGlobalFacade(settings).facadeForModules
|
||||
|
||||
|
||||
-1
@@ -122,7 +122,6 @@ internal class ProjectResolutionFacade(
|
||||
syntheticFilesByModule,
|
||||
delegateResolverForProject,
|
||||
if (invalidateOnOOCB) KotlinModificationTrackerService.getInstance(project).outOfBlockModificationTracker else null,
|
||||
settings.isReleaseCoroutines,
|
||||
constantSdkDependencyIfAny = if (settings is PlatformAnalysisSettingsImpl) settings.sdk?.let { SdkInfo(project, it) } else null
|
||||
)
|
||||
|
||||
|
||||
-6
@@ -66,12 +66,6 @@ class GradleUpdateConfigurationQuickFixTest : GradleImportingTestCase() {
|
||||
doTest("Set module language version to 1.1")
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.7 <=> 6.0")
|
||||
fun testEnableCoroutines() {
|
||||
doTest("Enable coroutine support in the current module")
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.7 <=> 6.0")
|
||||
fun testAddKotlinReflect() {
|
||||
|
||||
@@ -160,7 +160,7 @@ data class ExternalSystemNativeMainRunTask(
|
||||
class KotlinFacetSettings {
|
||||
companion object {
|
||||
// Increment this when making serialization-incompatible changes to configuration data
|
||||
val CURRENT_VERSION = 3
|
||||
val CURRENT_VERSION = 4
|
||||
val DEFAULT_VERSION = 0
|
||||
}
|
||||
|
||||
|
||||
@@ -194,6 +194,10 @@ private fun readElementsList(element: Element, rootElementName: String, elementN
|
||||
return null
|
||||
}
|
||||
|
||||
private fun readV3Config(element: Element): KotlinFacetSettings {
|
||||
return readV2AndLaterConfig(element)
|
||||
}
|
||||
|
||||
private fun readV2Config(element: Element): KotlinFacetSettings {
|
||||
return readV2AndLaterConfig(element)
|
||||
}
|
||||
@@ -211,6 +215,7 @@ fun deserializeFacetSettings(element: Element): KotlinFacetSettings {
|
||||
return when (version) {
|
||||
1 -> readV1Config(element)
|
||||
2 -> readV2Config(element)
|
||||
3 -> readV3Config(element)
|
||||
KotlinFacetSettings.CURRENT_VERSION -> readLatestConfig(element)
|
||||
else -> return KotlinFacetSettings() // Reset facet configuration if versions don't match
|
||||
}.apply { this.version = version }
|
||||
@@ -397,7 +402,10 @@ fun Element.dropVersionsIfNecessary(settings: CommonCompilerArguments) {
|
||||
}
|
||||
|
||||
fun KotlinFacetSettings.serializeFacetSettings(element: Element) {
|
||||
val versionToWrite = if (version == 2) version else KotlinFacetSettings.CURRENT_VERSION
|
||||
val versionToWrite = when (version) {
|
||||
2, 3 -> version
|
||||
else -> KotlinFacetSettings.CURRENT_VERSION
|
||||
}
|
||||
element.setAttribute("version", versionToWrite.toString())
|
||||
writeLatestConfig(element)
|
||||
}
|
||||
|
||||
-5
@@ -72,11 +72,6 @@ class MavenUpdateConfigurationQuickFixTest : MavenImportingTestCase() {
|
||||
doTest("Set module language version to 1.1")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testEnableCoroutines() {
|
||||
doTest("Enable coroutine support in the current module")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testEnableInlineClasses() {
|
||||
doTest("Enable inline classes support in the current module")
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime (2)" level="project" />
|
||||
</component>
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="4" platform="JVM 1.8" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<option name="jvmTarget" value="1.8" />
|
||||
<option name="languageVersion" value="1.4" />
|
||||
<option name="apiVersion" value="1.2" />
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="CopyrightManager" default="" />
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/module.iml" filepath="$PROJECT_DIR$/module.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime (2)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../mockRuntime11/kotlin-runtime.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
</project>
|
||||
+1
-2
@@ -9,7 +9,6 @@
|
||||
<compilerArguments>
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.0" />
|
||||
<option name="coroutinesEnable" value="true" />
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
@@ -23,4 +22,4 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime (2)" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@
|
||||
<compilerArguments>
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.0" />
|
||||
<option name="coroutinesEnable" value="true" />
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
@@ -23,4 +22,4 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime (2)" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<option name="jvmTarget" value="1.7" />
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.0" />
|
||||
<option name="coroutinesEnable" value="true" />
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
@@ -24,4 +23,4 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime (2)" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@
|
||||
<option name="jvmTarget" value="1.7" />
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.0" />
|
||||
<option name="coroutinesEnable" value="true" />
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
@@ -24,4 +23,4 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime (2)" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
package libN
|
||||
|
||||
suspend fun newFoo() {}
|
||||
fun newBuilder(x: suspend () -> Unit) {}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
package libO
|
||||
|
||||
suspend fun oldFoo() {}
|
||||
fun oldBuilder(x: suspend () -> Unit) {}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
import libN.*
|
||||
import libO.*
|
||||
|
||||
suspend fun newMain() {
|
||||
newFoo()
|
||||
<warning descr="[DEPRECATION] 'oldFoo(): Unit' is deprecated. Experimental coroutines support will be dropped in 1.4">oldFoo</warning>()
|
||||
|
||||
// TODO: actually, it's a bug
|
||||
oldMain()
|
||||
}
|
||||
|
||||
fun newMain2() {
|
||||
newBuilder {
|
||||
newMain()
|
||||
}
|
||||
|
||||
<error descr="[ILLEGAL_SUSPEND_FUNCTION_CALL] Suspend function 'oldFoo' should be called only from a coroutine or another suspend function">oldFoo</error>()
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
import libN.*
|
||||
import libO.*
|
||||
|
||||
suspend fun oldMain() {
|
||||
<error descr="[VERSION_REQUIREMENT_DEPRECATION_ERROR] 'newFoo(): Unit' is only available since Kotlin 1.3 and cannot be used in Kotlin 1.2">newFoo</error>()
|
||||
oldFoo()
|
||||
}
|
||||
|
||||
fun oldMain2() {
|
||||
<error descr="[VERSION_REQUIREMENT_DEPRECATION_ERROR] 'newBuilder(suspend () -> Unit): Unit' is only available since Kotlin 1.3 and cannot be used in Kotlin 1.2">newBuilder</error> {
|
||||
oldMain()
|
||||
}
|
||||
|
||||
oldBuilder {
|
||||
oldMain()
|
||||
}
|
||||
}
|
||||
@@ -258,43 +258,6 @@ open class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
checkHighlightingInProject()
|
||||
}
|
||||
|
||||
fun testCoroutineMixedReleaseStatus() {
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update { skipMetadataVersionCheck = true }
|
||||
KotlinCompilerSettings.getInstance(project).update { additionalArguments = "-Xskip-metadata-version-check" }
|
||||
|
||||
val libOld = MockLibraryUtilExt.compileJvmLibraryToJar(
|
||||
testDataPath + "${getTestName(true)}/libOld", "libOld",
|
||||
extraOptions = listOf("-language-version", "1.2", "-api-version", "1.2")
|
||||
)
|
||||
|
||||
val libNew = MockLibraryUtilExt.compileJvmLibraryToJar(
|
||||
testDataPath + "${getTestName(true)}/libNew", "libNew",
|
||||
extraOptions = listOf("-language-version", "1.3", "-api-version", "1.3")
|
||||
)
|
||||
|
||||
val moduleNew = module("moduleNew").setupKotlinFacet {
|
||||
settings.languageLevel = LanguageVersion.KOTLIN_1_3
|
||||
settings.apiLevel = LanguageVersion.KOTLIN_1_3
|
||||
}
|
||||
|
||||
val moduleOld = module("moduleOld").setupKotlinFacet {
|
||||
settings.languageLevel = LanguageVersion.KOTLIN_1_2
|
||||
settings.apiLevel = LanguageVersion.KOTLIN_1_2
|
||||
}
|
||||
|
||||
moduleNew.addLibrary(libOld)
|
||||
moduleNew.addLibrary(libNew)
|
||||
moduleNew.addLibrary(ForTestCompileRuntime.runtimeJarForTests())
|
||||
|
||||
moduleOld.addLibrary(libNew)
|
||||
moduleOld.addLibrary(libOld)
|
||||
moduleOld.addLibrary(ForTestCompileRuntime.runtimeJarForTests())
|
||||
|
||||
moduleNew.addDependency(moduleOld)
|
||||
|
||||
checkHighlightingInProject()
|
||||
}
|
||||
|
||||
private fun Module.setupKotlinFacet(configure: KotlinFacetConfiguration.() -> Unit) = apply {
|
||||
runWriteAction {
|
||||
val facet = FacetManager.getInstance(this).addFacet(KotlinFacetType.INSTANCE, KotlinFacetType.NAME, null)
|
||||
|
||||
@@ -146,7 +146,7 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
||||
}
|
||||
|
||||
private fun doTestLoadAndSaveProjectWithFacetConfig(valueBefore: String, valueAfter: String) {
|
||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray()).trimEnd()
|
||||
Assert.assertTrue(moduleFileContentBefore.contains(valueBefore))
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.isSaveAllowed = true
|
||||
|
||||
@@ -274,6 +274,20 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
assertEquals("-version -Xallow-kotlin-package -Xskip-metadata-version-check", settings.getCompilerSettings().getAdditionalArguments());
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public void testJvmProjectWithV4FacetConfig() {
|
||||
KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule());
|
||||
K2JVMCompilerArguments arguments = (K2JVMCompilerArguments) settings.getCompilerArguments();
|
||||
assertFalse(settings.getUseProjectSettings());
|
||||
assertEquals(LanguageVersion.KOTLIN_1_4, settings.getLanguageLevel());
|
||||
assertEquals(LanguageVersion.KOTLIN_1_2, settings.getApiLevel());
|
||||
assertEquals(JvmPlatforms.INSTANCE.getJvm18(), settings.getTargetPlatform());
|
||||
assertEquals("1.4", arguments.getLanguageVersion());
|
||||
assertEquals("1.2", arguments.getApiVersion());
|
||||
assertEquals("1.8", arguments.getJvmTarget());
|
||||
assertEquals("-version -Xallow-kotlin-package -Xskip-metadata-version-check", settings.getCompilerSettings().getAdditionalArguments());
|
||||
}
|
||||
|
||||
public void testJvmProjectWithJvmTarget11() {
|
||||
KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule());
|
||||
assertEquals(JvmPlatforms.INSTANCE.jvmPlatformByTargetVersion(JvmTarget.JVM_11), settings.getTargetPlatform());
|
||||
|
||||
Reference in New Issue
Block a user