Use snapshot version for kotlin native when kotlin.native.enabled=true
#KT-64046: Fixed
This commit is contained in:
committed by
Space Team
parent
69ad68ca83
commit
762927410a
+5
-1
@@ -97,7 +97,11 @@ IdeVersionConfigurator.setCurrentIde(project)
|
||||
|
||||
if (!project.hasProperty("versions.kotlin-native")) {
|
||||
// BEWARE! Bumping this version doesn't take an immediate effect on TeamCity: KTI-1107
|
||||
extra["versions.kotlin-native"] = "2.0.0-dev-17343"
|
||||
extra["versions.kotlin-native"] = if (kotlinBuildProperties.isKotlinNativeEnabled) {
|
||||
kotlinBuildProperties.defaultSnapshotVersion
|
||||
} else {
|
||||
"2.0.0-dev-17343"
|
||||
}
|
||||
}
|
||||
|
||||
val irCompilerModules = arrayOf(
|
||||
|
||||
@@ -145,42 +145,13 @@ tasks.register<Delete>("cleanUserHomeKonanDir") {
|
||||
logger.info("Default .konan directory user's home has been deleted: $userHomeKonanDir")
|
||||
}
|
||||
}
|
||||
tasks.register<Task>("prepareNativeBundleForGradleIT") {
|
||||
|
||||
tasks.register<Copy>("prepareNativeBundleForGradleIT") {
|
||||
|
||||
description = "This task adds dependency on :kotlin-native:bundle and then copying built bundle into the tests' konan dir"
|
||||
description = "This task adds dependency on :kotlin-native:bundle"
|
||||
|
||||
if (project.kotlinBuildProperties.isKotlinNativeEnabled) {
|
||||
// 1. Build full Kotlin Native bundle
|
||||
dependsOn(":kotlin-native:bundle")
|
||||
|
||||
// 2. Coping and extracting k/n artifacts from the 1st step to tests' konan data directory
|
||||
val (extension, unzipFunction) = when (HostManager.host) {
|
||||
KonanTarget.MINGW_X64 -> Pair("zip", ::zipTree)
|
||||
else -> Pair("tar.gz", ::tarTree)
|
||||
}
|
||||
|
||||
val kotlinNativeRootDir = rootProject.findProject(":kotlin-native")?.projectDir
|
||||
?: throw IllegalStateException("The path to kotlin-native module is undefined.")
|
||||
|
||||
from(
|
||||
unzipFunction(
|
||||
kotlinNativeRootDir.resolve("kotlin-native-${HostManager.platformName()}-${project.kotlinBuildProperties.defaultSnapshotVersion}.$extension")
|
||||
)
|
||||
)
|
||||
from(
|
||||
unzipFunction(
|
||||
kotlinNativeRootDir.resolve("kotlin-native-prebuilt-${HostManager.platformName()}-${project.kotlinBuildProperties.defaultSnapshotVersion}.$extension")
|
||||
)
|
||||
)
|
||||
|
||||
into(
|
||||
konanDataDir
|
||||
)
|
||||
|
||||
doFirst {
|
||||
delete(konanDataDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +165,8 @@ fun Test.includeNative(include: Boolean) = includeTestsWithPattern(include) {
|
||||
|
||||
fun Test.applyKotlinNativeFromCurrentBranchIfNeeded() {
|
||||
val kotlinNativeFromMasterEnabled = project.kotlinBuildProperties.isKotlinNativeEnabled && project.kotlinBuildProperties.useKotlinNativeLocalDistributionForTests
|
||||
|
||||
//add native bundle dependencies for local test run
|
||||
if (kotlinNativeFromMasterEnabled && !project.kotlinBuildProperties.isTeamcityBuild) {
|
||||
dependsOn(":kotlin-gradle-plugin-integration-tests:prepareNativeBundleForGradleIT")
|
||||
}
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.*
|
||||
import kotlin.test.assertTrue
|
||||
import kotlin.test.fail
|
||||
|
||||
/**
|
||||
* Create a new test project.
|
||||
|
||||
+7
-1
@@ -19,6 +19,7 @@ import org.gradle.api.services.BuildService
|
||||
import org.gradle.api.services.BuildServiceParameters
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.enabledOnCurrentHost
|
||||
import org.jetbrains.kotlin.compilerRunner.konanVersion
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionCommonizerLock
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionTypeProvider
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.PlatformLibrariesGenerator
|
||||
@@ -30,6 +31,7 @@ import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.loadConfigurables
|
||||
import org.jetbrains.kotlin.konan.util.ArchiveExtractor
|
||||
import org.jetbrains.kotlin.konan.util.ArchiveType
|
||||
import org.jetbrains.kotlin.tooling.core.KotlinToolingVersion
|
||||
import java.io.BufferedInputStream
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
@@ -97,8 +99,12 @@ internal abstract class KotlinNativeBundleBuildService : BuildService<BuildServi
|
||||
NativeDistributionCommonizerLock(bundleDir) { message -> project.logger.info("Kotlin Native Bundle: $message") }
|
||||
|
||||
lock.withLock {
|
||||
val needToReinstall = KotlinToolingVersion(project.konanVersion).maturity == KotlinToolingVersion.Maturity.SNAPSHOT
|
||||
if (needToReinstall) {
|
||||
project.logger.debug("Snapshot version could be changed, to be sure that up-to-date version is used, Kotlin/Native should be reinstalled")
|
||||
}
|
||||
|
||||
removeBundleIfNeeded(reinstallFlag, bundleDir)
|
||||
removeBundleIfNeeded(reinstallFlag || needToReinstall, bundleDir)
|
||||
|
||||
if (!bundleDir.resolve(KONAN_DIRECTORY_NAME_TO_CHECK_EXISTENCE).exists()) {
|
||||
val gradleCachesKotlinNativeDir =
|
||||
|
||||
Reference in New Issue
Block a user