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 linkTasks = listOf(
|
||||
":linkMainDebugShared$taskSuffix",
|
||||
":linkMainReleaseShared$taskSuffix",
|
||||
":linkMainDebugStatic$taskSuffix",
|
||||
":linkMainReleaseStatic$taskSuffix"
|
||||
":linkDebugShared$taskSuffix",
|
||||
":linkReleaseShared$taskSuffix",
|
||||
":linkDebugStatic$taskSuffix",
|
||||
":linkReleaseStatic$taskSuffix"
|
||||
)
|
||||
|
||||
build("assemble") {
|
||||
|
||||
+2
-15
@@ -146,7 +146,7 @@ abstract class AbstractKotlinTargetConfigurator<KotlinTargetType : KotlinTarget>
|
||||
|
||||
project.tasks.create(compilation.compileAllTaskName).apply {
|
||||
group = LifecycleBasePlugin.BUILD_GROUP
|
||||
description = "Assembles " + compilation.output + ""
|
||||
description = "Assembles outputs for compilation '${compilation.name}' of target '${compilation.target.name}'"
|
||||
dependsOn(
|
||||
compilation.output.dirs,
|
||||
compilation.compileKotlinTaskName
|
||||
@@ -387,13 +387,6 @@ open class KotlinNativeTargetConfigurator(
|
||||
private val Collection<*>.isDimensionVisible: Boolean
|
||||
get() = size > 1
|
||||
|
||||
private fun createDimensionSuffix(dimensionName: String, multivalueProperty: Collection<*>): String =
|
||||
if (multivalueProperty.isDimensionVisible) {
|
||||
dimensionName.toLowerCase().capitalize()
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
private val KotlinNativeCompilation.isMainCompilation: Boolean
|
||||
get() = name == KotlinCompilation.MAIN_COMPILATION_NAME
|
||||
|
||||
@@ -496,14 +489,8 @@ open class KotlinNativeTargetConfigurator(
|
||||
for (kind in availableOutputKinds) {
|
||||
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(
|
||||
taskName,
|
||||
compilation.linkTaskName(kind, buildType),
|
||||
KotlinNativeCompile::class.java
|
||||
).apply {
|
||||
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.
|
||||
internal var allSources: FileCollection = target.project.files()
|
||||
|
||||
val linkAllTaskName: String
|
||||
get() = lowerCamelCaseName(
|
||||
"link",
|
||||
compilationName.takeIf { it != "main" }.orEmpty(),
|
||||
target.disambiguationClassifier
|
||||
)
|
||||
|
||||
var isTestCompilation = false
|
||||
|
||||
var friendCompilationName: String? = null
|
||||
@@ -350,6 +343,26 @@ class KotlinNativeCompilation(
|
||||
getBinary(NativeOutputKind.valueOf(kind.toUpperCase()), NativeBuildType.valueOf(buildType.toUpperCase()))
|
||||
|
||||
// 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
|
||||
get() = lowerCamelCaseName(
|
||||
target.disambiguationClassifier,
|
||||
|
||||
Reference in New Issue
Block a user