Allow -Pkonanc_flags="-print_bitcode" for gradle commands.

This commit is contained in:
Alexander Gorshenev
2016-12-14 15:49:06 +03:00
committed by alexander-gorshenev
parent 175dc9fb14
commit f5a627f6ff
3 changed files with 23 additions and 15 deletions
+4
View File
@@ -170,6 +170,8 @@ task stdlib(type: JavaExec) {
args '-output', project(':runtime').file('build/stdlib.kt.bc')
args project.globalArgs
jvmArgs '-ea', "-Djava.library.path=${project.buildDir}/nativelibs"
dependsOn ':runtime:build'
@@ -191,6 +193,8 @@ task start(type: JavaExec) {
args '-output', project(':runtime').file('build/start.kt.bc')
args project.globalArgs
jvmArgs '-ea', "-Djava.library.path=${project.buildDir}/nativelibs"
dependsOn 'stdlib'
+12 -8
View File
@@ -6,6 +6,8 @@ dependencies {
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
}
abstract class KonanTest extends DefaultTask {
protected String source
def backendNative = project.project(":backend.native")
@@ -47,10 +49,11 @@ abstract class KonanTest extends DefaultTask {
main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
classpath = project.configurations.cli_bc
jvmArgs "-ea"
args "-output", "${sourceBc.absolutePath}",
args("-output", "${sourceBc.absolutePath}",
"-runtime", "${runtimeBc.absolutePath}",
"-library", "${stdlibKtBc.absolutePath}",
"${sourceKt.absolutePath}"
"${sourceKt.absolutePath}",
*project.globalArgs)
String libraryPath = "${project.llvmDir}/lib:${backendNative.buildDir.canonicalPath}/nativelibs"
environment 'LD_LIBRARY_PATH' : libraryPath
@@ -144,11 +147,11 @@ class LinkKonanTest extends KonanTest {
main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
classpath = project.configurations.cli_bc
jvmArgs "-ea"
args "-output", "${libPath}",
args("-output", "${libPath}",
"-runtime", "${runtimeBc.absolutePath}",
sourcesKt
sourcesKt, *project.globalArgs)
String libraryPath = "${project.llvmDir}/lib:${backendNative.buildDir.canonicalPath}/nativelibs"
libraryPath = "${project.llvmDir}/lib:${backendNative.buildDir.canonicalPath}/nativelibs"
environment 'LD_LIBRARY_PATH' : libraryPath
environment 'DYLD_LIBRARY_PATH' : libraryPath
@@ -165,11 +168,12 @@ class LinkKonanTest extends KonanTest {
main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
classpath = project.configurations.cli_bc
jvmArgs "-ea"
args "-output", outPath,
args("-output", outPath,
"-runtime", "${runtimeBc.absolutePath}",
"-library", "${stdlibKtBc.absolutePath}",
"-library", "${libBc.absolutePath}",
"${sourceKt.absolutePath}"
"${sourceKt.absolutePath}",
*project.globalArgs)
String libraryPath = "${project.llvmDir}/lib:${backendNative.buildDir.canonicalPath}/nativelibs"
environment 'LD_LIBRARY_PATH' : libraryPath
@@ -758,4 +762,4 @@ task lambda12(type: RunKonanTest) {
task lambda13(type: RunKonanTest) {
goldValue = "foo\n"
source = "codegen/lambda/lambda13.kt"
}
}
+7 -7
View File
@@ -39,12 +39,10 @@ allprojects {
}
ext.clangArgs << "-B$binDir"
ext.clangPath << binDir
ext.jvmArgs = ["-ea"]
ext.clangLinkArgs = libLink()
ext.clangOptArgs = optArgs()
ext.globalArgs = project.hasProperty("konanc_flags") ? ext.konanc_flags.split(' ') : []
convention.plugins.execClang = new org.jetbrains.kotlin.ExecClang(project)
plugins.withType(NativeComponentPlugin) {
@@ -185,9 +183,10 @@ task dist_compiler(type: Copy) {
task stdlib(type: Exec) {
dependsOn 'dist_compiler', 'list_dist'
commandLine './dist/bin/konanc',
commandLine('./dist/bin/konanc',
"-J${jvmArgs.join(' ')}",
'-nolink', '-nostdlib', 'runtime/src/main/kotlin', '-o', 'dist/lib/stdlib.kt.bc'
'-nolink', '-nostdlib', 'runtime/src/main/kotlin', '-o',
'dist/lib/stdlib.kt.bc', *globalArgs)
outputs.file(project.file('dist/lib/stdlib.kt.bc'))
}
@@ -199,9 +198,10 @@ task list_dist(type: Exec) {
task start(type: Exec) {
dependsOn 'dist_compiler', 'stdlib'
commandLine './dist/bin/konanc',
commandLine('./dist/bin/konanc',
"-J${jvmArgs.join(' ')}",
'-nolink', 'runtime/src/launcher/kotlin', '-o', 'dist/lib/start.kt.bc'
'-nolink', 'runtime/src/launcher/kotlin', '-o',
'dist/lib/start.kt.bc', *globalArgs)
outputs.file(project.file('dist/lib/start.kt.bc'))
}