[K/N] Remove old Compiler and Meta Version ^KT-55677 Fixed
* Replace it with KotlinCompilerVersion * K/N version should be set now with `deployVersion`. * Cleanup deprecated functions in older versions of the Gradle plugin * Cleanup tests for older versions of compiler downloader Merge-request: KT-MR-8436 Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
5ec626b29d
commit
c9aeadd31f
@@ -92,10 +92,6 @@ extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
|
||||
extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
|
||||
extra["ideaPluginDir"] = project.file(ideaPluginDir)
|
||||
extra["isSonatypeRelease"] = false
|
||||
val kotlinNativeVersionObject = project.kotlinNativeVersionValue()
|
||||
subprojects {
|
||||
extra["kotlinNativeVersion"] = kotlinNativeVersionObject
|
||||
}
|
||||
|
||||
rootProject.apply {
|
||||
from(rootProject.file("gradle/versions.gradle.kts"))
|
||||
|
||||
@@ -88,23 +88,6 @@ java {
|
||||
}
|
||||
}
|
||||
|
||||
val generateCompilerVersion by tasks.registering(VersionGenerator::class) {
|
||||
kotlinNativeVersionInResources=true
|
||||
defaultVersionFileLocation()
|
||||
}
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
dependsOn(generateCompilerVersion)
|
||||
}
|
||||
|
||||
tasks.clean {
|
||||
doFirst {
|
||||
val versionSourceDirectory = project.konanVersionGeneratedSrc()
|
||||
if (versionSourceDirectory.exists()) {
|
||||
versionSourceDirectory.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["main"].withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::class) {
|
||||
kotlin.srcDir("src/main/kotlin")
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
@@ -115,7 +98,6 @@ sourceSets["main"].withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourc
|
||||
kotlin.srcDir("../compiler/util-klib/src")
|
||||
kotlin.srcDir("../native/utils/src")
|
||||
}
|
||||
kotlin.srcDir(project.kotlinNativeVersionSrc())
|
||||
/**
|
||||
* TODO: mentioned bellow and Co it'd be better to move to :kotlin-native:performance:buildSrc,
|
||||
* because all this relates to benchmarking.
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan
|
||||
import java.io.*
|
||||
|
||||
val VERSION_PATH = "/META-INF/kotlin-native.compiler.version"
|
||||
val CompilerVersion.Companion.CURRENT: CompilerVersion
|
||||
get() {
|
||||
return InputStreamReader(this::class.java.getResourceAsStream(VERSION_PATH)).use {
|
||||
it.readLines().single().parseCompilerVersion()
|
||||
}
|
||||
}
|
||||
|
||||
val currentCompilerVersion = CompilerVersion.CURRENT
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
interface CompilerVersion : Serializable {
|
||||
val meta: MetaVersion
|
||||
val major: Int
|
||||
val minor: Int
|
||||
val maintenance: Int
|
||||
|
||||
@Deprecated("Milestone is deprecated in favour to MetaVersion's M1 and M2")
|
||||
val milestone: Int
|
||||
|
||||
val build: Int
|
||||
|
||||
fun toString(showMeta: Boolean, showBuild: Boolean): String
|
||||
|
||||
companion object {
|
||||
// major.minor.patch-meta-build where patch, meta and build are optional.
|
||||
val versionPattern = "(\\d+)\\.(\\d+)(?:\\.(\\d+))?(?:-(\\p{Alpha}*\\p{Alnum}|[\\p{Alpha}-]*))?(?:-(\\d+))?".toRegex()
|
||||
|
||||
fun fromString(version: String): CompilerVersion {
|
||||
val (major, minor, maintenance, metaString, build) =
|
||||
versionPattern.matchEntire(version)?.destructured
|
||||
?: throw IllegalArgumentException("Cannot parse Kotlin/Native version: $version")
|
||||
|
||||
return CompilerVersionImpl(
|
||||
MetaVersion.findAppropriate(metaString),
|
||||
major.toInt(),
|
||||
minor.toInt(),
|
||||
maintenance.toIntOrNull() ?: 0,
|
||||
-1,
|
||||
build.toIntOrNull() ?: -1
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun String.parseCompilerVersion() = CompilerVersion.fromString(this)
|
||||
|
||||
data class CompilerVersionImpl(
|
||||
override val meta: MetaVersion = MetaVersion.DEV,
|
||||
override val major: Int,
|
||||
override val minor: Int,
|
||||
override val maintenance: Int,
|
||||
@Deprecated("Milestone is deprecated in favour to MetaVersion's M1 and M2")
|
||||
override val milestone: Int = -1,
|
||||
override val build: Int = -1
|
||||
) : CompilerVersion {
|
||||
|
||||
override fun toString(showMeta: Boolean, showBuild: Boolean) = buildString {
|
||||
append(major)
|
||||
append('.')
|
||||
append(minor)
|
||||
append('.')
|
||||
append(maintenance)
|
||||
if (showMeta) {
|
||||
append('-')
|
||||
append(meta.metaString)
|
||||
}
|
||||
if (showBuild && build != -1) {
|
||||
append('-')
|
||||
append(build)
|
||||
}
|
||||
}
|
||||
|
||||
private val isRelease: Boolean
|
||||
get() = meta == MetaVersion.RELEASE
|
||||
|
||||
private val versionString by lazy { toString(!isRelease, true) }
|
||||
|
||||
override fun toString() = versionString
|
||||
}
|
||||
|
||||
fun CompilerVersion.isAtLeast(compilerVersion: CompilerVersion): Boolean {
|
||||
if (this.major != compilerVersion.major) return this.major > compilerVersion.major
|
||||
if (this.minor != compilerVersion.minor) return this.minor > compilerVersion.minor
|
||||
if (this.maintenance != compilerVersion.maintenance) return this.maintenance > compilerVersion.maintenance
|
||||
if (this.meta != compilerVersion.meta) return this.meta > compilerVersion.meta
|
||||
return this.build >= compilerVersion.build
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.jetbrains.kotlin.konan
|
||||
|
||||
inline class MetaVersion(val metaString: String) {
|
||||
operator fun compareTo(other: MetaVersion): Int {
|
||||
if (metaOrder.contains(this)) {
|
||||
if (metaOrder.contains(other)) {
|
||||
return metaOrder.indexOf(this).compareTo(metaOrder.indexOf(other))
|
||||
}
|
||||
}
|
||||
return metaString.compareTo(other.metaString)
|
||||
}
|
||||
|
||||
companion object {
|
||||
// Following meta versions are left for source-level compatibility
|
||||
val DEV = MetaVersion("dev")
|
||||
val DEV_GOOGLE = MetaVersion("dev-google-pr")
|
||||
val EAP = MetaVersion("eap")
|
||||
val BETA = MetaVersion("Beta")
|
||||
val RC = MetaVersion("RC")
|
||||
val PUB = MetaVersion("PUB")
|
||||
val RELEASE = MetaVersion("release")
|
||||
|
||||
// Defines order of meta versions
|
||||
private val metaOrder = listOf(DEV, DEV_GOOGLE, EAP, BETA, RC, PUB, RELEASE)
|
||||
|
||||
fun findAppropriate(metaString: String): MetaVersion = metaOrder
|
||||
.find { it.metaString.equals(metaString, ignoreCase = true) }
|
||||
?: if (metaString.isBlank()) RELEASE else MetaVersion(metaString) // should it be lowercased?
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.native
|
||||
|
||||
import org.jetbrains.kotlin.konan.*
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import kotlin.test.*
|
||||
|
||||
class NativeCompilerVersionTest {
|
||||
|
||||
@Test
|
||||
fun versionParseTest() {
|
||||
"1.5.30-dev-1".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(5, minor)
|
||||
assertEquals(30, maintenance)
|
||||
assertEquals(MetaVersion.DEV, meta)
|
||||
assertEquals(1, build)
|
||||
}
|
||||
"1.5.30-rc-12".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(5, minor)
|
||||
assertEquals(30, maintenance)
|
||||
assertEquals(MetaVersion.RC, meta)
|
||||
assertEquals(12, build)
|
||||
}
|
||||
// Final release
|
||||
"1.5.30".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(5, minor)
|
||||
assertEquals(30, maintenance)
|
||||
assertEquals(MetaVersion.RELEASE, meta)
|
||||
assertEquals(-1, build)
|
||||
}
|
||||
// Final release build.number
|
||||
"1.5.30-release-34".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(5, minor)
|
||||
assertEquals(30, maintenance)
|
||||
assertEquals(MetaVersion.RELEASE, meta)
|
||||
assertEquals(34, build)
|
||||
}
|
||||
// Release builds
|
||||
"1.5.30-1234".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(5, minor)
|
||||
assertEquals(30, maintenance)
|
||||
assertEquals(MetaVersion.RELEASE, meta)
|
||||
assertEquals(1234, build)
|
||||
}
|
||||
"1.6.0-dev-1".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(6, minor)
|
||||
assertEquals(0, maintenance)
|
||||
assertEquals(MetaVersion.DEV, meta)
|
||||
assertEquals(1, build)
|
||||
}
|
||||
"1.6.10-RC".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(6, minor)
|
||||
assertEquals(10, maintenance)
|
||||
assertEquals(MetaVersion.RC, meta)
|
||||
assertEquals(-1, build)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun incorrectVersionString() {
|
||||
assertFailsWith<IllegalArgumentException> { CompilerVersion.fromString("1.5.30-M1-dev-123") }
|
||||
assertFailsWith<IllegalArgumentException> { CompilerVersion.fromString("1.5.30-M1-release-123") }
|
||||
assertFailsWith<IllegalArgumentException> { CompilerVersion.fromString("1.5.30.40-release-123") }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun versionToString() {
|
||||
assertEquals("1.5.30-dev-140", CompilerVersionImpl(MetaVersion.DEV, 1, 5, 30, -1, 140).toString())
|
||||
assertEquals("1.5.30-RC-140", CompilerVersionImpl(MetaVersion.RC, 1, 5, 30, -1, 140).toString())
|
||||
assertEquals("1.5.30-RC", CompilerVersionImpl(MetaVersion.RC, 1, 5, 30, -1, -1).toString())
|
||||
assertEquals("1.6.10-14", CompilerVersionImpl(MetaVersion.RELEASE, 1, 6, 10, -1, 14).toString())
|
||||
assertEquals("1.6.10-14", CompilerVersionImpl(MetaVersion.RELEASE, 1, 6, 10, -1, 14).toString())
|
||||
assertEquals("1.6.0", CompilerVersionImpl(MetaVersion.RELEASE, 1, 6, 0, -1, -1).toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun publicVersion() {
|
||||
"1.5.30-dev-google-pr-123".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(5, minor)
|
||||
assertEquals(30, maintenance)
|
||||
assertEquals(MetaVersion.DEV_GOOGLE, meta)
|
||||
assertEquals(123, build)
|
||||
}
|
||||
assertEquals("1.5.30-dev-google-pr-140", CompilerVersionImpl(MetaVersion.DEV_GOOGLE, 1, 5, 30, -1, 140).toString())
|
||||
|
||||
"1.5.30-pub-123".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(5, minor)
|
||||
assertEquals(30, maintenance)
|
||||
assertEquals(MetaVersion.PUB, meta)
|
||||
assertEquals(123, build)
|
||||
}
|
||||
assertEquals("1.5.30-PUB-140", CompilerVersionImpl(MetaVersion.PUB, 1, 5, 30, -1, 140).toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun betasAndRCs() {
|
||||
"1.7.0-RC".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(7, minor)
|
||||
assertEquals(0, maintenance)
|
||||
assertEquals(MetaVersion.RC, meta)
|
||||
assertEquals(-1, build)
|
||||
}
|
||||
"1.7.0-RC2".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(7, minor)
|
||||
assertEquals(0, maintenance)
|
||||
assertEquals(MetaVersion("RC2"), meta)
|
||||
assertEquals(-1, build)
|
||||
}
|
||||
"1.7.0-RC2-123".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(7, minor)
|
||||
assertEquals(0, maintenance)
|
||||
assertEquals(MetaVersion("RC2"), meta)
|
||||
assertEquals(123, build)
|
||||
}
|
||||
"1.7.0-Beta".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(7, minor)
|
||||
assertEquals(0, maintenance)
|
||||
assertEquals(MetaVersion.BETA, meta)
|
||||
assertEquals(-1, build)
|
||||
}
|
||||
"1.7.0-Beta2".parseCompilerVersion().apply {
|
||||
assertEquals(1, major)
|
||||
assertEquals(7, minor)
|
||||
assertEquals(0, maintenance)
|
||||
assertEquals(MetaVersion("Beta2"), meta)
|
||||
assertEquals(-1, build)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun metaVersionOrder() {
|
||||
assertTrue("1.7.0-RC2".parseCompilerVersion().isAtLeast("1.7.0-RC".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-RC".parseCompilerVersion().isAtLeast("1.7.0-BETA".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-RC".parseCompilerVersion().isAtLeast("1.7.0-BETA2".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-RC2".parseCompilerVersion().isAtLeast("1.7.0-BETA3".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-release".parseCompilerVersion().isAtLeast("1.7.0-RC".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-release".parseCompilerVersion().isAtLeast("1.7.0-RC3".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-release".parseCompilerVersion().isAtLeast("1.7.0-dev-1234".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-eap1".parseCompilerVersion().isAtLeast("1.7.0-eap".parseCompilerVersion()))
|
||||
assertTrue("1.7.0-eap1".parseCompilerVersion().isAtLeast("1.7.0-eap-134".parseCompilerVersion()))
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.jetbrains.kotlin.library
|
||||
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibraryComponents
|
||||
import org.jetbrains.kotlin.library.impl.isPre_1_4_Library
|
||||
@@ -223,12 +222,6 @@ abstract class KotlinLibrarySearchPathResolver<L : KotlinLibrary>(
|
||||
}
|
||||
}
|
||||
|
||||
fun CompilerVersion.compatible(other: CompilerVersion) =
|
||||
this.major == other.major
|
||||
&& this.minor == other.minor
|
||||
&& this.maintenance == other.maintenance
|
||||
|
||||
|
||||
// This is a library resolver aware of attributes shared between platforms,
|
||||
// such as abi version.
|
||||
// JS and Native resolvers are inherited from this one.
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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 org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.*
|
||||
import java.io.*
|
||||
import java.util.regex.Pattern
|
||||
import java.util.Properties
|
||||
import org.gradle.api.Project
|
||||
import org.jetbrains.kotlin.konan.*
|
||||
|
||||
|
||||
fun Project.konanVersionGeneratedSrc() =
|
||||
rootProject.findProject(":kotlin-native")?.file("../buildSrc/build/version-generated/src/generated")
|
||||
?: file("build/version-generated/src/generated")
|
||||
|
||||
fun Project.kotlinNativeVersionSrc(): File {
|
||||
val kotlinNativeProject = rootProject.findProject(":kotlin-native")
|
||||
return if (kotlinNativeProject != null) {
|
||||
if (kotlinNativeVersionInResources)
|
||||
kotlinNativeProject.file("${findProperty("kotlin_root")!!}/buildSrc/src/kotlin-native-binary-version/kotlin")
|
||||
else
|
||||
kotlinNativeProject.file("../buildSrc/build/version-generated/src/generated")
|
||||
} else {
|
||||
if (kotlinNativeVersionInResources)
|
||||
file("src/kotlin-native-binary-version/kotlin")
|
||||
else
|
||||
file("build/version-generated/src/generated")
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.konanRootDir() = rootProject.findProject(":kotlin-native")?.projectDir ?: file("../kotlin-native")
|
||||
|
||||
fun Project.kotlinNativeProperties() = Properties().apply {
|
||||
val kotlinNativeProperyFile = File(this@kotlinNativeProperties.konanRootDir(), "gradle.properties")
|
||||
if (!kotlinNativeProperyFile.exists())
|
||||
return@apply
|
||||
FileReader(kotlinNativeProperyFile).use {
|
||||
load(it)
|
||||
}
|
||||
}
|
||||
|
||||
val Project.kotlinNativeVersionInResources: Boolean
|
||||
get() = kotlinNativeProperties()["kotlinNativeVersionInResources"]?.toString()?.toBoolean() ?: false
|
||||
|
||||
fun Project.kotlinNativeVersionResourceFile() = File(
|
||||
"${project.findProperty("kotlin_root")!!}" +
|
||||
"/buildSrc/build/version-generated/META-INF/kotlin-native.compiler.version"
|
||||
)
|
||||
|
||||
fun Project.kotlinNativeVersionValue(): CompilerVersion? {
|
||||
return if (this.kotlinNativeVersionInResources)
|
||||
kotlinNativeVersionResourceFile().let { file ->
|
||||
file.readLines().single().parseCompilerVersion()
|
||||
}
|
||||
else null
|
||||
}
|
||||
|
||||
|
||||
open class VersionGenerator : DefaultTask() {
|
||||
private val kotlinNativeProperties = project.kotlinNativeProperties()
|
||||
|
||||
@Input
|
||||
var kotlinNativeVersionInResources = project.kotlinNativeVersionInResources
|
||||
|
||||
@OutputDirectory
|
||||
val versionSourceDirectory = project.file("build/version-generated")
|
||||
|
||||
@OutputFile
|
||||
open var versionFile: File? = project.file("${versionSourceDirectory.path}/org/jetbrains/kotlin/konan/CompilerVersionGenerated.kt")
|
||||
|
||||
@Input
|
||||
open val konanVersion = project.findProperty("konanVersion") as? String ?: kotlinNativeProperties["konanVersion"].toString()
|
||||
|
||||
|
||||
// TeamCity passes all configuration parameters into a build script as project properties.
|
||||
// Thus we can use them here instead of environment variables.
|
||||
@Optional
|
||||
@Input
|
||||
open val buildNumber = project.findProperty("build.number")?.toString()
|
||||
|
||||
@get:Input
|
||||
open val meta = (project.findProperty("konanMetaVersion") as? String
|
||||
?: kotlinNativeProperties["konanMetaVersion"])?.let { MetaVersion.findAppropriate(it.toString()) }
|
||||
?: MetaVersion.DEV
|
||||
|
||||
fun defaultVersionFileLocation() {
|
||||
versionFile = if (kotlinNativeVersionInResources)
|
||||
project.file("${versionSourceDirectory.path}/META-INF/kotlin-native.compiler.version")
|
||||
else
|
||||
project.file("${versionSourceDirectory.path}/org/jetbrains/kotlin/konan/CompilerVersionGenerated.kt")
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
open fun generateVersion() {
|
||||
val matchResult = CompilerVersion.versionPattern.matchEntire(konanVersion)
|
||||
requireNotNull(matchResult) { "Cannot parse Kotlin/Native version: $konanVersion" }
|
||||
val major = matchResult.groups.get(1)?.value?.toInt() ?: throw IllegalArgumentException("Unable to parse major in $konanVersion")
|
||||
val minor = matchResult.groups.get(2)?.value?.toInt() ?: throw IllegalArgumentException("Unable to parse minor in $konanVersion")
|
||||
val maintenance = matchResult.groups.get(3)?.value?.toInt() ?: 0
|
||||
val milestone = -1 // isn't used any more
|
||||
|
||||
project.logger.info("BUILD_NUMBER: $buildNumber")
|
||||
val buildNumberSplit = buildNumber?.split("-".toRegex())?.toTypedArray()
|
||||
val build = buildNumberSplit?.get(buildNumberSplit.size - 1)?.toIntOrNull() ?: -1
|
||||
|
||||
val versionObject = CompilerVersionImpl(meta, major, minor, maintenance, milestone, build)
|
||||
versionObject.serialize()
|
||||
}
|
||||
|
||||
private fun CompilerVersion.serialize() {
|
||||
versionFile!!.parentFile.mkdirs()
|
||||
project.logger.info("version file: ${versionFile}")
|
||||
if (!kotlinNativeVersionInResources) {
|
||||
PrintWriter(versionFile).use { printWriter ->
|
||||
printWriter.println(
|
||||
"""|package org.jetbrains.kotlin.konan
|
||||
|internal val currentCompilerVersion: CompilerVersion =
|
||||
|CompilerVersionImpl($meta, $major, $minor,
|
||||
| $maintenance, $milestone, $build)
|
||||
|val CompilerVersion.Companion.CURRENT: CompilerVersion
|
||||
|get() = currentCompilerVersion""".trimMargin()
|
||||
)
|
||||
}
|
||||
} else {
|
||||
PrintStream(versionFile).use {
|
||||
it.println(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -11,8 +11,7 @@ import kotlinx.metadata.klib.KlibModuleMetadata
|
||||
import kotlinx.metadata.klib.className
|
||||
import kotlinx.metadata.klib.fqName
|
||||
import org.jetbrains.kotlin.backend.common.serialization.KlibIrVersion
|
||||
import org.jetbrains.kotlin.konan.CURRENT
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.konan.library.impl.KonanLibraryLayoutForWriter
|
||||
import org.jetbrains.kotlin.konan.library.impl.KonanLibraryWriterImpl
|
||||
@@ -41,7 +40,7 @@ fun createInteropLibrary(
|
||||
val version = KotlinLibraryVersioning(
|
||||
libraryVersion = libraryVersion,
|
||||
abiVersion = KotlinAbiVersion.CURRENT,
|
||||
compilerVersion = CompilerVersion.CURRENT.toString(),
|
||||
compilerVersion = KotlinCompilerVersion.VERSION,
|
||||
metadataVersion = KlibMetadataVersion.INSTANCE.toString(),
|
||||
irVersion = KlibIrVersion.INSTANCE.toString()
|
||||
)
|
||||
|
||||
@@ -21,11 +21,8 @@ sourceSets {
|
||||
compiler {
|
||||
kotlin {
|
||||
srcDir 'compiler/ir/backend.native/src/'
|
||||
srcDir(VersionGeneratorKt.kotlinNativeVersionSrc(project))
|
||||
}
|
||||
resources.srcDir 'compiler/ir/backend.native/resources/'
|
||||
/* PATH to META-INF */
|
||||
resources.srcDir VersionGeneratorKt.kotlinNativeVersionResourceFile(project).parentFile.parent
|
||||
}
|
||||
cli_bc {
|
||||
kotlin.srcDir 'cli.bc/src'
|
||||
@@ -235,7 +232,7 @@ publishing {
|
||||
maven(MavenPublication) {
|
||||
groupId = 'org.jetbrains.kotlin'
|
||||
artifactId = 'backend.native'
|
||||
version = konanVersionFull
|
||||
version = kotlinVersion
|
||||
|
||||
from components.java
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.cli.bc
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import org.jetbrains.annotations.Nullable
|
||||
import org.jetbrains.kotlin.analyzer.CompilationErrorException
|
||||
@@ -22,9 +21,8 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.konan.CURRENT
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.library.metadata.KlibMetadataVersion
|
||||
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
@@ -49,7 +47,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
@Nullable paths: KotlinPaths?): ExitCode {
|
||||
|
||||
if (arguments.version) {
|
||||
println("Kotlin/Native: ${CompilerVersion.CURRENT}")
|
||||
println("Kotlin/Native: ${KotlinCompilerVersion.getVersion() ?: "SNAPSHOT"}")
|
||||
return ExitCode.OK
|
||||
}
|
||||
|
||||
@@ -76,7 +74,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
|Compilation failed: ${e.message}
|
||||
|
||||
| * Source files: ${environment.getSourceFiles().joinToString(transform = KtFile::getName)}
|
||||
| * Compiler version info: Konan: ${CompilerVersion.CURRENT} / Kotlin: ${KotlinVersion.CURRENT}
|
||||
| * Compiler version: ${KotlinCompilerVersion.getVersion()}
|
||||
| * Output kind: ${configuration.get(KonanConfigKeys.PRODUCE)}
|
||||
|
||||
""".trimMargin())
|
||||
|
||||
+12
-5
@@ -14,9 +14,7 @@ import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.konan.CURRENT
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.MetaVersion
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.konan.library.KonanLibrary
|
||||
import org.jetbrains.kotlin.konan.properties.loadProperties
|
||||
@@ -171,8 +169,8 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
get() = configuration.get(KonanConfigKeys.VERIFY_IR) == true
|
||||
|
||||
val needCompilerVerification: Boolean
|
||||
get() = configuration.get(KonanConfigKeys.VERIFY_COMPILER) ?:
|
||||
(optimizationsEnabled || CompilerVersion.CURRENT.meta != MetaVersion.RELEASE)
|
||||
get() = configuration.get(KonanConfigKeys.VERIFY_COMPILER)
|
||||
?: (optimizationsEnabled || !KotlinCompilerVersion.VERSION.isRelease())
|
||||
|
||||
val appStateTracking: AppStateTracking by lazy {
|
||||
configuration.get(BinaryOptions.appStateTracking) ?: AppStateTracking.DISABLED
|
||||
@@ -508,3 +506,12 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
|
||||
fun CompilerConfiguration.report(priority: CompilerMessageSeverity, message: String)
|
||||
= this.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report(priority, message)
|
||||
|
||||
private fun String.isRelease(): Boolean {
|
||||
// major.minor.patch-meta-build where patch, meta and build are optional.
|
||||
val versionPattern = "(\\d+)\\.(\\d+)(?:\\.(\\d+))?(?:-(\\p{Alpha}*\\p{Alnum}|[\\p{Alpha}-]*))?(?:-(\\d+))?".toRegex()
|
||||
val (_, _, _, metaString, build) = versionPattern.matchEntire(this)?.destructured
|
||||
?: throw IllegalStateException("Cannot parse Kotlin/Native version: $this")
|
||||
|
||||
return metaString.isEmpty() && build.isEmpty()
|
||||
}
|
||||
+2
-3
@@ -10,8 +10,7 @@ import org.jetbrains.kotlin.backend.konan.KonanConfigKeys
|
||||
import org.jetbrains.kotlin.backend.konan.OutputFiles
|
||||
import org.jetbrains.kotlin.backend.konan.driver.PhaseContext
|
||||
import org.jetbrains.kotlin.backend.konan.driver.PhaseEngine
|
||||
import org.jetbrains.kotlin.konan.CURRENT
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.konan.library.impl.buildLibrary
|
||||
import org.jetbrains.kotlin.library.KotlinAbiVersion
|
||||
import org.jetbrains.kotlin.library.KotlinLibraryVersioning
|
||||
@@ -28,7 +27,7 @@ internal val WriteKlibPhase = createSimpleNamedCompilerPhase<PhaseContext, Seria
|
||||
val libraryName = config.moduleId
|
||||
val shortLibraryName = config.shortModuleName
|
||||
val abiVersion = KotlinAbiVersion.CURRENT
|
||||
val compilerVersion = CompilerVersion.CURRENT.toString()
|
||||
val compilerVersion = KotlinCompilerVersion.getVersion().toString()
|
||||
val libraryVersion = configuration.get(KonanConfigKeys.LIBRARY_VERSION)
|
||||
val metadataVersion = KlibMetadataVersion.INSTANCE.toString()
|
||||
val irVersion = KlibIrVersion.INSTANCE.toString()
|
||||
|
||||
+1
-3
@@ -19,12 +19,10 @@ import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET
|
||||
import org.jetbrains.kotlin.ir.util.isTypeParameter
|
||||
import org.jetbrains.kotlin.ir.util.isUnsigned
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
import org.jetbrains.kotlin.konan.CURRENT
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
|
||||
internal object DWARF {
|
||||
val producer = "konanc ${CompilerVersion.CURRENT} / kotlin-compiler: ${KotlinVersion.CURRENT}"
|
||||
val producer = "kotlin-compiler: ${KotlinVersion.CURRENT}"
|
||||
const val debugInfoVersion = 3 /* TODO: configurable? */
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,14 +29,13 @@ val rootProperties = Properties().apply {
|
||||
}
|
||||
|
||||
val kotlinVersion = project.bootstrapKotlinVersion
|
||||
val konanVersion: String by rootProperties
|
||||
val slackApiVersion: String by rootProperties
|
||||
val ktorVersion: String by rootProperties
|
||||
val shadowVersion: String by rootProperties
|
||||
val metadataVersion: String by rootProperties
|
||||
|
||||
group = "org.jetbrains.kotlin"
|
||||
version = konanVersion
|
||||
version = kotlinVersion
|
||||
|
||||
repositories {
|
||||
maven("https://cache-redirector.jetbrains.com/maven-central")
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.konan.util.*
|
||||
import org.jetbrains.kotlin.CopySamples
|
||||
import org.jetbrains.kotlin.CopyCommonSources
|
||||
import org.jetbrains.kotlin.PlatformInfo
|
||||
import org.jetbrains.kotlin.KotlinBuildPusher
|
||||
import org.jetbrains.kotlin.cpp.CompilationDatabasePlugin
|
||||
import org.jetbrains.kotlin.cpp.CppUsage
|
||||
import org.jetbrains.kotlin.cpp.GitClangFormatPlugin
|
||||
@@ -84,9 +83,6 @@ ext {
|
||||
kotlinScriptRuntimeModule= project(":kotlin-script-runtime")
|
||||
kotlinUtilKliMetadatabModule= project(":kotlin-util-klib-metadata")
|
||||
|
||||
konanVersionFull = ext.kotlinNativeVersion
|
||||
gradlePluginVersion = konanVersionFull
|
||||
|
||||
// A separate map for each build for automatic cleaning the daemon after the build have finished.
|
||||
toolClassLoadersMap = new ConcurrentHashMap<Object, URLClassLoader>()
|
||||
}
|
||||
@@ -314,7 +310,7 @@ task distCompiler(type: Copy) {
|
||||
from(project.file('konan')) {
|
||||
into('konan')
|
||||
include('**/*.properties')
|
||||
filter(ReplaceTokens, tokens: [compilerVersion: konanVersionFull.toString()])
|
||||
filter(ReplaceTokens, tokens: [compilerVersion: kotlinVersion])
|
||||
// Set LLVM variant that will be used by default in the distribution.
|
||||
// `user` - smaller, includes only necessary components.
|
||||
// `dev` - bigger, includes (almost) every possible component. Use this one,
|
||||
@@ -559,7 +555,7 @@ task bundle {
|
||||
task bundleRegular(type: (isWindows()) ? Zip : Tar) {
|
||||
def simpleOsName = HostManager.platformName()
|
||||
archiveBaseName.set("kotlin-native-$simpleOsName")
|
||||
archiveVersion.set(konanVersionFull.toString())
|
||||
archiveVersion.set(kotlinVersion)
|
||||
from(UtilsKt.getKotlinNativeDist(project)) {
|
||||
include '**'
|
||||
exclude 'dependencies'
|
||||
@@ -576,7 +572,7 @@ task bundlePrebuilt(type: (isWindows()) ? Zip : Tar) {
|
||||
dependsOn("crossDistPlatformLibs")
|
||||
def simpleOsName = HostManager.platformName()
|
||||
archiveBaseName.set("kotlin-native-prebuilt-$simpleOsName")
|
||||
archiveVersion.set(konanVersionFull.toString())
|
||||
archiveVersion.set(kotlinVersion)
|
||||
from(UtilsKt.getKotlinNativeDist(project)) {
|
||||
include '**'
|
||||
exclude 'dependencies'
|
||||
@@ -631,7 +627,7 @@ task 'tc-dist'(type: (isWindows()) ? Zip : Tar) {
|
||||
dependsOn('distSources')
|
||||
def simpleOsName = HostManager.platformName()
|
||||
archiveBaseName.set("kotlin-native-dist-$simpleOsName")
|
||||
archiveVersion.set(konanVersionFull.toString())
|
||||
archiveVersion.set(kotlinVersion)
|
||||
from(UtilsKt.getKotlinNativeDist(project)) {
|
||||
include '**'
|
||||
exclude 'dependencies'
|
||||
@@ -659,7 +655,7 @@ task samplesTar(type: Tar) {
|
||||
}
|
||||
|
||||
configure([samplesZip, samplesTar]) {
|
||||
baseName "kotlin-native-samples-$konanVersionFull"
|
||||
baseName "kotlin-native-samples-$kotlinVersion"
|
||||
destinationDir = projectDir
|
||||
into(baseName)
|
||||
|
||||
@@ -694,54 +690,6 @@ project.tasks.register("copySamples", CopySamples) {
|
||||
destinationDir file('build/samples-under-test')
|
||||
}
|
||||
|
||||
task uploadBundle {
|
||||
dependsOn ':kotlin-native:bundle'
|
||||
if (isMac()) {
|
||||
dependsOn ':kotlin-native:bundleRestricted'
|
||||
}
|
||||
doLast {
|
||||
def kind = (konanVersionFull.meta == MetaVersion.DEV) ? "dev" : "releases"
|
||||
def ftpSettings = [
|
||||
server: project.findProperty("cdnUrl") ?: System.getenv("CDN_URL"),
|
||||
userid: project.findProperty("cdnUser") ?: System.getenv("CDN_USER"),
|
||||
password: project.findProperty("cdnPass") ?: System.getenv("CDN_PASS"),
|
||||
remoteDir: "/builds/$kind/$konanVersion/${HostManager.platformName()}"
|
||||
]
|
||||
ant {
|
||||
taskdef(name: 'ftp',
|
||||
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
|
||||
classpath: configurations.ftpAntTask.asPath)
|
||||
ftp([action: "mkdir"] + ftpSettings)
|
||||
ftp(ftpSettings) {
|
||||
fileset(file: bundle.archivePath)
|
||||
}
|
||||
if (isMac()) {
|
||||
ftp(ftpSettings) {
|
||||
fileset(file: bundleRestricted.archivePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task teamcityCompilerVersion {
|
||||
doLast {
|
||||
println("##teamcity[setParameter name='kotlin.native.version.base' value='$konanVersion']")
|
||||
println("##teamcity[setParameter name='kotlin.native.version.full' value='$konanVersionFull']")
|
||||
println("##teamcity[setParameter name='kotlin.native.version.meta' value='${konanVersionFull.meta.toString().toLowerCase()}']")
|
||||
println("##teamcity[buildNumber '${konanVersionFull.toString(true, true)}']")
|
||||
}
|
||||
}
|
||||
|
||||
task pusher(type: KotlinBuildPusher){
|
||||
kotlinVersion = project.kotlinVersion
|
||||
konanVersion = project.ext.kotlinNativeVersion
|
||||
buildServer = "buildserver.labs.intellij.net"
|
||||
compilerConfigurationId = System.getenv("TEAMCITY_COMPILER_ID") ?: "Kotlin_KotlinDev_Compiler"
|
||||
overrideConfigurationId = System.getenv("TEAMCITY_OVERRIDE_NATIVE_ID") ?: "Kotlin_KotlinDev_DeployMavenArtifacts_OverrideNative"
|
||||
token = project.findProperty("teamcityBearToken") ?: System.getenv("TEAMCITY_BEAR_TOKEN")
|
||||
}
|
||||
|
||||
compilationDatabase {
|
||||
allTargets {}
|
||||
}
|
||||
@@ -812,7 +760,7 @@ Map<KonanTarget, File> createConfigurations(List<File> bundles) {
|
||||
throw new IllegalArgumentException("Bundle archives are missing for $missingBundles")
|
||||
}
|
||||
result.each { target, file ->
|
||||
if (!file.name.contains(konanVersionFull.toString())) {
|
||||
if (!file.name.contains(kotlinVersion)) {
|
||||
throw new IllegalArgumentException("Incorrect version specified for the publish: ${file.name}")
|
||||
}
|
||||
}
|
||||
@@ -844,7 +792,7 @@ publishing {
|
||||
register("Bundle", MavenPublication) { mvn ->
|
||||
mvn.groupId = project.group.toString()
|
||||
mvn.artifactId = project.name
|
||||
mvn.version = konanVersionFull
|
||||
mvn.version = kotlinVersion
|
||||
|
||||
if (publishBundlesFromLocation) {
|
||||
def bundleArchives = bundlesLocationFiles
|
||||
@@ -873,7 +821,7 @@ publishing {
|
||||
register("BundlePrebuilt", MavenPublication) { mvn ->
|
||||
mvn.groupId = project.group.toString()
|
||||
mvn.artifactId = project.name + "-prebuilt"
|
||||
mvn.version = konanVersionFull
|
||||
mvn.version = kotlinVersion
|
||||
|
||||
if (publishBundlesFromLocation) {
|
||||
def prebuiltBundleArchives = bundlesLocationFiles
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
# A version of the Kotlin compiler that is used to build Kotlin/Native.
|
||||
remoteRoot=konan_tests
|
||||
konanVersion=1.6.0
|
||||
|
||||
# A version of Xcode required to build the Kotlin/Native compiler.
|
||||
xcodeMajorVersion=14
|
||||
@@ -33,5 +32,3 @@ slackApiVersion=1.2.0
|
||||
ktorVersion=1.2.1
|
||||
shadowVersion=7.1.2
|
||||
metadataVersion=0.0.1-dev-10
|
||||
|
||||
kotlinNativeVersionInResources=true
|
||||
|
||||
@@ -38,9 +38,6 @@ ext.kotlin_root = project.file("../..").absolutePath
|
||||
project.logger.info("kotlin_root: $kotlin_root")
|
||||
globalProperties.load(new java.io.FileReader(project.file("$kotlin_root/gradle.properties")))
|
||||
ext.kotlinNativeVersionInResources = true
|
||||
//TODO: fix VersionGeneratorKt.kotlinNativeVersionValue(project)
|
||||
def versionString = VersionGeneratorKt.kotlinNativeVersionResourceFile(project).readLines().first()
|
||||
def kotlinNativeVersionObject = CompilerVersionKt.parseCompilerVersion(versionString)
|
||||
|
||||
def platformManager = new PlatformManager(DistributionKt.buildDistribution(UtilsKt.getKotlinNativeDist(project).path), false)
|
||||
def kotlinDist = null
|
||||
@@ -67,10 +64,8 @@ subprojects { proj ->
|
||||
proj.ext["bootstrapKotlinVersion"] = BootstrapKt.getBootstrapKotlinVersion(proj)
|
||||
proj.ext["kotlin.native.home"] = proj.projectDir.relativePath(UtilsKt.getKotlinNativeDist(project))
|
||||
proj.ext["konan.home"] = proj.ext["kotlin.native.home"]
|
||||
proj.ext["konanVersion"] = kotlinNativeVersionObject.toString()
|
||||
proj.ext["kotlin.native.enabled"] = true
|
||||
proj.logger.info("${proj.name}<<<[kotlin.native.home] = ${proj.ext["kotlin.native.home"]}")
|
||||
proj.logger.info("${proj.name}<<<[konanVersion] = ${proj.ext["konanVersion"]}>>>")
|
||||
if (project.hasProperty("kotlin_dist")) {
|
||||
proj.ext["kotlin_dist"] = kotlinDist.path
|
||||
proj.logger.info("${proj.name}<<<[kotlin_dist] = ${proj.ext["kotlin_dist"]}>>>")
|
||||
@@ -80,6 +75,7 @@ subprojects { proj ->
|
||||
proj.ext["kotlinVersion"] = findProperty("deployVersion")?.toString()?.identity { deploySnapshotStr ->
|
||||
if (deploySnapshotStr != "default.snapshot") deploySnapshotStr else defaultSnapshotVersion
|
||||
} ?: proj.ext["buildNumber"]
|
||||
proj.logger.info("${proj.name}<<<[kotlinVersion] = ${proj.ext["kotlinVersion"]}>>>")
|
||||
|
||||
proj.repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -7,5 +7,4 @@ import org.gradle.api.Project
|
||||
fun Project.kotlinInit(cacheRedirectorEnabled: Boolean) {
|
||||
extensions.extraProperties["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
|
||||
extensions.extraProperties["kotlinVersion"] = findProperty("kotlinVersion")
|
||||
extensions.extraProperties["konanVersion"] = findProperty("konanVersion")
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ task konanJsonReport {
|
||||
"linkBenchmarksAnalyzerDebugFrameworkMacos${archSuffix}".toString(),
|
||||
"cinteropLibcurlMacos${archSuffix}".toString()])
|
||||
def properties = getCommonProperties() + ['type' : 'native',
|
||||
'compilerVersion': "${konanVersion}".toString(),
|
||||
'compilerVersion': "${kotlinVersion}".toString(),
|
||||
'flags' : compilerFlags(buildType).sort(),
|
||||
'benchmarks' : '[]',
|
||||
'compileTime' : [nativeCompileTime],
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
package org.jetbrains.kotlin.konan.library
|
||||
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.konan.library.impl.KonanLibraryImpl
|
||||
import org.jetbrains.kotlin.konan.library.impl.createKonanLibraryComponents
|
||||
|
||||
@@ -32,7 +32,7 @@ buildscript {
|
||||
|
||||
dependencies {
|
||||
classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion"
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-shared:$kotlinVersion"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ dependencies {
|
||||
bundleDependencies "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
bundleDependencies "org.jetbrains.kotlin:kotlin-gradle-plugin-api:$kotlinVersion"
|
||||
bundleDependencies "org.jetbrains.kotlin:kotlin-native-utils:$kotlinVersion"
|
||||
bundleDependencies "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion"
|
||||
bundleDependencies "org.jetbrains.kotlin:kotlin-native-shared:$kotlinVersion"
|
||||
bundleDependencies "org.jetbrains.kotlin:kotlin-util-io:$kotlinVersion"
|
||||
bundleDependencies "org.jetbrains.kotlin:kotlin-util-klib:$kotlinVersion"
|
||||
|
||||
|
||||
-1
@@ -25,7 +25,6 @@ import org.gradle.api.tasks.Internal
|
||||
import org.jetbrains.kotlin.gradle.plugin.tasks.KonanArtifactWithLibrariesTask
|
||||
import org.jetbrains.kotlin.gradle.plugin.tasks.KonanBuildingTask
|
||||
import org.jetbrains.kotlin.konan.*
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.library.defaultResolver
|
||||
import org.jetbrains.kotlin.konan.library.impl.KonanLibraryImpl
|
||||
import org.jetbrains.kotlin.konan.target.Distribution
|
||||
|
||||
+6
-7
@@ -41,8 +41,6 @@ import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.plugin.konan.KonanPlugin.Companion.COMPILE_ALL_TASK_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.tasks.*
|
||||
import org.jetbrains.kotlin.konan.CURRENT
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.buildDistribution
|
||||
@@ -95,10 +93,11 @@ internal val Project.konanHome: String
|
||||
return project.kotlinNativeDist.absolutePath
|
||||
}
|
||||
|
||||
internal val Project.konanVersion: CompilerVersion
|
||||
// Used only for distribution downloading that is not used in the project and should be removed
|
||||
internal val Project.konanVersion: String
|
||||
get() = project.findProperty(KonanPlugin.ProjectProperty.KONAN_VERSION)
|
||||
?.toString()?.let { CompilerVersion.fromString(it) }
|
||||
?: project.findProperty("kotlinNativeVersion") as? CompilerVersion ?: CompilerVersion.CURRENT
|
||||
?.toString()
|
||||
?: project.version.toString()
|
||||
|
||||
internal val Project.konanBuildRoot get() = buildDir.resolve("konan")
|
||||
internal val Project.konanBinBaseDir get() = konanBuildRoot.resolve("bin")
|
||||
@@ -239,7 +238,7 @@ internal fun dumpProperties(task: Task) {
|
||||
println("target : $target")
|
||||
println("languageVersion : $languageVersion")
|
||||
println("apiVersion : $apiVersion")
|
||||
println("konanVersion : ${CompilerVersion.CURRENT}")
|
||||
println("konanVersion : ${KotlinVersion.CURRENT}")
|
||||
println("konanHome : $konanHome")
|
||||
println()
|
||||
}
|
||||
@@ -260,7 +259,7 @@ internal fun dumpProperties(task: Task) {
|
||||
println("linkerOpts : $linkerOpts")
|
||||
println("headers : ${headers.dump()}")
|
||||
println("linkFiles : ${linkFiles.dump()}")
|
||||
println("konanVersion : ${CompilerVersion.CURRENT}")
|
||||
println("konanVersion : ${KotlinVersion.CURRENT}")
|
||||
println("konanHome : $konanHome")
|
||||
println()
|
||||
}
|
||||
|
||||
-3
@@ -44,9 +44,6 @@ abstract class KonanBuildingTask: KonanArtifactWithLibrariesTask(), KonanBuildin
|
||||
val konanHome
|
||||
@Input get() = project.konanHome
|
||||
|
||||
val konanVersion
|
||||
@Input get() = project.konanVersion.toString(true, true)
|
||||
|
||||
@TaskAction
|
||||
abstract fun run()
|
||||
|
||||
|
||||
+3
-5
@@ -36,7 +36,8 @@ open class KonanCompilerDownloadTask : DefaultTask() {
|
||||
/**
|
||||
* If true the task will also download dependencies for targets specified by the konan.targets project extension.
|
||||
*/
|
||||
@Internal var downloadDependencies: Boolean = false
|
||||
@Internal
|
||||
var downloadDependencies: Boolean = false
|
||||
|
||||
@TaskAction
|
||||
fun downloadAndExtract() {
|
||||
@@ -48,10 +49,7 @@ open class KonanCompilerDownloadTask : DefaultTask() {
|
||||
val downloadUrlDirectory = buildString {
|
||||
append("$BASE_DOWNLOAD_URL/")
|
||||
val version = project.konanVersion
|
||||
when (version.meta) {
|
||||
MetaVersion.DEV -> append("dev/")
|
||||
else -> append("releases/")
|
||||
}
|
||||
if (version.contains("-dev-")) append("dev/") else append("releases/")
|
||||
append("$version/")
|
||||
append(project.simpleOsName)
|
||||
}
|
||||
|
||||
+17
-82
@@ -14,10 +14,6 @@ import org.jetbrains.kotlin.gradle.transformProjectWithPluginsDsl
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.jetbrains.kotlin.gradle.utils.NativeCompilerDownloader
|
||||
import org.jetbrains.kotlin.gradle.utils.Xcode
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.CompilerVersionImpl
|
||||
import org.jetbrains.kotlin.konan.MetaVersion
|
||||
import org.jetbrains.kotlin.konan.isAtLeast
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.presetName
|
||||
@@ -46,7 +42,6 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
override val defaultGradleVersion: GradleVersionRequired
|
||||
get() = GradleVersionRequired.FOR_MPP_SUPPORT
|
||||
|
||||
private val oldCompilerVersion = "1.3.61"
|
||||
private val currentCompilerVersion = NativeCompilerDownloader.DEFAULT_KONAN_VERSION
|
||||
|
||||
private fun platformLibrariesProject(vararg targets: String): Project =
|
||||
@@ -62,26 +57,16 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun simpleOsName(compilerVersion: CompilerVersion): String =
|
||||
if (compilerVersion.isAtLeast(CompilerVersionImpl(major = 1, minor = 5, maintenance = 30, build = 1466))) {
|
||||
HostManager.platformName()
|
||||
} else {
|
||||
HostManager.simpleOsName()
|
||||
}
|
||||
private val platformName: String = HostManager.platformName()
|
||||
|
||||
@BeforeTest
|
||||
fun deleteInstalledCompilers() {
|
||||
val oldOsName = simpleOsName(CompilerVersion.fromString(oldCompilerVersion))
|
||||
val currentOsName = simpleOsName(currentCompilerVersion)
|
||||
|
||||
val oldCompilerDir = DependencyDirectories.localKonanDir
|
||||
.resolve("kotlin-native-$oldOsName-$oldCompilerVersion")
|
||||
val currentCompilerDir = DependencyDirectories.localKonanDir
|
||||
.resolve("kotlin-native-$currentOsName-$currentCompilerVersion")
|
||||
.resolve("kotlin-native-$platformName-$currentCompilerVersion")
|
||||
val prebuiltDistDir = DependencyDirectories.localKonanDir
|
||||
.resolve("kotlin-native-prebuilt-$currentOsName-$currentCompilerVersion")
|
||||
.resolve("kotlin-native-prebuilt-$platformName-$currentCompilerVersion")
|
||||
|
||||
for (compilerDirectory in listOf(oldCompilerDir, currentCompilerDir, prebuiltDistDir)) {
|
||||
for (compilerDirectory in listOf(currentCompilerDir, prebuiltDistDir)) {
|
||||
compilerDirectory.deleteRecursively()
|
||||
}
|
||||
}
|
||||
@@ -89,19 +74,6 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
private fun Project.buildWithLightDist(vararg tasks: String, check: CompiledProject.() -> Unit) =
|
||||
build(*tasks, "-Pkotlin.native.distribution.type=light", check = check)
|
||||
|
||||
@Test
|
||||
fun testNoGenerationForOldCompiler() = with(platformLibrariesProject("linuxX64")) {
|
||||
// Check that we don't run the library generator for old compiler distributions where libraries are prebuilt.
|
||||
// Don't run the build to reduce execution time.
|
||||
build("tasks", "-Pkotlin.native.version=$oldCompilerVersion") {
|
||||
assertSuccessful()
|
||||
assertContains("Unpack Kotlin/Native compiler to ")
|
||||
val osName = simpleOsName(CompilerVersion.fromString(oldCompilerVersion))
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-$osName".toRegex())
|
||||
assertNotContains("Generate platform libraries for ")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNoGenerationByDefault() = with(platformLibrariesProject("linuxX64")) {
|
||||
|
||||
@@ -109,8 +81,7 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
// Check that a prebuilt distribution is used by default.
|
||||
build("assemble") {
|
||||
assertSuccessful()
|
||||
val osName = simpleOsName(currentCompilerVersion)
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-prebuilt-$osName".toRegex())
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-prebuilt-$platformName".toRegex())
|
||||
assertNotContains("Generate platform libraries for ")
|
||||
}
|
||||
}
|
||||
@@ -132,8 +103,7 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
// Check that platform libraries are correctly generated for both root project and a subproject.
|
||||
buildWithLightDist("assemble") {
|
||||
assertSuccessful()
|
||||
val osName = simpleOsName(currentCompilerVersion)
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-$osName".toRegex())
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-$platformName".toRegex())
|
||||
assertContains("Generate platform libraries for linux_x64")
|
||||
assertContains("Generate platform libraries for linux_arm64")
|
||||
}
|
||||
@@ -196,57 +166,18 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
fun testCanUsePrebuiltDistribution() = with(platformLibrariesProject("linuxX64")) {
|
||||
build("assemble", "-Pkotlin.native.distribution.type=prebuilt") {
|
||||
assertSuccessful()
|
||||
val osName = simpleOsName(currentCompilerVersion)
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-prebuilt-$osName".toRegex())
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-prebuilt-$platformName".toRegex())
|
||||
assertNotContains("Generate platform libraries for ")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDeprecatedRestrictedDistributionProperty() = with(platformLibrariesProject("linuxX64")) {
|
||||
build("tasks", "-Pkotlin.native.restrictedDistribution=true", "-Pkotlin.native.version=$oldCompilerVersion") {
|
||||
assertSuccessful()
|
||||
assertContains("Warning: Project property 'kotlin.native.restrictedDistribution' is deprecated. Please use 'kotlin.native.distribution.type=light' instead")
|
||||
|
||||
val osName = simpleOsName(CompilerVersion.fromString(oldCompilerVersion))
|
||||
val regex = "Kotlin/Native distribution: .*kotlin-native-restricted-$osName".toRegex()
|
||||
// Restricted distribution is available for Mac hosts only.
|
||||
if (HostManager.hostIsMac) {
|
||||
assertContainsRegex(regex)
|
||||
} else {
|
||||
assertNotContains(regex)
|
||||
}
|
||||
}
|
||||
|
||||
// We allow using this deprecated property for 1.4 too. Just download the distribution without platform libs in this case.
|
||||
build("tasks", "-Pkotlin.native.restrictedDistribution=true") {
|
||||
assertSuccessful()
|
||||
val osName = simpleOsName(currentCompilerVersion)
|
||||
assertContains("Warning: Project property 'kotlin.native.restrictedDistribution' is deprecated. Please use 'kotlin.native.distribution.type=light' instead")
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-$osName".toRegex())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSettingDistributionTypeForOldCompiler() = with(platformLibrariesProject("linuxX64")) {
|
||||
build("tasks", "-Pkotlin.native.distribution.type=prebuilt", "-Pkotlin.native.version=$oldCompilerVersion") {
|
||||
assertSuccessful()
|
||||
val osName = simpleOsName(CompilerVersion.fromString(oldCompilerVersion))
|
||||
val regex = "Kotlin/Native distribution: .*kotlin-native-$osName".toRegex()
|
||||
assertContainsRegex(regex)
|
||||
}
|
||||
|
||||
build("tasks", "-Pkotlin.native.distribution.type=light", "-Pkotlin.native.version=$oldCompilerVersion") {
|
||||
assertSuccessful()
|
||||
|
||||
val osName = simpleOsName(CompilerVersion.fromString(oldCompilerVersion))
|
||||
val regex = "Kotlin/Native distribution: .*kotlin-native-restricted-$osName".toRegex()
|
||||
// Restricted distribution is available for Mac hosts only.
|
||||
if (HostManager.hostIsMac) {
|
||||
assertContainsRegex(regex)
|
||||
} else {
|
||||
assertNotContains(regex)
|
||||
}
|
||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-$platformName".toRegex())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,11 +206,15 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun mavenUrl(): String = when (currentCompilerVersion.meta) {
|
||||
MetaVersion.DEV -> KOTLIN_SPACE_DEV
|
||||
MetaVersion.RELEASE, MetaVersion.RC, MetaVersion("RC2"), MetaVersion.BETA ->
|
||||
if (currentCompilerVersion.build != -1) KOTLIN_SPACE_DEV else MAVEN_CENTRAL
|
||||
else -> throw IllegalStateException("Not a published version $currentCompilerVersion")
|
||||
private fun mavenUrl(): String {
|
||||
val versionPattern = "(\\d+)\\.(\\d+)(?:\\.(\\d+))?(?:-(\\p{Alpha}*\\p{Alnum}|[\\p{Alpha}-]*))?(?:-(\\d+))?".toRegex()
|
||||
val (_, _, _, metaString, build) = versionPattern.matchEntire(currentCompilerVersion)?.destructured
|
||||
?: error("Unable to parse version $currentCompilerVersion")
|
||||
return when {
|
||||
metaString == "dev" || build.isNotEmpty() -> KOTLIN_SPACE_DEV
|
||||
metaString in listOf("RC", "RC2", "Beta") || metaString.isEmpty() -> MAVEN_CENTRAL
|
||||
else -> throw IllegalStateException("Not a published version $currentCompilerVersion")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-14
@@ -12,11 +12,9 @@ import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
||||
import org.jetbrains.kotlin.gradle.dsl.NativeCacheOrchestration
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.useXcodeMessageStyle
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.isAtLeast
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.nativeUseEmbeddableCompilerJar
|
||||
import org.jetbrains.kotlin.gradle.targets.native.KonanPropertiesBuildService
|
||||
import org.jetbrains.kotlin.gradle.utils.NativeCompilerDownloader
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.properties.resolvablePropertyString
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
@@ -35,8 +33,8 @@ internal val Project.konanHome: String
|
||||
internal val Project.disableKonanDaemon: Boolean
|
||||
get() = PropertiesProvider(this).nativeDisableCompilerDaemon == true
|
||||
|
||||
internal val Project.konanVersion: CompilerVersion
|
||||
get() = PropertiesProvider(this).nativeVersion?.let { CompilerVersion.fromString(it) }
|
||||
internal val Project.konanVersion: String
|
||||
get() = PropertiesProvider(this).nativeVersion
|
||||
?: NativeCompilerDownloader.DEFAULT_KONAN_VERSION
|
||||
|
||||
internal fun Project.getKonanCacheKind(target: KonanTarget): NativeCacheKind {
|
||||
@@ -67,7 +65,7 @@ internal abstract class KotlinNativeToolRunner(
|
||||
) : KotlinToolRunner(executionContext) {
|
||||
|
||||
class Settings(
|
||||
val konanVersion: CompilerVersion,
|
||||
val konanVersion: String,
|
||||
val konanHome: String,
|
||||
val konanPropertiesFile: File,
|
||||
val useXcodeMessageStyle: Boolean,
|
||||
@@ -102,16 +100,8 @@ internal abstract class KotlinNativeToolRunner(
|
||||
}
|
||||
|
||||
final override val execSystemProperties by lazy {
|
||||
// Still set konan.home for versions prior to 1.4-M3.
|
||||
val konanHomeRequired = !settings.konanVersion.isAtLeast(1, 4, 0) ||
|
||||
settings.konanVersion.toString(showMeta = false, showBuild = false) in listOf("1.4-M1", "1.4-M2")
|
||||
|
||||
val messageRenderer = if (settings.useXcodeMessageStyle) MessageRenderer.XCODE_STYLE else MessageRenderer.GRADLE_STYLE
|
||||
|
||||
listOfNotNull(
|
||||
if (konanHomeRequired) "konan.home" to settings.konanHome else null,
|
||||
MessageRenderer.PROPERTY_KEY to messageRenderer.name
|
||||
).toMap()
|
||||
mapOf(MessageRenderer.PROPERTY_KEY to messageRenderer.name)
|
||||
}
|
||||
|
||||
final override val classpath get() = settings.classpath.files
|
||||
|
||||
-7
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.gradle.targets.native.DisabledNativeTargetsReporter
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.*
|
||||
import org.jetbrains.kotlin.gradle.utils.SingleActionPerProject
|
||||
import org.jetbrains.kotlin.gradle.utils.setupNativeCompiler
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
|
||||
@@ -119,9 +118,3 @@ internal val KonanTarget.isCurrentHost: Boolean
|
||||
|
||||
internal val KonanTarget.enabledOnCurrentHost
|
||||
get() = HostManager().isEnabled(this)
|
||||
|
||||
// KonanVersion doesn't provide an API to compare versions,
|
||||
// so we have to transform it to KotlinVersion first.
|
||||
// Note: this check doesn't take into account the meta version (release, eap, dev).
|
||||
internal fun CompilerVersion.isAtLeast(major: Int, minor: Int, patch: Int): Boolean =
|
||||
KotlinVersion(this.major, this.minor, this.maintenance).isAtLeast(major, minor, patch)
|
||||
|
||||
+5
-15
@@ -19,10 +19,6 @@ import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.Companion.kotlinPro
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionType
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionTypeProvider
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.PlatformLibrariesGenerator
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.CompilerVersionImpl
|
||||
import org.jetbrains.kotlin.konan.MetaVersion
|
||||
import org.jetbrains.kotlin.konan.isAtLeast
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.util.DependencyDirectories
|
||||
@@ -31,12 +27,12 @@ import java.nio.file.Files
|
||||
|
||||
class NativeCompilerDownloader(
|
||||
val project: Project,
|
||||
private val compilerVersion: CompilerVersion = project.konanVersion
|
||||
private val compilerVersion: String = project.konanVersion
|
||||
) {
|
||||
|
||||
companion object {
|
||||
val DEFAULT_KONAN_VERSION: CompilerVersion by lazy {
|
||||
CompilerVersion.fromString(loadPropertyFromResources("project.properties", "kotlin.native.version"))
|
||||
val DEFAULT_KONAN_VERSION: String by lazy {
|
||||
loadPropertyFromResources("project.properties", "kotlin.native.version")
|
||||
}
|
||||
|
||||
internal const val BASE_DOWNLOAD_URL = "https://download.jetbrains.com/kotlin/native/builds"
|
||||
@@ -55,13 +51,7 @@ class NativeCompilerDownloader(
|
||||
get() = NativeDistributionTypeProvider(project).getDistributionType(compilerVersion)
|
||||
|
||||
private val simpleOsName: String
|
||||
get() {
|
||||
return if (compilerVersion.isAtLeast(CompilerVersionImpl(major = 1, minor = 5, maintenance = 30, build = 1466))) {
|
||||
HostManager.platformName()
|
||||
} else {
|
||||
HostManager.simpleOsName()
|
||||
}
|
||||
}
|
||||
get() = HostManager.platformName()
|
||||
|
||||
private val dependencyName: String
|
||||
get() {
|
||||
@@ -115,7 +105,7 @@ class NativeCompilerDownloader(
|
||||
private val repoUrl by lazy {
|
||||
buildString {
|
||||
append("${kotlinProperties.nativeBaseDownloadUrl}/")
|
||||
append(if (compilerVersion.meta == MetaVersion.DEV) "dev/" else "releases/")
|
||||
append(if (compilerVersion.contains("-dev-")) "dev/" else "releases/")
|
||||
append("$compilerVersion/")
|
||||
append(simpleOsName)
|
||||
}
|
||||
|
||||
+2
-13
@@ -7,11 +7,8 @@ package org.jetbrains.kotlin.gradle.targets.native.internal
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.isAtLeast
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionType.*
|
||||
import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||
|
||||
internal enum class NativeDistributionType(val suffix: String?, val mustGeneratePlatformLibs: Boolean) {
|
||||
@@ -59,19 +56,11 @@ internal class NativeDistributionTypeProvider(private val project: Project) {
|
||||
}
|
||||
}
|
||||
|
||||
fun getDistributionType(version: CompilerVersion): NativeDistributionType {
|
||||
fun getDistributionType(version: String): NativeDistributionType {
|
||||
if (propertiesProvider.nativeDeprecatedRestricted != null) {
|
||||
warning("Project property 'kotlin.native.restrictedDistribution' is deprecated. Please use 'kotlin.native.distribution.type=light' instead")
|
||||
}
|
||||
|
||||
return if (version.isAtLeast(1, 4, 0)) {
|
||||
chooseDistributionType(prebuiltType = PREBUILT, lightType = LIGHT, defaultType = PREBUILT)
|
||||
} else {
|
||||
// In 1.3, the distribution type can be chosen for Mac hosts only.
|
||||
if (!HostManager.hostIsMac) {
|
||||
return PREBUILT_1_3
|
||||
}
|
||||
chooseDistributionType(prebuiltType = PREBUILT_1_3, lightType = LIGHT_1_3, defaultType = PREBUILT_1_3)
|
||||
}
|
||||
return chooseDistributionType(prebuiltType = PREBUILT, lightType = LIGHT, defaultType = PREBUILT)
|
||||
}
|
||||
}
|
||||
|
||||
+7
-17
@@ -42,7 +42,6 @@ import org.jetbrains.kotlin.gradle.targets.native.internal.isAllowCommonizer
|
||||
import org.jetbrains.kotlin.gradle.targets.native.tasks.*
|
||||
import org.jetbrains.kotlin.gradle.utils.*
|
||||
import org.jetbrains.kotlin.gradle.utils.listFilesOrEmpty
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.library.KLIB_INTEROP_IR_PROVIDER_IDENTIFIER
|
||||
import org.jetbrains.kotlin.konan.properties.saveToFile
|
||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||
@@ -522,17 +521,11 @@ internal class ExternalDependenciesBuilder(
|
||||
get() = KonanPropertiesBuildService.registerIfAbsent(project).get()
|
||||
|
||||
fun buildCompilerArgs(): List<String> {
|
||||
val compilerVersion = Distribution.getCompilerVersion(konanPropertiesService.compilerVersion, project.konanHome)
|
||||
val konanVersion = compilerVersion?.let(CompilerVersion.Companion::fromString)
|
||||
?: project.konanVersion
|
||||
|
||||
if (konanVersion.isAtLeast(1, 6, 0)) {
|
||||
val dependenciesFile = writeDependenciesFile(buildDependencies(), deleteOnExit = true)
|
||||
if (dependenciesFile != null)
|
||||
return listOf("-Xexternal-dependencies=${dependenciesFile.path}")
|
||||
}
|
||||
|
||||
return emptyList()
|
||||
val dependenciesFile = writeDependenciesFile(buildDependencies(), deleteOnExit = true)
|
||||
return if (dependenciesFile != null)
|
||||
listOf("-Xexternal-dependencies=${dependenciesFile.path}")
|
||||
else
|
||||
emptyList()
|
||||
}
|
||||
|
||||
private fun buildDependencies(): Collection<KResolvedDependency> {
|
||||
@@ -989,7 +982,7 @@ open class CInteropProcess @Inject internal constructor(params: Params) : Defaul
|
||||
val konanTarget: KonanTarget = params.konanTarget
|
||||
|
||||
@get:Input
|
||||
val konanVersion: CompilerVersion = project.konanVersion
|
||||
val konanVersion: String = project.konanVersion
|
||||
|
||||
@Suppress("unused")
|
||||
@get:Input
|
||||
@@ -1092,10 +1085,7 @@ open class CInteropProcess @Inject internal constructor(params: Params) : Defaul
|
||||
|
||||
addArgs("-compiler-option", allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||
addArgs("-headerFilterAdditionalSearchPrefix", headerFilterDirs.map { it.absolutePath })
|
||||
|
||||
if (konanVersion.isAtLeast(1, 4, 0)) {
|
||||
addArg("-Xmodule-name", moduleName)
|
||||
}
|
||||
addArg("-Xmodule-name", moduleName)
|
||||
|
||||
// TODO: uncomment after advancing bootstrap.
|
||||
//addArg("-libraryVersion", libraryVersion)
|
||||
|
||||
+1
-6
@@ -20,11 +20,8 @@ import org.jetbrains.kotlin.compilerRunner.konanVersion
|
||||
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesClientSettings
|
||||
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutionSpec
|
||||
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutor.Companion.TC_PROJECT_PROPERTY
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.isAtLeast
|
||||
import org.jetbrains.kotlin.gradle.targets.native.internal.parseKotlinNativeStackTraceAsJvm
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinTest
|
||||
import org.jetbrains.kotlin.gradle.utils.isConfigurationCacheAvailable
|
||||
import org.jetbrains.kotlin.gradle.utils.property
|
||||
import java.io.File
|
||||
import java.util.concurrent.Callable
|
||||
import javax.inject.Inject
|
||||
@@ -152,9 +149,7 @@ abstract class KotlinNativeTest: KotlinTest() {
|
||||
|
||||
// The KotlinTest expects that the exit code is zero even if some tests failed.
|
||||
// In this case it can check exit code and distinguish test failures from crashes.
|
||||
// But K/N allows forcing a zero exit code only since 1.3 (which was included in Kotlin 1.3.40).
|
||||
// Thus we check the exit code only for newer versions.
|
||||
val checkExitCode = konanVersion.isAtLeast(1, 3, 0)
|
||||
val checkExitCode = true
|
||||
|
||||
val cliArgs = testCommand.cliArgs("TEAMCITY", checkExitCode, includePatterns, excludePatterns, args)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user