Fix serialization of facet settings in order to read properly

settings of native platforms
This commit is contained in:
Andrey Uskov
2019-06-28 13:05:48 +03:00
parent 404ce1a8c1
commit 9fc60be9d8
5 changed files with 78 additions and 1 deletions
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.platform.toTargetPlatform
abstract class KonanPlatform : SimplePlatform("Native") {
override val oldFashionedDescription: String
get() = "Kotlin/Native "
get() = "Native "
}
@Suppress("DEPRECATION_ERROR")
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="2" platform="Native " useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check" />
</compilerSettings>
<compilerArguments>
<option name="languageVersion" value="1.1" />
<option name="apiVersion" value="1.0" />
<option name="coroutinesEnable" value="true" />
</compilerArguments>
</configuration>
</facet>
</component>
<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="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime (2)" level="project" />
</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>
@@ -96,6 +96,16 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
Assert.assertEquals(moduleFileContentBefore, moduleFileContentAfter)
}
fun testLoadAndSaveOldNativeFacet() {
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
val application = ApplicationManager.getApplication() as ApplicationImpl
application.isSaveAllowed = true
application.saveAll()
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
Assert.assertEquals(moduleFileContentBefore.replace("platform=\"Native \"", "platform=\"Native \" allPlatforms=\"Native []\""), moduleFileContentAfter)
}
//TODO(auskov): test parsing common target platform with multiple versions of java, add parsing common platforms
fun testLoadAndSaveProjectWithV2OldPlatformFacetConfig() {
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())