[Gradle] CompilationDetails: Use source set hierarchy instead of compilations to determine common sources

^KKT-50161 Verification Pending
This commit is contained in:
Sebastian Sellmair
2022-08-25 15:47:56 +02:00
committed by Space
parent ab73251af0
commit 794c9d16a3
2 changed files with 3 additions and 6 deletions
@@ -287,7 +287,9 @@ open class DefaultCompilationDetails<T : KotlinCommonOptions>(
addSourcesToCompileTask(
sourceSet,
addAsCommonSources = lazy {
CompilationSourceSetUtil.sourceSetsInMultipleCompilations(project).contains(sourceSet.name)
target.project.kotlinExtension.sourceSets.any { otherSourceSet ->
sourceSet in otherSourceSet.dependsOn
}
}
)
@@ -282,11 +282,6 @@ internal object CompilationSourceSetUtil {
return compilationNamesBySourceSetName.get()
}
fun sourceSetsInMultipleCompilations(project: Project) =
compilationsBySourceSets(project).mapNotNullTo(mutableSetOf()) { (sourceSet, compilations) ->
sourceSet.name.takeIf { compilations.size > 1 }
}
}
private val invalidModuleNameCharactersRegex = """[\\/\r\n\t]""".toRegex()