[Gradle] PomDependenciesRewriter: Fix missing 'component' in configuration cache

^KT-60159 Verification Pending
This commit is contained in:
Sebastian Sellmair
2023-08-03 12:24:55 +02:00
committed by Space Team
parent b9a520b593
commit 2ab2f408f3
2 changed files with 2 additions and 8 deletions
@@ -1257,7 +1257,7 @@ open class NewMultiplatformIT : BaseGradleIT() {
""".trimIndent()
)
build("clean", "publish") {
build("clean", "publish", options = defaultBuildOptions().copy(configurationCache = true)) {
assertSuccessful()
assertFileContains(
"repo/com/exampleapp/sample-app-nodejs/1.0/sample-app-nodejs-1.0.pom",
@@ -17,7 +17,6 @@ import org.gradle.api.internal.component.UsageContext
import org.gradle.api.provider.Provider
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtensionOrNull
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilationToRunnableFiles
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetComponent
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.Companion.kotlinPropertiesProvider
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsageContext.MavenScope
@@ -31,9 +30,7 @@ internal data class ModuleCoordinates(
internal class PomDependenciesRewriter(
project: Project,
@field:Transient
private val component: KotlinTargetComponent
component: KotlinTargetComponent
) {
// Get the dependencies mapping according to the component's UsageContexts:
@@ -52,9 +49,6 @@ internal class PomDependenciesRewriter(
pomXml: XmlProvider,
includeOnlySpecifiedDependencies: Provider<Set<ModuleCoordinates>>? = null
) {
if (component !is SoftwareComponentInternal)
return
val dependenciesNode = (pomXml.asNode().get("dependencies") as NodeList).filterIsInstance<Node>().singleOrNull() ?: return
val dependencyNodes = (dependenciesNode.get("dependency") as? NodeList).orEmpty().filterIsInstance<Node>()