Renamed interop 'target' to 'flavour'.

This commit is contained in:
Alexander Gorshenev
2017-03-15 13:56:31 +03:00
committed by alexander-gorshenev
parent 7279873bb4
commit a7677e2a8b
4 changed files with 17 additions and 17 deletions
@@ -171,9 +171,9 @@ private fun processLib(konanHome: String,
val userDir = System.getProperty("user.dir") val userDir = System.getProperty("user.dir")
val ktGenRoot = args["-generated"]?.single() ?: userDir val ktGenRoot = args["-generated"]?.single() ?: userDir
val nativeLibsDir = args["-natives"]?.single() ?: userDir val nativeLibsDir = args["-natives"]?.single() ?: userDir
val platformName = args["-target"]?.single() ?: "jvm" val flavorName = args["-flavor"]?.single() ?: "jvm"
val platform = KotlinPlatform.values().single { it.name.equals(platformName, ignoreCase = true) } val flavor = KotlinPlatform.values().single { it.name.equals(flavorName, ignoreCase = true) }
val defFile = args["-def"]?.single()?.let { File(it) } val defFile = args["-def"]?.single()?.let { File(it) }
@@ -238,7 +238,7 @@ private fun processLib(konanHome: String,
val nativeIndex = buildNativeIndex(library) val nativeIndex = buildNativeIndex(library)
val gen = StubGenerator(nativeIndex, configuration, libName, generateShims, platform) val gen = StubGenerator(nativeIndex, configuration, libName, generateShims, flavor)
outKtFile.parentFile.mkdirs() outKtFile.parentFile.mkdirs()
outKtFile.bufferedWriter().use { out -> outKtFile.bufferedWriter().use { out ->
@@ -259,7 +259,7 @@ private fun processLib(konanHome: String,
val workDir = defFile?.parentFile ?: File(System.getProperty("java.io.tmpdir")) val workDir = defFile?.parentFile ?: File(System.getProperty("java.io.tmpdir"))
if (platform == KotlinPlatform.JVM) { if (flavor == KotlinPlatform.JVM) {
val outOFile = createTempFile(suffix = ".o") val outOFile = createTempFile(suffix = ".o")
@@ -280,7 +280,7 @@ private fun processLib(konanHome: String,
runCmd(linkerCmd, workDir, verbose) runCmd(linkerCmd, workDir, verbose)
outOFile.delete() outOFile.delete()
} else if (platform == KotlinPlatform.NATIVE) { } else if (flavor == KotlinPlatform.NATIVE) {
val outBcName = libName + ".bc" val outBcName = libName + ".bc"
val outLib = nativeLibsDir + "/" + outBcName val outLib = nativeLibsDir + "/" + outBcName
val compilerCmd = arrayOf("$llvmInstallPath/bin/$compiler", *compilerOpts.toTypedArray(), val compilerCmd = arrayOf("$llvmInstallPath/bin/$compiler", *compilerOpts.toTypedArray(),
+6 -6
View File
@@ -1508,29 +1508,29 @@ kotlinNativeInterop {
sysstat { sysstat {
pkg 'sysstat' pkg 'sysstat'
headers 'sys/stat.h' headers 'sys/stat.h'
target 'native' flavor 'native'
} }
cstdlib { cstdlib {
pkg 'cstdlib' pkg 'cstdlib'
headers 'stdlib.h' headers 'stdlib.h'
target 'native' flavor 'native'
} }
cstdio { cstdio {
defFile 'interop/basics/cstdio.def' defFile 'interop/basics/cstdio.def'
target 'native' flavor 'native'
compilerOpts '-D_POSIX_SOURCE' // Exclude Darwin extensions causing link errors. compilerOpts '-D_POSIX_SOURCE' // Exclude Darwin extensions causing link errors.
} }
sockets { sockets {
defFile 'interop/basics/sockets.def' defFile 'interop/basics/sockets.def'
target 'native' flavor 'native'
} }
if (isMac()) { if (isMac()) {
opengl { opengl {
target 'native' flavor 'native'
compilerOpts '-framework', 'OpenGL', '-framework', 'GLUT' compilerOpts '-framework', 'OpenGL', '-framework', 'GLUT'
linkerOpts '-framework', 'OpenGL', '-framework', 'GLUT' linkerOpts '-framework', 'OpenGL', '-framework', 'GLUT'
pkg 'opengl' pkg 'opengl'
@@ -1578,4 +1578,4 @@ if (isMac()) {
source = "interop/basics/opengl_teapot.kt" source = "interop/basics/opengl_teapot.kt"
interop = 'opengl' interop = 'opengl'
} }
} }
@@ -23,7 +23,7 @@ class NamedNativeInteropConfig implements Named {
private SourceSet interopStubs private SourceSet interopStubs
final JavaExec genTask final JavaExec genTask
private String target = "jvm" private String flavor = "jvm"
private String defFile private String defFile
@@ -38,8 +38,8 @@ class NamedNativeInteropConfig implements Named {
Configuration configuration Configuration configuration
void target(String value) { void flavor(String value) {
target = value flavor = value
} }
void defFile(String value) { void defFile(String value) {
@@ -188,7 +188,7 @@ class NamedNativeInteropConfig implements Named {
args "-properties:" + project.findProject(":backend.native").file("konan.properties") args "-properties:" + project.findProject(":backend.native").file("konan.properties")
args "-generated:" + generatedSrcDir args "-generated:" + generatedSrcDir
args "-natives:" + nativeLibsDir args "-natives:" + nativeLibsDir
args "-target:" + this.target args "-flavor:" + this.flavor
// Uncomment to debug. // Uncomment to debug.
//args "-verbose:true" //args "-verbose:true"
+2 -2
View File
@@ -52,13 +52,13 @@ INTEROP_RUNTIME_JAR="${KONAN_HOME}/konan/lib/Runtime.jar"
INTEROP_CLASSPATH="$STUB_GENERATOR_JAR:$KOTLIN_JAR:$INTEROP_INDEXER_JAR:$INTEROP_RUNTIME_JAR" INTEROP_CLASSPATH="$STUB_GENERATOR_JAR:$KOTLIN_JAR:$INTEROP_INDEXER_JAR:$INTEROP_RUNTIME_JAR"
INTEROP_TOOL=org.jetbrains.kotlin.native.interop.gen.jvm.MainKt INTEROP_TOOL=org.jetbrains.kotlin.native.interop.gen.jvm.MainKt
TARGET_ARG=-target:native FLAVOR_ARG=-flavor:native
LIBCLANG_DISABLE_CRASH_RECOVERY=1 \ LIBCLANG_DISABLE_CRASH_RECOVERY=1 \
LD_LIBRARY_PATH=${NATIVE_LIB} \ LD_LIBRARY_PATH=${NATIVE_LIB} \
$JAVACMD $JAVA_OPTS ${java_args[@]} \ $JAVACMD $JAVA_OPTS ${java_args[@]} \
-cp $INTEROP_CLASSPATH \ -cp $INTEROP_CLASSPATH \
$INTEROP_TOOL \ $INTEROP_TOOL \
$TARGET_ARG ${interop_args[@]} \ $FLAVOR_ARG ${interop_args[@]} \