From 725e36761440b111eab34f158589372e657289a7 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 9 Mar 2017 16:06:36 +0700 Subject: [PATCH] build/tests: implement passing interop linker args to compiler --- .../src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy | 7 ++++++- .../groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index e497a48895e..94adc66ce8e 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -202,7 +202,12 @@ class RunInteropKonanTest extends KonanTest { String interopStubsBc = new File(interopConf.nativeLibsDir, interop + "stubs.bc").absolutePath - runCompiler(filesToCompile, exe, ["-library", interopBc, "-nativelibrary", interopStubsBc]) + List linkerArguments = interopConf.linkerOpts // TODO: add arguments from .def file + + List compilerArguments = ["-library", interopBc, "-nativelibrary", interopStubsBc] + + linkerArguments.collectMany { ["-linkerArg", it] } + + runCompiler(filesToCompile, exe, compilerArguments) } } diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy index 43c14ab48f9..3be61c17473 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy @@ -32,7 +32,7 @@ class NamedNativeInteropConfig implements Named { private List compilerOpts = [] private List headers; private String linker - private List linkerOpts = [] + List linkerOpts = [] private FileCollection linkFiles; private List linkTasks = [] @@ -177,6 +177,8 @@ class NamedNativeInteropConfig implements Named { // defer as much as possible doFirst { + List linkerOpts = this.linkerOpts + linkTasks.each { linkerOpts += project.tasks.getByPath(it).outputs.files.files }