Stop removing JavaCompile tasks from project.tasks in common modules
When the JavaCompile tasks were removed from a common project, some of the dependencies on them remained. This could lead to an error during dependencies resolution, such as the one in KT-23092. To an even greater confusion, the remaining dependencies anyway led to the task being added to the task graph. Issue #KT-23092 Fixed
This commit is contained in:
+20
@@ -236,4 +236,24 @@ class MultiplatformGradleIT : BaseGradleIT() {
|
|||||||
assertFileExists(kotlinClassesDir(subproject = "lib") + "META-INF/$moduleName.kotlin_module")
|
assertFileExists(kotlinClassesDir(subproject = "lib") + "META-INF/$moduleName.kotlin_module")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testKt23092() = with(Project("multiplatformProject")) {
|
||||||
|
setupWorkingDir()
|
||||||
|
val successMarker = "Found JavaCompile task:"
|
||||||
|
|
||||||
|
gradleBuildScript("lib").appendText("\n" + """
|
||||||
|
afterEvaluate {
|
||||||
|
println('$successMarker ' + tasks.getByName('compileJava').path)
|
||||||
|
println('$successMarker ' + tasks.getByName('compileTestJava').path)
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
|
||||||
|
build(":lib:tasks") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertContains("$successMarker :lib:compileJava")
|
||||||
|
assertContains("$successMarker :lib:compileTestJava")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
-2
@@ -356,8 +356,6 @@ internal class KotlinCommonSourceSetProcessor(
|
|||||||
project.tasks.findByName(sourceSet.classesTaskName)!!.dependsOn(kotlinTask)
|
project.tasks.findByName(sourceSet.classesTaskName)!!.dependsOn(kotlinTask)
|
||||||
// can be missing (e.g. in case of tests)
|
// can be missing (e.g. in case of tests)
|
||||||
project.tasks.findByName(sourceSet.jarTaskName)?.dependsOn(kotlinTask)
|
project.tasks.findByName(sourceSet.jarTaskName)?.dependsOn(kotlinTask)
|
||||||
val javaTask = project.tasks.findByName(sourceSet.compileJavaTaskName)
|
|
||||||
project.tasks.remove(javaTask)
|
|
||||||
|
|
||||||
appliedPlugins
|
appliedPlugins
|
||||||
.flatMap { it.getSubpluginKotlinTasks(project, kotlinTask) }
|
.flatMap { it.getSubpluginKotlinTasks(project, kotlinTask) }
|
||||||
|
|||||||
Reference in New Issue
Block a user