[build] version of kotlin native stored in resouces

This commit is contained in:
Vasily Levchenko
2021-02-06 06:38:20 +01:00
committed by Stanislav Erokhin
parent bdc87edfd0
commit 905c0c3dd3
8 changed files with 34 additions and 11 deletions
+4
View File
@@ -115,6 +115,10 @@ extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
extra["ideaPluginDir"] = project.file(ideaPluginDir) extra["ideaPluginDir"] = project.file(ideaPluginDir)
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir) extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
extra["isSonatypeRelease"] = false extra["isSonatypeRelease"] = false
val kotlinNativeVersionObject = project.kotlinNativeVersionValue()
subprojects {
extra["kotlinNativeVersion"] = kotlinNativeVersionObject
}
// Work-around necessary to avoid setting null javaHome. Will be removed after support of lazy task configuration // Work-around necessary to avoid setting null javaHome. Will be removed after support of lazy task configuration
val jdkNotFoundConst = "JDK NOT FOUND" val jdkNotFoundConst = "JDK NOT FOUND"
+4 -1
View File
@@ -96,7 +96,10 @@ repositories {
} }
} }
val generateCompilerVersion by tasks.registering(VersionGenerator::class) {} val generateCompilerVersion by tasks.registering(VersionGenerator::class) {
kotlinNativeVersionInResources=true
defaultVersionFileLocation()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(generateCompilerVersion) dependsOn(generateCompilerVersion)
} }
@@ -0,0 +1,17 @@
/*
* 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
@@ -53,9 +53,7 @@ sourceSets{
kotlin { kotlin {
srcDir("../../shared/src/library/kotlin") srcDir("../../shared/src/library/kotlin")
srcDir("../../shared/src/main/kotlin") srcDir("../../shared/src/main/kotlin")
use(VersionGeneratorKt) { srcDir(VersionGeneratorKt.kotlinNativeVersionSrc(project))
srcDir(project.konanVersionGeneratedSrc())
}
} }
} }
} }
+3 -3
View File
@@ -33,11 +33,11 @@ sourceSets {
srcDir 'compiler/ir/backend.native/src/' srcDir 'compiler/ir/backend.native/src/'
srcDir '../shared/src/main/kotlin' srcDir '../shared/src/main/kotlin'
srcDir '../shared/src/library/kotlin' srcDir '../shared/src/library/kotlin'
use(VersionGeneratorKt) { srcDir(VersionGeneratorKt.kotlinNativeVersionSrc(project))
srcDir(project.konanVersionGeneratedSrc())
}
} }
resources.srcDir 'compiler/ir/backend.native/resources/' resources.srcDir 'compiler/ir/backend.native/resources/'
/* PATH to META-INF */
resources.srcDir VersionGeneratorKt.kotlinNativeVersionResourceFile(project).parentFile.parent
} }
cli_bc { cli_bc {
java.srcDir 'cli.bc/src' java.srcDir 'cli.bc/src'
+2 -2
View File
@@ -95,7 +95,7 @@ ext {
kotlinScriptRuntimeModule= project(":kotlin-script-runtime") kotlinScriptRuntimeModule= project(":kotlin-script-runtime")
kotlinUtilKliMetadatabModule= project(":kotlin-util-klib-metadata") kotlinUtilKliMetadatabModule= project(":kotlin-util-klib-metadata")
konanVersionFull = CompilerVersionGeneratedKt.getCurrentCompilerVersion() konanVersionFull = ext.kotlinNativeVersion
gradlePluginVersion = konanVersionFull gradlePluginVersion = konanVersionFull
} }
@@ -765,7 +765,7 @@ task clean(type: Delete) {
task pusher(type: KotlinBuildPusher){ task pusher(type: KotlinBuildPusher){
kotlinVersion = project.kotlinVersion kotlinVersion = project.kotlinVersion
konanVersion = CompilerVersionGeneratedKt.getCurrentCompilerVersion() konanVersion = project.ext.kotlinNativeVersion
buildServer = "buildserver.labs.intellij.net" buildServer = "buildserver.labs.intellij.net"
compilerConfigurationId = System.getenv("TEAMCITY_COMPILER_ID") ?: "Kotlin_KotlinDev_Compiler" compilerConfigurationId = System.getenv("TEAMCITY_COMPILER_ID") ?: "Kotlin_KotlinDev_Compiler"
overrideConfigurationId = System.getenv("TEAMCITY_OVERRIDE_NATIVE_ID") ?: "Kotlin_KotlinDev_DeployMavenArtifacts_OverrideNative" overrideConfigurationId = System.getenv("TEAMCITY_OVERRIDE_NATIVE_ID") ?: "Kotlin_KotlinDev_DeployMavenArtifacts_OverrideNative"
+2 -1
View File
@@ -43,4 +43,5 @@ shadowVersion=5.1.0
metadataVersion=0.0.1-dev-10 metadataVersion=0.0.1-dev-10
# Uncomment to compile Kotlin/Native backend modules with JVM IR backend. # Uncomment to compile Kotlin/Native backend modules with JVM IR backend.
# kotlin.build.useIR=true # kotlin.build.useIR=true
kotlinNativeVersionInResources=true
@@ -94,7 +94,7 @@ internal val Project.konanHome: String
internal val Project.konanVersion: CompilerVersion internal val Project.konanVersion: CompilerVersion
get() = project.findProperty(KonanPlugin.ProjectProperty.KONAN_VERSION) get() = project.findProperty(KonanPlugin.ProjectProperty.KONAN_VERSION)
?.toString()?.let { CompilerVersion.fromString(it) } ?.toString()?.let { CompilerVersion.fromString(it) }
?: CompilerVersion.CURRENT ?: project.findProperty("kotlinNativeVersion") as? CompilerVersion ?: CompilerVersion.CURRENT
internal val Project.konanBuildRoot get() = buildDir.resolve("konan") internal val Project.konanBuildRoot get() = buildDir.resolve("konan")
internal val Project.konanBinBaseDir get() = konanBuildRoot.resolve("bin") internal val Project.konanBinBaseDir get() = konanBuildRoot.resolve("bin")