main.kotlin.org.virtuslab.bazelsteward.app.LibraryToTextFilesMapper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bazel-steward Show documentation
Show all versions of bazel-steward Show documentation
Bazel Steward is a bot that helps you keep your library dependencies, Bazel and Bazel rules up-to-date.
package org.virtuslab.bazelsteward.app
import org.virtuslab.bazelsteward.app.provider.SearchPatternProvider
import org.virtuslab.bazelsteward.core.FileFinder
import org.virtuslab.bazelsteward.core.PathPattern
import org.virtuslab.bazelsteward.core.common.TextFile
import org.virtuslab.bazelsteward.core.library.Library
class LibraryToTextFilesMapper(
private val searchPatternProvider: SearchPatternProvider,
private val fileFinder: FileFinder,
) {
private val cache: MutableMap, List> = mutableMapOf()
fun map(currentLibrary: Library): List {
return searchPatternProvider.resolveForLibrary(currentLibrary).let {
val pathPatternsSet = it.toSet()
cache[pathPatternsSet]
?: fileFinder.find(it).also { fileList ->
cache[pathPatternsSet] = fileList
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy