Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise they would be ignored according .gitignore settings. Probably they should be deleted from repo. Interop/.idea/compiler.xml Interop/.idea/gradle.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml Interop/.idea/modules.xml Interop/.idea/modules/Indexer/Indexer.iml Interop/.idea/modules/Runtime/Runtime.iml Interop/.idea/modules/StubGenerator/StubGenerator.iml backend.native/backend.native.iml backend.native/bc.frontend/bc.frontend.iml backend.native/cli.bc/cli.bc.iml backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt backend.native/tests/link/lib/foo.kt backend.native/tests/link/lib/foo2.kt backend.native/tests/teamcity-test.property
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
buildscript {
|
||||
apply(from = "$rootDir/gradle/kotlinGradlePlugin.gradle")
|
||||
}
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
tasks.named<KotlinCompile>("compileKotlin") {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs = listOf("-Xskip-metadata-version-check")
|
||||
}
|
||||
}
|
||||
|
||||
// Convert to normal strings since originally these properties contain GStrings.
|
||||
val kotlinCompilerModule = rootProject.ext["kotlinCompilerModule"].toString()
|
||||
val kotlinStdLibModule = rootProject.ext["kotlinStdLibModule"].toString()
|
||||
|
||||
dependencies {
|
||||
api(kotlinStdLibModule)
|
||||
implementation(kotlinCompilerModule)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.jetbrains.kotlin.konan.util
|
||||
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import java.io.File
|
||||
import java.nio.file.Paths
|
||||
|
||||
object KonanHomeProvider {
|
||||
|
||||
/**
|
||||
* Determines a path to the current Kotlin/Native distribution.
|
||||
*
|
||||
* - If the system property "konan.home" is set, the method returns its value.
|
||||
* - Otherwise, it determines a path to a jar containing this class. If this path corresponds to the jar path
|
||||
* inside a distribution, the method calculates the path to the distribution on the basis of this jar path.
|
||||
* Otherwise an IllegalStateException is thrown.
|
||||
*/
|
||||
fun determineKonanHome(): String {
|
||||
val propertyValue = System.getProperty("konan.home")
|
||||
return if (propertyValue != null) {
|
||||
File(propertyValue).absolutePath
|
||||
} else {
|
||||
val jarPath = PathUtil.getResourcePathForClass(this::class.java)
|
||||
|
||||
// Check that the path obtained really points to the distribution.
|
||||
val expectedRelativeJarPath = Paths.get("konan/lib/kotlin-native.jar")
|
||||
check(jarPath.toPath().endsWith(expectedRelativeJarPath)) {
|
||||
val classesPath = if (jarPath.extension == "jar") jarPath else jarPath.parentFile
|
||||
"""
|
||||
Cannot determine a compiler distribution directory.
|
||||
A path to compiler classes is not a part of a distribution: ${classesPath.absolutePath}.
|
||||
Please set the konan.home system property to specify the distribution path manually.
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
// The compiler jar is located in <dist>/konan/lib.
|
||||
jarPath.parentFile.parentFile.parentFile.absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user