[Gradle] Fix cryptic task descriptions of Kotlin Compile Tasks
^KT-57023 Verification Pending
This commit is contained in:
committed by
Space Team
parent
de138532c7
commit
57b32b6f69
+15
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmCompilationData
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmModule
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmModule
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.dependsOnClosure
|
import org.jetbrains.kotlin.gradle.plugin.sources.dependsOnClosure
|
||||||
import org.jetbrains.kotlin.gradle.utils.filesProvider
|
import org.jetbrains.kotlin.gradle.utils.filesProvider
|
||||||
|
import org.jetbrains.kotlin.gradle.utils.toSetOrEmpty
|
||||||
import org.jetbrains.kotlin.project.model.LanguageSettings
|
import org.jetbrains.kotlin.project.model.LanguageSettings
|
||||||
|
|
||||||
internal sealed class KotlinCompilationInfo {
|
internal sealed class KotlinCompilationInfo {
|
||||||
@@ -38,6 +39,7 @@ internal sealed class KotlinCompilationInfo {
|
|||||||
abstract val classesDirs: ConfigurableFileCollection
|
abstract val classesDirs: ConfigurableFileCollection
|
||||||
abstract val compileDependencyFiles: FileCollection
|
abstract val compileDependencyFiles: FileCollection
|
||||||
abstract val sources: List<SourceDirectorySet>
|
abstract val sources: List<SourceDirectorySet>
|
||||||
|
abstract val displayName: String
|
||||||
|
|
||||||
class TCS(val compilation: KotlinCompilation<*>) : KotlinCompilationInfo() {
|
class TCS(val compilation: KotlinCompilation<*>) : KotlinCompilationInfo() {
|
||||||
|
|
||||||
@@ -92,6 +94,13 @@ internal sealed class KotlinCompilationInfo {
|
|||||||
|
|
||||||
override val sources: List<SourceDirectorySet>
|
override val sources: List<SourceDirectorySet>
|
||||||
get() = origin.allKotlinSourceSets.map { it.kotlin }
|
get() = origin.allKotlinSourceSets.map { it.kotlin }
|
||||||
|
|
||||||
|
override val displayName: String
|
||||||
|
get() = "compilation '${compilation.name}' in target '${compilation.target.name}'"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return displayName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KPM(val compilationData: GradleKpmCompilationData<*>) : KotlinCompilationInfo() {
|
class KPM(val compilationData: GradleKpmCompilationData<*>) : KotlinCompilationInfo() {
|
||||||
@@ -151,6 +160,12 @@ internal sealed class KotlinCompilationInfo {
|
|||||||
override val sources: List<SourceDirectorySet>
|
override val sources: List<SourceDirectorySet>
|
||||||
get() = origin.kotlinSourceDirectoriesByFragmentName.values.toList()
|
get() = origin.kotlinSourceDirectoriesByFragmentName.values.toList()
|
||||||
|
|
||||||
|
override val displayName: String
|
||||||
|
get() = origin.toString()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return displayName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -491,7 +491,7 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotl
|
|||||||
) {
|
) {
|
||||||
it.group = BasePlugin.BUILD_GROUP
|
it.group = BasePlugin.BUILD_GROUP
|
||||||
it.description = "Compiles a klibrary from the '${compilationInfo.compilationName}' " +
|
it.description = "Compiles a klibrary from the '${compilationInfo.compilationName}' " +
|
||||||
"compilation for target '${compilationInfo.platformType.name}'."
|
"compilation in target '${compilationInfo.targetDisambiguationClassifier}'."
|
||||||
it.enabled = konanTarget.enabledOnCurrentHost
|
it.enabled = konanTarget.enabledOnCurrentHost
|
||||||
|
|
||||||
it.destinationDirectory.set(project.klibOutputDirectory(compilationInfo).resolve("klib"))
|
it.destinationDirectory.set(project.klibOutputDirectory(compilationInfo).resolve("klib"))
|
||||||
|
|||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress("FunctionName")
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.gradle.regressionTests
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
|
import org.jetbrains.kotlin.gradle.util.buildProjectWithMPP
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
class KT57023CompileTaskDescriptionsTest {
|
||||||
|
@Test
|
||||||
|
fun `test - description of compile tasks`() {
|
||||||
|
val project = buildProjectWithMPP()
|
||||||
|
val kotlin = project.multiplatformExtension
|
||||||
|
kotlin.linuxX64()
|
||||||
|
kotlin.linuxArm64()
|
||||||
|
kotlin.jvm()
|
||||||
|
kotlin.js(KotlinJsCompilerType.IR)
|
||||||
|
kotlin.targetHierarchy.default()
|
||||||
|
|
||||||
|
project.evaluate()
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"Compiles the kotlin sources in compilation 'commonMain' in target 'metadata' to Metadata.",
|
||||||
|
kotlin.metadata().compilations.getByName("commonMain").compileTaskProvider.get().description
|
||||||
|
)
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"Compiles a klibrary from the 'linuxMain' compilation in target 'metadata'.",
|
||||||
|
kotlin.metadata().compilations.getByName("linuxMain").compileTaskProvider.get().description
|
||||||
|
)
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"Compiles the compilation 'main' in target 'jvm'.",
|
||||||
|
kotlin.jvm().compilations.getByName("main").compileTaskProvider.get().description
|
||||||
|
)
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"Compiles the compilation 'test' in target 'jvm'.",
|
||||||
|
kotlin.jvm().compilations.getByName("test").compileTaskProvider.get().description
|
||||||
|
)
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"Compiles a klibrary from the 'main' compilation in target 'linuxX64'.",
|
||||||
|
kotlin.linuxX64().compilations.getByName("main").compileTaskProvider.get().description
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user