diff --git a/jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt b/jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt index 695b2ed1e..c0b9e0fae 100644 --- a/jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt +++ b/jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt @@ -126,20 +126,27 @@ fun loadEtsProjectFromIR( projectFilesPath: Path, sdkFilesPath: Path?, ): EtsScene { - val walker = { irFolder: Path -> - irFolder.walk() - .filter { it.extension == "json" } - .map { - it.inputStream().use { stream -> - val etsFileDto = EtsFileDto.loadFromJson(stream) - convertToEtsFile(etsFileDto) - } - } - .toList() - } - val projectFiles = walker(projectFilesPath) val sdkFiles = sdkFilesPath?.let { walker(it) }.orEmpty() return EtsScene(projectFiles, sdkFiles) } + +fun loadEtsProjectFromMultipleIR(input: List, sdkPaths: List): EtsScene { + val projectFiles = input.flatMap(walker) + val sdkFiles = sdkPaths.flatMap(walker) + + return EtsScene(projectFiles, sdkFiles) +} + +private val walker = { irFolder: Path -> + irFolder.walk() + .filter { it.extension == "json" } + .map { + it.inputStream().use { stream -> + val etsFileDto = EtsFileDto.loadFromJson(stream) + convertToEtsFile(etsFileDto) + } + } + .toList() +}