Fix parser for linkerOpts/compilerOpts (KT-29970) (#2219)
This commit is contained in:
+1
-1
@@ -159,7 +159,7 @@ extra["versions.markdown"] = "0.1.25"
|
||||
extra["versions.trove4j"] = "1.0.20181211"
|
||||
|
||||
if (!project.hasProperty("versions.kotlin-native")) {
|
||||
extra["versions.kotlin-native"] = "1.3-dev-8848"
|
||||
extra["versions.kotlin-native"] = "1.3-dev-9171"
|
||||
}
|
||||
|
||||
val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
|
||||
|
||||
+5
-1
@@ -186,7 +186,11 @@ private fun <A : CommonToolArguments> updateField(property: KMutableProperty1<A,
|
||||
when (property.returnType.classifier) {
|
||||
Boolean::class, String::class -> property.set(result, value)
|
||||
Array<String>::class -> {
|
||||
val newElements = (value as String).split(delimiter).toTypedArray()
|
||||
val newElements = if (delimiter.isEmpty()) {
|
||||
arrayOf(value as String)
|
||||
} else {
|
||||
(value as String).split(delimiter).toTypedArray()
|
||||
}
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val oldValue = property.get(result) as Array<String>?
|
||||
property.set(result, if (oldValue != null) arrayOf(*oldValue, *newElements) else newElements)
|
||||
|
||||
+3
-3
@@ -182,7 +182,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
|
||||
// Check that linker options were correctly passed to the K/N compiler.
|
||||
checkProgramCompilationCommandLine {
|
||||
assertTrue(it.contains("-linker-options -L."))
|
||||
assertTrue(it.contains("-linker-option -L."))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
assertSuccessful()
|
||||
}
|
||||
|
||||
// Check that run tasks work find and an entry point can be specified.
|
||||
// Check that run tasks work fine and an entry point can be specified.
|
||||
build("runDebugExecutable$hostSuffix") {
|
||||
assertSuccessful()
|
||||
assertTrue(output.contains("<root>.main"))
|
||||
@@ -995,7 +995,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
build("linkCustomReleaseFrameworkIos") {
|
||||
assertSuccessful()
|
||||
checkFrameworkCompilationCommandLine {
|
||||
assertTrue(it.contains("-linker-options -L."))
|
||||
assertTrue(it.contains("-linker-option -L."))
|
||||
assertTrue(it.contains("-Xtime"))
|
||||
assertTrue(it.contains("-Xstatic-framework"))
|
||||
assertFalse(it.contains("-Xembed-bitcode-marker"))
|
||||
|
||||
+6
-10
@@ -61,12 +61,6 @@ internal fun MutableList<String>.addFileArgs(parameter: String, values: Collecti
|
||||
}
|
||||
}
|
||||
|
||||
internal fun MutableList<String>.addListArg(parameter: String, values: List<String>) {
|
||||
if (values.isNotEmpty()) {
|
||||
addArg(parameter, values.joinToString(separator = " "))
|
||||
}
|
||||
}
|
||||
|
||||
private fun File.providedByCompiler(project: Project): Boolean =
|
||||
toPath().startsWith(project.file(project.konanHome).resolve("klib").toPath())
|
||||
|
||||
@@ -398,7 +392,9 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile() {
|
||||
Framework.BitcodeEmbeddingMode.BITCODE -> add("-Xembed-bitcode")
|
||||
else -> { /* Do nothing. */ }
|
||||
}
|
||||
addListArg("-linker-options", linkerOpts)
|
||||
linkerOpts.forEach {
|
||||
addArg("-linker-option", it)
|
||||
}
|
||||
exportLibraries.files.filterExternalKlibs(project).forEach {
|
||||
add("-Xexport-library=${it.absolutePath}")
|
||||
}
|
||||
@@ -521,18 +517,18 @@ open class CInteropProcess : DefaultTask() {
|
||||
addFileArgs("-header", headers)
|
||||
|
||||
compilerOpts.forEach {
|
||||
addArg("-copt", it)
|
||||
addArg("-compilerOpt", it)
|
||||
}
|
||||
|
||||
linkerOpts.forEach {
|
||||
addArg("-lopt", it)
|
||||
addArg("-linkerOpt", it)
|
||||
}
|
||||
|
||||
libraries.files.filterExternalKlibs(project).forEach { library ->
|
||||
addArg("-library", library.absolutePath)
|
||||
}
|
||||
|
||||
addArgs("-copt", allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||
addArgs("-compilerOpt", allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||
addArgs("-headerFilterAdditionalSearchPrefix", headerFilterDirs.map { it.absolutePath })
|
||||
|
||||
addAll(extraOpts)
|
||||
|
||||
Reference in New Issue
Block a user