Skip to content

Commit

Permalink
refactor(bazel)!: Rework collection use for URLs
Browse files Browse the repository at this point in the history
Be concrete when producing lists and lenient when accepting
collections.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Aug 15, 2024
1 parent 37ea3e6 commit fa35e72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions plugins/package-managers/bazel/src/main/kotlin/BazelModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ internal data class Lockfile(
)

/**
* Return a collection with the URLs of the service registries defined for this project in case the model for
* Bazel < 7.2.0 is used.
* Return a list of URLs for the service registries defined for this project in case Bazel < 7.2.0 is used, or an
* empty list otherwise.
*/
fun registryUrls(): Collection<String> = flags?.cmdRegistries.orEmpty()
fun registryUrls(): List<String> = flags?.cmdRegistries.orEmpty()
}

internal fun parseLockfile(lockfile: File) = json.decodeFromString<Lockfile>(lockfile.readText())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class CompositeBazelModuleRegistryService(
* Create a Composite Bazel Module Registry client instance. The wrapped [BazelModuleRegistryService]s are
* created based on the passed in [urls]; local registries use the given [projectDir] as workspace.
*/
fun create(urls: Set<String>, projectDir: File): CompositeBazelModuleRegistryService {
fun create(urls: Collection<String>, projectDir: File): CompositeBazelModuleRegistryService {
val packageNamesForServer = urls.filter { it.endsWith("source.json") }.mapNotNull { url ->
val groups = URL_REGEX.matchEntire(url)?.groups

Expand Down

0 comments on commit fa35e72

Please sign in to comment.