[Gradle Native] Made a k/n bundle as input for commonizeNativeDist task

Also, extracted moving konan bundle to konanHome into BuildService and wrapped moving k/n bundle to konan home with file lock.
And added an integration test for checking ^KT-65222 and ^KT-65347.

^KT-65450
^KT-65347 Fixed


Merge-request: KT-MR-14099
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
This commit is contained in:
Dmitrii Krasnov
2024-02-05 16:37:49 +00:00
committed by Space Team
parent f262247b2b
commit 06a3e9135c
12 changed files with 200 additions and 85 deletions
@@ -80,24 +80,22 @@ class KotlinNativeCompilerDownloadIT : KGPBaseTest() {
}
}
@DisplayName("KT-65222: Kotlin Native must be downloaded during even if klib dir exists")
@DisplayName(
"KT-65222, KT-65347: check that commonize native distribution depends on downloaded k/n bundle " +
"and downloaded bundle does not erase installed caches"
)
@GradleTest
fun shouldDownloadKotlinNativeWithExistingKlibDir(gradleVersion: GradleVersion, @TempDir konanTemp: Path) {
fun checkCommonizeNativeDistributionWithPlatform(gradleVersion: GradleVersion, @TempDir konanTemp: Path) {
nativeProject(
"native-simple-project",
"commonize-native-distribution",
gradleVersion,
buildOptions = defaultBuildOptions.copy(
konanDataDir = konanTemp,
),
) {
build(":commonizeNativeDistribution") {
assertDirectoryExists(konanTemp.resolve(STABLE_VERSION_DIR_NAME).resolve("klib"))
assertDirectoryDoesNotExist(konanTemp.resolve(STABLE_VERSION_DIR_NAME).resolve("bin"))
}
build("assemble") {
assertOutputDoesNotContain(DOWNLOAD_KONAN_FINISHED_LOG)
assertOutputContains(UNPUCK_KONAN_FINISHED_LOG)
assertOutputDoesNotContain("Please wait while Kotlin/Native")
build(":compileNativeMainKotlinMetadata") {
assertDirectoryExists(konanTemp.resolve(STABLE_VERSION_DIR_NAME).resolve("klib").resolve("platform"))
assertDirectoryExists(konanTemp.resolve(STABLE_VERSION_DIR_NAME).resolve("bin"))
}
}
}
@@ -0,0 +1,13 @@
plugins {
kotlin("multiplatform")
}
repositories {
mavenCentral()
mavenLocal()
}
kotlin {
linuxX64()
linuxArm64()
}
@@ -0,0 +1,5 @@
import platform.posix.*
fun main() {
println("Hello from simple native project")
}