Change classes task naming and create additional task for IDE runner
Issue #KT-26641 Fixed
This commit is contained in:
+14
@@ -94,6 +94,10 @@ internal abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
|||||||
open fun run() {
|
open fun run() {
|
||||||
addKotlinDirectoriesToJavaSourceSet()
|
addKotlinDirectoriesToJavaSourceSet()
|
||||||
doTargetSpecificProcessing()
|
doTargetSpecificProcessing()
|
||||||
|
|
||||||
|
if (kotlinCompilation is KotlinWithJavaCompilation) {
|
||||||
|
createAdditionalClassesTaskForIdeRunner()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addKotlinDirectoriesToJavaSourceSet() {
|
private fun addKotlinDirectoriesToJavaSourceSet() {
|
||||||
@@ -127,6 +131,16 @@ internal abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
|||||||
return getSourceDirectories(sourceDirectorySet).minus(getSourceDirectories(javaSourceSet.java))
|
return getSourceDirectories(sourceDirectorySet).minus(getSourceDirectories(javaSourceSet.java))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createAdditionalClassesTaskForIdeRunner() {
|
||||||
|
// Workaround: as per KT-26641, when there's a Kotlin compilation with a Java source set, we create another task
|
||||||
|
// that has a name composed as '<IDE module name>Classes`, where the IDE module name is the default source set name:
|
||||||
|
val expectedClassesTaskName = "${kotlinCompilation.defaultSourceSetName}Classes"
|
||||||
|
project.tasks.run {
|
||||||
|
if (findByName(expectedClassesTaskName) == null)
|
||||||
|
create(expectedClassesTaskName) { task -> task.dependsOn(getByName(kotlinCompilation.compileAllTaskName)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract fun doCreateTask(project: Project, taskName: String): T
|
protected abstract fun doCreateTask(project: Project, taskName: String): T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -130,11 +130,7 @@ abstract class AbstractKotlinCompilation(
|
|||||||
)
|
)
|
||||||
|
|
||||||
override val compileAllTaskName: String
|
override val compileAllTaskName: String
|
||||||
get() = lowerCamelCaseName(
|
get() = lowerCamelCaseName(target.disambiguationClassifier, compilationName, "classes")
|
||||||
target.disambiguationClassifier,
|
|
||||||
compilationName.takeIf { it != KotlinCompilation.MAIN_COMPILATION_NAME },
|
|
||||||
"classes"
|
|
||||||
)
|
|
||||||
|
|
||||||
override lateinit var compileDependencyFiles: FileCollection
|
override lateinit var compileDependencyFiles: FileCollection
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user