Skip to content

Commit

Permalink
refactor(bazel): Align on the "to" prefix for several functions
Browse files Browse the repository at this point in the history
Consistently use the "to" prefix for functions which convert from
Bazel's to ORT's model.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Jul 1, 2024
1 parent acdf397 commit f1bc44b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/package-managers/bazel/src/main/kotlin/Bazel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ class Bazel(
description = "",
homepageUrl = metadata?.homepage?.toString().orEmpty(),
binaryArtifact = RemoteArtifact.EMPTY,
sourceArtifact = sourceInfo?.remoteArtifact().orEmpty(),
vcs = metadata?.vcsInfo().orEmpty()
sourceArtifact = sourceInfo?.toRemoteArtifact().orEmpty(),
vcs = metadata?.toVcsInfo().orEmpty()
)

private fun getModuleMetadata(id: Identifier, registry: BazelModuleRegistryService): ModuleMetadata? =
Expand Down Expand Up @@ -206,15 +206,15 @@ private fun String.expandRepositoryUrl(): String =
this
}

private fun ModuleMetadata.vcsInfo() =
private fun ModuleMetadata.toVcsInfo() =
VcsInfo(
type = VcsType.GIT,
url = repository?.firstOrNull().orEmpty().expandRepositoryUrl(),
revision = "",
path = ""
)

private fun ModuleSourceInfo.remoteArtifact(): RemoteArtifact {
private fun ModuleSourceInfo.toRemoteArtifact(): RemoteArtifact {
val (algo, b64digest) = integrity.split("-", limit = 2)
val digest = Base64.getDecoder().decode(b64digest).encodeHex()

Expand Down

0 comments on commit f1bc44b

Please sign in to comment.