Fix kapt class structure configuration not resolving MPP deps, KT-33105
This commit is contained in:
+5
@@ -325,10 +325,15 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
jvm6MainImplementation("com.google.dagger:dagger:2.24")
|
jvm6MainImplementation("com.google.dagger:dagger:2.24")
|
||||||
kapt("com.google.dagger:dagger-compiler:2.24")
|
kapt("com.google.dagger:dagger-compiler:2.24")
|
||||||
kapt(project(":sample-lib-gradle-kotlin-dsl"))
|
kapt(project(":sample-lib-gradle-kotlin-dsl"))
|
||||||
|
|
||||||
|
// also check incremental Kapt class structure configurations, KT-33105
|
||||||
|
jvm6MainImplementation(project(":sample-lib-gradle-kotlin-dsl"))
|
||||||
}
|
}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// also check incremental Kapt class structure configurations, KT-33105
|
||||||
|
projectDir.resolve("gradle.properties").appendText("\nkapt.incremental.apt=true")
|
||||||
|
|
||||||
// Check Kapt:
|
// Check Kapt:
|
||||||
projectDir.resolve("src/jvm6Main/kotlin/Main.kt").appendText(
|
projectDir.resolve("src/jvm6Main/kotlin/Main.kt").appendText(
|
||||||
|
|||||||
+7
-1
@@ -396,7 +396,13 @@ class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<KotlinCompile> {
|
|||||||
|
|
||||||
maybeRegisterTransform(project)
|
maybeRegisterTransform(project)
|
||||||
val classStructure = project.configurations.create("_classStructure${taskName}")
|
val classStructure = project.configurations.create("_classStructure${taskName}")
|
||||||
project.dependencies.add(classStructure.name, kotlinCompile.classpath)
|
|
||||||
|
// Wrap the `kotlinCompile.classpath` into a file collection, so that, if the classpath is represented by a configuration,
|
||||||
|
// the configuration is not extended (via extendsFrom, which normally happens when one configuration is _added_ into another)
|
||||||
|
// but is instead included as the (lazily) resolved files. This is needed because the class structure configuration doesn't have
|
||||||
|
// the attributes that are potentially needed to resolve dependencies on MPP modules, and the classpath configuration does.
|
||||||
|
project.dependencies.add(classStructure.name, project.files(project.provider { kotlinCompile.classpath }))
|
||||||
|
|
||||||
kaptTask.classpathStructure = classStructure.incoming.artifactView { viewConfig ->
|
kaptTask.classpathStructure = classStructure.incoming.artifactView { viewConfig ->
|
||||||
viewConfig.attributes.attribute(artifactType, CLASS_STRUCTURE_ARTIFACT_TYPE)
|
viewConfig.attributes.attribute(artifactType, CLASS_STRUCTURE_ARTIFACT_TYPE)
|
||||||
}.files
|
}.files
|
||||||
|
|||||||
Reference in New Issue
Block a user