gradle-plugin: Support user jvm args
This commit is contained in:
@@ -287,6 +287,7 @@ targetList.each { target ->
|
|||||||
targetDefFiles(target).forEach{
|
targetDefFiles(target).forEach{
|
||||||
defFile ->
|
defFile ->
|
||||||
def taskName = defFileToTaskName(target, defFile.name)
|
def taskName = defFileToTaskName(target, defFile.name)
|
||||||
|
def jvmArgs = project.findProperty("platfromLibsJvmArgs") ?: "-Xmx3G"
|
||||||
def suffix = null
|
def suffix = null
|
||||||
if (new PlatformInfo().isWindows())
|
if (new PlatformInfo().isWindows())
|
||||||
suffix = 'bat'
|
suffix = 'bat'
|
||||||
@@ -298,6 +299,7 @@ targetList.each { target ->
|
|||||||
buildFile project('klib').file('platform.gradle')
|
buildFile project('klib').file('platform.gradle')
|
||||||
dir project(':klib').projectDir
|
dir project(':klib').projectDir
|
||||||
startParameter.projectProperties = [
|
startParameter.projectProperties = [
|
||||||
|
'konan.jvmArgs' : jvmArgs,
|
||||||
'kotlin_version' : kotlin_version,
|
'kotlin_version' : kotlin_version,
|
||||||
'name' : defFile.name,
|
'name' : defFile.name,
|
||||||
'defFile' : defFile.file.absolutePath,
|
'defFile' : defFile.file.absolutePath,
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
konan.home=../../dist
|
konan.home=../../dist
|
||||||
|
konan.jvmArgs=-Xmx3G
|
||||||
@@ -1 +1,2 @@
|
|||||||
konan.home=../..
|
konan.home=../..
|
||||||
|
konan.jvmArgs=-Xmx3G
|
||||||
+7
@@ -34,6 +34,7 @@ import javax.inject.Inject
|
|||||||
* konan.home - directory where compiler is located (aka dist in konan project output).
|
* konan.home - directory where compiler is located (aka dist in konan project output).
|
||||||
* konan.version - a konan compiler version for downloading.
|
* konan.version - a konan compiler version for downloading.
|
||||||
* konan.build.targets - list of targets to build (by default all the declared targets are built).
|
* konan.build.targets - list of targets to build (by default all the declared targets are built).
|
||||||
|
* konan.jvmArgs - additional args to be passed to a JVM executing the compiler/cinterop tool.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
internal fun Project.hasProperty(property: KonanPlugin.ProjectProperty) = hasProperty(property.propertyName)
|
internal fun Project.hasProperty(property: KonanPlugin.ProjectProperty) = hasProperty(property.propertyName)
|
||||||
@@ -90,6 +91,9 @@ internal val Project.requestedTargets
|
|||||||
it.toString().trim().split("\\s+".toRegex())
|
it.toString().trim().split("\\s+".toRegex())
|
||||||
}.orEmpty()
|
}.orEmpty()
|
||||||
|
|
||||||
|
internal val Project.jvmArgs
|
||||||
|
get() = (findProperty(KonanPlugin.ProjectProperty.KONAN_JVM_ARGS) as String?)?.split("\\s+".toRegex()).orEmpty()
|
||||||
|
|
||||||
internal val Project.compileAllTask
|
internal val Project.compileAllTask
|
||||||
get() = getOrCreateTask(COMPILE_ALL_TASK_NAME)
|
get() = getOrCreateTask(COMPILE_ALL_TASK_NAME)
|
||||||
|
|
||||||
@@ -223,6 +227,8 @@ open class KonanExtension {
|
|||||||
var languageVersion: String? = null
|
var languageVersion: String? = null
|
||||||
var apiVersion: String? = null
|
var apiVersion: String? = null
|
||||||
|
|
||||||
|
val jvmArgs = mutableListOf<String>()
|
||||||
|
|
||||||
internal val konanTargets: List<KonanTarget>
|
internal val konanTargets: List<KonanTarget>
|
||||||
get() = targets.map { TargetManager(it).target }.distinct()
|
get() = targets.map { TargetManager(it).target }.distinct()
|
||||||
}
|
}
|
||||||
@@ -234,6 +240,7 @@ class KonanPlugin @Inject constructor(private val registry: ToolingModelBuilderR
|
|||||||
KONAN_HOME ("konan.home"),
|
KONAN_HOME ("konan.home"),
|
||||||
KONAN_VERSION ("konan.version"),
|
KONAN_VERSION ("konan.version"),
|
||||||
KONAN_BUILD_TARGETS ("konan.build.targets"),
|
KONAN_BUILD_TARGETS ("konan.build.targets"),
|
||||||
|
KONAN_JVM_ARGS ("konan.jvmArgs"),
|
||||||
DOWNLOAD_COMPILER ("download.compiler")
|
DOWNLOAD_COMPILER ("download.compiler")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -50,9 +50,11 @@ internal abstract class KonanCliRunner(val toolName: String, val fullName: Strin
|
|||||||
|
|
||||||
override val jvmArgs = mutableListOf(
|
override val jvmArgs = mutableListOf(
|
||||||
"-ea",
|
"-ea",
|
||||||
"-Xmx3G",
|
|
||||||
"-Dkonan.home=${project.konanHome}",
|
"-Dkonan.home=${project.konanHome}",
|
||||||
"-Djava.library.path=${project.konanHome}/konan/nativelib")
|
"-Djava.library.path=${project.konanHome}/konan/nativelib").apply {
|
||||||
|
addAll(project.konanExtension.jvmArgs)
|
||||||
|
addAll(project.jvmArgs)
|
||||||
|
}
|
||||||
|
|
||||||
override val environment = mutableMapOf("LIBCLANG_DISABLE_CRASH_RECOVERY" to "1")
|
override val environment = mutableMapOf("LIBCLANG_DISABLE_CRASH_RECOVERY" to "1")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user