[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 -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> {
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