(minor) Move source set configuration creation

It was placed in the new MPP plugin and was therefore not used for
the 'KotlinSourceSet's with the old plugin. Move this logic to the
KotlinSourceSetFactory so that it is applied to all source sets
This commit is contained in:
Sergey Igushkin
2018-08-17 03:18:32 +03:00
parent 42f39a3ea4
commit d1a5794d36
2 changed files with 7 additions and 9 deletions
@@ -103,7 +103,6 @@ internal class KotlinMultiplatformPlugin(
}
private fun configureSourceSets(project: Project) = with (project.kotlinExtension as KotlinMultiplatformExtension) {
sourceSets.all { defineSourceSetConfigurations(project, it) }
val production = sourceSets.create(KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME)
val test = sourceSets.create(KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME)
@@ -156,10 +155,4 @@ internal class KotlinMultiplatformPlugin(
}
}
}
private fun defineSourceSetConfigurations(project: Project, sourceSet: KotlinSourceSet) = with (project.configurations) {
sourceSet.relatedConfigurationNames.forEach { configurationName ->
maybeCreate(configurationName)
}
}
}
@@ -28,8 +28,13 @@ internal abstract class KotlinSourceSetFactory<T : KotlinSourceSet> internal con
project.file("src/$sourceSetName")
protected open fun setUpSourceSetDefaults(sourceSet: T) {
with(sourceSet) {
sourceSet.kotlin.srcDir(File(defaultSourceLocation(sourceSet.name), "kotlin"))
sourceSet.kotlin.srcDir(File(defaultSourceLocation(sourceSet.name), "kotlin"))
defineSourceSetConfigurations(project, sourceSet)
}
private fun defineSourceSetConfigurations(project: Project, sourceSet: KotlinSourceSet) = with (project.configurations) {
sourceSet.relatedConfigurationNames.forEach { configurationName ->
maybeCreate(configurationName)
}
}