backend: Use konan.dependencies property to set dependencies dir
This patch set default dependencies directory to ${konan.home}/
dependencies and allows one to override this setting using
konan.dependencies system property.
This commit is contained in:
+3
-5
@@ -231,12 +231,10 @@ private fun processLib(konanHome: String,
|
|||||||
val konanFile = File(konanFileName)
|
val konanFile = File(konanFileName)
|
||||||
val konanProperties = loadProperties(konanFile, mapOf())
|
val konanProperties = loadProperties(konanFile, mapOf())
|
||||||
|
|
||||||
// TODO: We use -Dkonan.home in the absence of fully built 'dist'
|
// TODO: We can provide a set of flags to find the components in the absence of 'dist' or 'dist/dependencies'.
|
||||||
// to locate the 'dependencies' directory.
|
|
||||||
// Eventually we need to pull the necessary content into 'dist'.
|
|
||||||
// And provide a set of flags to find the components in the absence of 'dist'.
|
|
||||||
val llvmHome = konanProperties.getOsSpecific("llvmHome")!!
|
val llvmHome = konanProperties.getOsSpecific("llvmHome")!!
|
||||||
val dependencies = File("$konanHome/../dependencies/all").canonicalPath
|
// We can override dependency directory using konan.dependencies system property.
|
||||||
|
val dependencies = System.getProperty("konan.dependencies", "$konanHome/dependencies")
|
||||||
val llvmInstallPath = "$dependencies/$llvmHome"
|
val llvmInstallPath = "$dependencies/$llvmHome"
|
||||||
val additionalHeaders = args["-h"].orEmpty()
|
val additionalHeaders = args["-h"].orEmpty()
|
||||||
val additionalCompilerOpts = args["-copt"].orEmpty()
|
val additionalCompilerOpts = args["-copt"].orEmpty()
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ targetList.each { target ->
|
|||||||
classpath = project.configurations.cli_bc
|
classpath = project.configurations.cli_bc
|
||||||
jvmArgs "-ea",
|
jvmArgs "-ea",
|
||||||
"-Dkonan.home=${project.parent.file('dist')}",
|
"-Dkonan.home=${project.parent.file('dist')}",
|
||||||
|
"-Dkonan.dependencies=${project.parent.file('dependencies/all')}",
|
||||||
"-Djava.library.path=${project.buildDir}/nativelibs"
|
"-Djava.library.path=${project.buildDir}/nativelibs"
|
||||||
args('-output', project(':runtime').file("build/${target}/stdlib.kt.bc"),
|
args('-output', project(':runtime').file("build/${target}/stdlib.kt.bc"),
|
||||||
'-nolink', '-nostdlib', '-ea',
|
'-nolink', '-nostdlib', '-ea',
|
||||||
@@ -220,6 +221,7 @@ targetList.each { target ->
|
|||||||
classpath = project.configurations.cli_bc
|
classpath = project.configurations.cli_bc
|
||||||
jvmArgs "-ea",
|
jvmArgs "-ea",
|
||||||
"-Dkonan.home=${project.parent.file('dist')}",
|
"-Dkonan.home=${project.parent.file('dist')}",
|
||||||
|
"-Dkonan.dependencies=${project.parent.file('dependencies/all')}",
|
||||||
"-Djava.library.path=${project.buildDir}/nativelibs"
|
"-Djava.library.path=${project.buildDir}/nativelibs"
|
||||||
args('-output', project(':runtime').file("build/${target}/start.kt.bc"),
|
args('-output', project(':runtime').file("build/${target}/start.kt.bc"),
|
||||||
'-nolink', '-nostdlib', '-ea',
|
'-nolink', '-nostdlib', '-ea',
|
||||||
|
|||||||
+3
-4
@@ -2,9 +2,8 @@ package org.jetbrains.kotlin.backend.konan
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Properties
|
|
||||||
|
|
||||||
public class Distribution(val config: CompilerConfiguration) {
|
class Distribution(val config: CompilerConfiguration) {
|
||||||
|
|
||||||
val targetManager = TargetManager(config)
|
val targetManager = TargetManager(config)
|
||||||
val target =
|
val target =
|
||||||
@@ -25,8 +24,8 @@ public class Distribution(val config: CompilerConfiguration) {
|
|||||||
|
|
||||||
val lib = "$konanHome/lib/$target"
|
val lib = "$konanHome/lib/$target"
|
||||||
|
|
||||||
// TODO: Pack all needed things to dist.
|
// We can override dependency directory using konan.dependencies system property.
|
||||||
val dependencies = "$konanHome/../dependencies/all"
|
val dependencies = System.getProperty("konan.dependencies", "$konanHome/dependencies")
|
||||||
|
|
||||||
val stdlib = "$lib/stdlib.kt.bc"
|
val stdlib = "$lib/stdlib.kt.bc"
|
||||||
val start = "$lib/start.kt.bc"
|
val start = "$lib/start.kt.bc"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ abstract class KonanTest extends JavaExec {
|
|||||||
def backendNative = project.project(":backend.native")
|
def backendNative = project.project(":backend.native")
|
||||||
def runtimeProject = project.project(":runtime")
|
def runtimeProject = project.project(":runtime")
|
||||||
def dist = project.rootProject.file("dist")
|
def dist = project.rootProject.file("dist")
|
||||||
|
def dependencies = project.findProject(":dependencies").file("all")
|
||||||
def runtimeBc = new File("${dist.canonicalPath}/lib/runtime.bc").absolutePath
|
def runtimeBc = new File("${dist.canonicalPath}/lib/runtime.bc").absolutePath
|
||||||
def launcherBc = new File("${dist.canonicalPath}/lib/launcher.bc").absolutePath
|
def launcherBc = new File("${dist.canonicalPath}/lib/launcher.bc").absolutePath
|
||||||
def startKtBc = new File("${dist.canonicalPath}/lib/start.kt.bc").absolutePath
|
def startKtBc = new File("${dist.canonicalPath}/lib/start.kt.bc").absolutePath
|
||||||
@@ -56,7 +57,9 @@ abstract class KonanTest extends JavaExec {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void setJvmArgs(Iterable<?> arguments) {
|
void setJvmArgs(Iterable<?> arguments) {
|
||||||
super.setJvmArgs(arguments + "-Dkonan.home=${dist.canonicalPath}" +
|
super.setJvmArgs(arguments +
|
||||||
|
"-Dkonan.home=${dist.canonicalPath}" +
|
||||||
|
"-Dkonan.dependencies=${dependencies.canonicalPat}",
|
||||||
"-Djava.library.path=${dist.canonicalPath}/konan/nativelib")
|
"-Djava.library.path=${dist.canonicalPath}/konan/nativelib")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ class NamedNativeInteropConfig implements Named {
|
|||||||
new File(project.findProject(":Interop:Runtime").buildDir, "nativelibs")
|
new File(project.findProject(":Interop:Runtime").buildDir, "nativelibs")
|
||||||
).asPath
|
).asPath
|
||||||
systemProperties "konan.home": project.rootProject.file("dist")
|
systemProperties "konan.home": project.rootProject.file("dist")
|
||||||
|
systemProperties "konan.dependencies": project.findProject(":dependencies").file("all")
|
||||||
environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1"
|
environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1"
|
||||||
environment "DYLD_LIBRARY_PATH": "${project.llvmDir}/lib"
|
environment "DYLD_LIBRARY_PATH": "${project.llvmDir}/lib"
|
||||||
environment "LD_LIBRARY_PATH": "${project.llvmDir}/lib"
|
environment "LD_LIBRARY_PATH": "${project.llvmDir}/lib"
|
||||||
|
|||||||
Reference in New Issue
Block a user