Test for PartialLinkageMode resolving fix
#KT-60839 Fixed
This commit is contained in:
committed by
Space Team
parent
1f61a195a9
commit
682cb991b8
+33
-1
@@ -5,7 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.native
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
||||
import org.jetbrains.kotlin.gradle.testbase.*
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import kotlin.io.path.appendText
|
||||
@@ -67,4 +69,34 @@ internal class KotlinNativeLinkIT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("KT-60839: should provide correct default value for -Xpartial-linkage")
|
||||
@GradleTest
|
||||
fun defaultValueForPartialLinkage(gradleVersion: GradleVersion) {
|
||||
nativeProject(
|
||||
"kt-60839-native-link-cache-builder",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(
|
||||
logLevel = LogLevel.DEBUG,
|
||||
// KT-60839 only reproduces when the build cache is enabled,
|
||||
// but we must ignore it when running this test in order to
|
||||
// ensure we actually try to pass -Xpartial-linkage to konanc.
|
||||
buildCacheEnabled = true,
|
||||
freeArgs = defaultBuildOptions.freeArgs + "--rerun-tasks",
|
||||
nativeOptions = defaultBuildOptions.nativeOptions.copy(
|
||||
cacheKind = NativeCacheKind.STATIC,
|
||||
// Required as this only reproduces from CacheBuilder.
|
||||
cacheOrchestration = "gradle"
|
||||
)
|
||||
),
|
||||
) {
|
||||
|
||||
// Must be an unoptimized debug build.
|
||||
build("linkDebugTestHost") {
|
||||
extractNativeTasksCommandLineArgumentsFromOutput(":linkDebugTestHost") {
|
||||
assertCommandLineArgumentsContain("-Xpartial-linkage=ENABLE")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -79,6 +79,7 @@ data class BuildOptions(
|
||||
val restrictedDistribution: Boolean? = null,
|
||||
val useXcodeMessageStyle: Boolean? = null,
|
||||
val version: String? = null,
|
||||
val cacheOrchestration: String? = null,
|
||||
)
|
||||
|
||||
fun toArguments(
|
||||
@@ -240,6 +241,9 @@ data class BuildOptions(
|
||||
nativeOptions.version?.let {
|
||||
arguments.add("-Pkotlin.native.version=${it}")
|
||||
}
|
||||
nativeOptions.cacheOrchestration?.let {
|
||||
arguments.add("-Pkotlin.native.cacheOrchestration=${it}")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.multiplatform'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
<SingleNativeTarget>("host")
|
||||
|
||||
targets.named("host").configure {
|
||||
binaries.test("integrationTests")
|
||||
}
|
||||
|
||||
targets.named("host").configure {
|
||||
binaries.executable()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
hostTest {
|
||||
dependencies {
|
||||
// This is required as the bug only happens when restoring options to link a native dependency from cache
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.3")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
println("Hello, Kotlin/Native!")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import kotlin.test.Test
|
||||
|
||||
class Test {
|
||||
@Test
|
||||
fun noopTest() {}
|
||||
}
|
||||
Reference in New Issue
Block a user