Skip to content

Commit

Permalink
[Gradle] Added test for addKotlinNativeBundleConfiguration
Browse files Browse the repository at this point in the history
(cherry picked from commit 18c08eb)
  • Loading branch information
dkrasnoff committed Feb 9, 2024
1 parent efafc95 commit 6bbd7b4
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.gradle.util.GradleVersion
import org.jetbrains.kotlin.gradle.testbase.*
import org.jetbrains.kotlin.gradle.testbase.TestVersions.Kotlin.STABLE_RELEASE
import org.jetbrains.kotlin.gradle.util.capitalize
import org.jetbrains.kotlin.gradle.util.replaceFirst
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.presetName
import org.junit.jupiter.api.DisplayName
Expand Down Expand Up @@ -100,6 +101,39 @@ class KotlinNativeCompilerDownloadIT : KGPBaseTest() {
}
}

@DisplayName("KT-65617: check that `addKotlinNativeBundleConfiguration` does not configure dependencies after configuration has been resolved")
@GradleTest
fun checkThatKonanConfigurationCouldBeConfiguredOnlyOnce(gradleVersion: GradleVersion, @TempDir konanTemp: Path) {
nativeProject(
"commonize-native-distribution",
gradleVersion,
buildOptions = defaultBuildOptions.copy(
konanDataDir = konanTemp,
),
) {
buildGradleKts.replaceFirst(
"plugins {",
"""
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import org.jetbrains.kotlin.gradle.targets.native.toolchain.KotlinNativeBundleArtifactFormat
plugins {
""".trimIndent()
)
buildGradleKts.appendText(
"""
tasks.create("taskWithConfigurationResolvedConfiguration") {
dependsOn(":commonizeNativeDistribution")
doFirst {
KotlinNativeBundleArtifactFormat.addKotlinNativeBundleConfiguration(project.rootProject)
}
}
""".trimIndent()
)
build(":commonizeNativeDistribution", "taskWithConfigurationResolvedConfiguration")
}
}

@DisplayName("KT-58303: Downloading Kotlin Native on configuration phase(deprecated version)")
@GradleTest
fun shouldDownloadKotlinNativeOnConfigurationPhaseWithToolchainDisabled(gradleVersion: GradleVersion, @TempDir konanTemp: Path) {
Expand Down

0 comments on commit 6bbd7b4

Please sign in to comment.