[K2] Disable constants evaluation with native metadata compilation

^KT-63835 Fixed
This commit is contained in:
Ivan Kochurkin
2023-12-06 20:34:33 +01:00
committed by Space Team
parent ec4edbfcf2
commit 145958e284
10 changed files with 113 additions and 0 deletions
@@ -474,6 +474,9 @@ The default value is 1."""
it[AnalysisFlags.optIn] = optInList + listOf("kotlin.ExperimentalUnsignedTypes")
if (printIr)
phasesToDumpAfter = arrayOf("ALL")
if (metadataKlib) {
it[AnalysisFlags.metadataCompilation] = true
}
}
override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
@@ -9,6 +9,7 @@ import org.gradle.util.GradleVersion
import org.jetbrains.kotlin.gradle.testbase.*
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.condition.OS
import kotlin.test.Ignore
@Disabled("Used for local testing only")
@@ -208,4 +209,32 @@ class CustomK2Tests : KGPBaseTest() {
}
}
}
@GradleTest
@DisplayName("Native metadata compilation with constant expressions (KT-63835)")
fun nativeMetadataCompilationWithConstantExpressions(gradleVersion: GradleVersion) {
project("k2-native-metadata-compilation-with-constant-expressions", gradleVersion) {
build("compileCommonMainKotlinMetadata") {
assertTasksExecuted(":compileCommonMainKotlinMetadata")
}
}
}
}
@NativeGradlePluginTests
@OsCondition(supportedOn = [OS.MAC], enabledOnCI = [OS.MAC])
@DisplayName("K2: custom MacOS tests")
class CustomK2MacOSTests : KGPBaseTest() {
override val defaultBuildOptions: BuildOptions get() = super.defaultBuildOptions.copyEnsuringK2()
@GradleTest
@DisplayName("Universal metadata compilation with constant expressions (KT-63835)")
fun universalMetadataCompilationWithConstantExpressions(gradleVersion: GradleVersion) {
project("k2-universal-metadata-compilation-with-constant-expressions", gradleVersion) {
build("assemble") {
assertTasksExecuted(":assemble")
assertTasksExecuted(":compileIosMainKotlinMetadata")
}
}
}
}
@@ -0,0 +1,19 @@
// ISSUE: KT-63835
plugins {
kotlin("multiplatform")
}
repositories {
mavenLocal()
mavenCentral()
}
kotlin {
applyDefaultHierarchyTemplate()
linuxX64()
macosArm64()
macosX64()
}
@@ -0,0 +1,6 @@
const val x1: String = "common"
const val y1: String = "Main"
@Deprecated(message = x1 + y1)
fun mainCommon() {
}
@@ -0,0 +1,6 @@
const val x2: String = "ios"
const val y2: String = "Main"
@Deprecated(message = x2 + y2)
fun mainIos() {
}
@@ -0,0 +1,26 @@
// ISSUE: KT-63835
plugins {
kotlin("multiplatform")
}
repositories {
mavenLocal()
mavenCentral()
}
kotlin {
applyDefaultHierarchyTemplate()
jvm()
js(IR)
linuxX64()
macosArm64()
macosX64()
iosArm64()
iosSimulatorArm64()
}
@@ -0,0 +1,6 @@
const val x1: String = "common"
const val y1: String = "Main"
@Deprecated(message = x1 + y1)
fun main1() {
}
@@ -0,0 +1,6 @@
const val x2: String = "ios"
const val y2: String = "Main"
@Deprecated(message = x2 + y2)
fun main2() {
}
@@ -0,0 +1,6 @@
const val x3: String = "js"
const val y3: String = "Main"
@Deprecated(message = x3 + y3)
fun main3() {
}
@@ -0,0 +1,6 @@
const val x4: String = "jvm"
const val y4: String = "Main"
@Deprecated(message = x4 + y4)
fun main4() {
}