Provide getters for names of native link tasks
This commit is contained in:
committed by
Ilya Matveev
parent
f1de88ebbc
commit
0ac701d8bf
+4
-4
@@ -482,10 +482,10 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
|
|
||||||
val taskSuffix = nativeHostTargetName.capitalize()
|
val taskSuffix = nativeHostTargetName.capitalize()
|
||||||
val linkTasks = listOf(
|
val linkTasks = listOf(
|
||||||
":linkMainDebugShared$taskSuffix",
|
":linkDebugShared$taskSuffix",
|
||||||
":linkMainReleaseShared$taskSuffix",
|
":linkReleaseShared$taskSuffix",
|
||||||
":linkMainDebugStatic$taskSuffix",
|
":linkDebugStatic$taskSuffix",
|
||||||
":linkMainReleaseStatic$taskSuffix"
|
":linkReleaseStatic$taskSuffix"
|
||||||
)
|
)
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
|
|||||||
+2
-15
@@ -146,7 +146,7 @@ abstract class AbstractKotlinTargetConfigurator<KotlinTargetType : KotlinTarget>
|
|||||||
|
|
||||||
project.tasks.create(compilation.compileAllTaskName).apply {
|
project.tasks.create(compilation.compileAllTaskName).apply {
|
||||||
group = LifecycleBasePlugin.BUILD_GROUP
|
group = LifecycleBasePlugin.BUILD_GROUP
|
||||||
description = "Assembles " + compilation.output + ""
|
description = "Assembles outputs for compilation '${compilation.name}' of target '${compilation.target.name}'"
|
||||||
dependsOn(
|
dependsOn(
|
||||||
compilation.output.dirs,
|
compilation.output.dirs,
|
||||||
compilation.compileKotlinTaskName
|
compilation.compileKotlinTaskName
|
||||||
@@ -387,13 +387,6 @@ open class KotlinNativeTargetConfigurator(
|
|||||||
private val Collection<*>.isDimensionVisible: Boolean
|
private val Collection<*>.isDimensionVisible: Boolean
|
||||||
get() = size > 1
|
get() = size > 1
|
||||||
|
|
||||||
private fun createDimensionSuffix(dimensionName: String, multivalueProperty: Collection<*>): String =
|
|
||||||
if (multivalueProperty.isDimensionVisible) {
|
|
||||||
dimensionName.toLowerCase().capitalize()
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
|
|
||||||
private val KotlinNativeCompilation.isMainCompilation: Boolean
|
private val KotlinNativeCompilation.isMainCompilation: Boolean
|
||||||
get() = name == KotlinCompilation.MAIN_COMPILATION_NAME
|
get() = name == KotlinCompilation.MAIN_COMPILATION_NAME
|
||||||
|
|
||||||
@@ -496,14 +489,8 @@ open class KotlinNativeTargetConfigurator(
|
|||||||
for (kind in availableOutputKinds) {
|
for (kind in availableOutputKinds) {
|
||||||
val compilerOutputKind = kind.compilerOutputKind
|
val compilerOutputKind = kind.compilerOutputKind
|
||||||
|
|
||||||
val compilationSuffix = compilation.name
|
|
||||||
val buildTypeSuffix = createDimensionSuffix(buildType.name, buildTypes)
|
|
||||||
val targetSuffix = compilation.target.name
|
|
||||||
val kindSuffix = kind.taskNameClassifier
|
|
||||||
val taskName = lowerCamelCaseName("link", compilationSuffix, buildTypeSuffix, kindSuffix, targetSuffix)
|
|
||||||
|
|
||||||
val linkTask = project.tasks.create(
|
val linkTask = project.tasks.create(
|
||||||
taskName,
|
compilation.linkTaskName(kind, buildType),
|
||||||
KotlinNativeCompile::class.java
|
KotlinNativeCompile::class.java
|
||||||
).apply {
|
).apply {
|
||||||
this.compilation = compilation
|
this.compilation = compilation
|
||||||
|
|||||||
+20
-7
@@ -275,13 +275,6 @@ class KotlinNativeCompilation(
|
|||||||
// TODO: Move into the compilation task when the linking task does klib linking instead of compilation.
|
// TODO: Move into the compilation task when the linking task does klib linking instead of compilation.
|
||||||
internal var allSources: FileCollection = target.project.files()
|
internal var allSources: FileCollection = target.project.files()
|
||||||
|
|
||||||
val linkAllTaskName: String
|
|
||||||
get() = lowerCamelCaseName(
|
|
||||||
"link",
|
|
||||||
compilationName.takeIf { it != "main" }.orEmpty(),
|
|
||||||
target.disambiguationClassifier
|
|
||||||
)
|
|
||||||
|
|
||||||
var isTestCompilation = false
|
var isTestCompilation = false
|
||||||
|
|
||||||
var friendCompilationName: String? = null
|
var friendCompilationName: String? = null
|
||||||
@@ -350,6 +343,26 @@ class KotlinNativeCompilation(
|
|||||||
getBinary(NativeOutputKind.valueOf(kind.toUpperCase()), NativeBuildType.valueOf(buildType.toUpperCase()))
|
getBinary(NativeOutputKind.valueOf(kind.toUpperCase()), NativeBuildType.valueOf(buildType.toUpperCase()))
|
||||||
|
|
||||||
// Naming
|
// Naming
|
||||||
|
|
||||||
|
val linkAllTaskName: String
|
||||||
|
get() = lowerCamelCaseName(
|
||||||
|
"link",
|
||||||
|
compilationName.takeIf { it != "main" }.orEmpty(),
|
||||||
|
target.disambiguationClassifier
|
||||||
|
)
|
||||||
|
|
||||||
|
fun linkTaskName(kind: NativeOutputKind, buildType: NativeBuildType): String =
|
||||||
|
lowerCamelCaseName(
|
||||||
|
"link",
|
||||||
|
compilationName.takeIf { it != KotlinCompilation.MAIN_COMPILATION_NAME }.orEmpty(),
|
||||||
|
buildType.name.toLowerCase(),
|
||||||
|
kind.taskNameClassifier,
|
||||||
|
target.disambiguationClassifier
|
||||||
|
)
|
||||||
|
|
||||||
|
fun linkTaskName(kind: String, buildType: String) =
|
||||||
|
linkTaskName(NativeOutputKind.valueOf(kind.toUpperCase()), NativeBuildType.valueOf(buildType.toUpperCase()))
|
||||||
|
|
||||||
override val compileDependencyConfigurationName: String
|
override val compileDependencyConfigurationName: String
|
||||||
get() = lowerCamelCaseName(
|
get() = lowerCamelCaseName(
|
||||||
target.disambiguationClassifier,
|
target.disambiguationClassifier,
|
||||||
|
|||||||
Reference in New Issue
Block a user