Gradle, native: Use language settings when link from sources
Take language settings into account when a final binary is being built from sources.
This commit is contained in:
+38
@@ -432,6 +432,29 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile<KotlinCommonToolOption
|
|||||||
fn.call()
|
fn.call()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//region language settings inputs for the [linkFromSources] mode.
|
||||||
|
// TODO: Remove in 1.3.70.
|
||||||
|
@get:Optional
|
||||||
|
@get:Input
|
||||||
|
val languageVersion: String?
|
||||||
|
get() = languageSettings?.languageVersion?.takeIf { linkFromSources }
|
||||||
|
|
||||||
|
@get:Optional
|
||||||
|
@get:Input
|
||||||
|
val apiVersion: String?
|
||||||
|
get() = languageSettings?.apiVersion?.takeIf { linkFromSources }
|
||||||
|
|
||||||
|
@get:Optional
|
||||||
|
@get:Input
|
||||||
|
val enabledLanguageFeatures: Set<String>?
|
||||||
|
get() = languageSettings?.enabledLanguageFeatures?.takeIf { linkFromSources }
|
||||||
|
|
||||||
|
@get:Optional
|
||||||
|
@get:Input
|
||||||
|
val experimentalAnnotationsInUse: Set<String>?
|
||||||
|
get() = languageSettings?.experimentalAnnotationsInUse?.takeIf { linkFromSources }
|
||||||
|
// endregion.
|
||||||
|
|
||||||
// Binary-specific options.
|
// Binary-specific options.
|
||||||
@get:Optional
|
@get:Optional
|
||||||
@get:Input
|
@get:Input
|
||||||
@@ -488,6 +511,21 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile<KotlinCommonToolOption
|
|||||||
add("-Xexport-library=${it.absolutePath}")
|
add("-Xexport-library=${it.absolutePath}")
|
||||||
}
|
}
|
||||||
addKey("-Xstatic-framework", isStaticFramework)
|
addKey("-Xstatic-framework", isStaticFramework)
|
||||||
|
|
||||||
|
// Allow a user to force the old behaviour of a link task.
|
||||||
|
// TODO: Remove in 1.3.70.
|
||||||
|
if (!linkFromSources) {
|
||||||
|
languageSettings?.let {
|
||||||
|
addArgIfNotNull("-language-version", it.languageVersion)
|
||||||
|
addArgIfNotNull("-api-version", it.apiVersion)
|
||||||
|
it.enabledLanguageFeatures.forEach { featureName ->
|
||||||
|
add("-XXLanguage:+$featureName")
|
||||||
|
}
|
||||||
|
it.experimentalAnnotationsInUse.forEach { annotationName ->
|
||||||
|
add("-Xuse-experimental=$annotationName")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildSourceArgs(): List<String> {
|
override fun buildSourceArgs(): List<String> {
|
||||||
|
|||||||
Reference in New Issue
Block a user