Skip to content

Commit

Permalink
refactor(composer): Inline parseArtifact()
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau authored and sschuberth committed Aug 7, 2024
1 parent d6e0ddb commit 00395eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/package-managers/composer/src/main/kotlin/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@ private fun getRuntimeDependencies(packageName: String, lockfile: Lockfile): Set
return emptySet()
}

private fun parseArtifact(packageInfo: PackageInfo): RemoteArtifact =
packageInfo.dist?.let {
RemoteArtifact(url = it.url.orEmpty(), hash = Hash.create(it.shasum.orEmpty()))
}.orEmpty()

private fun parseAuthors(packageInfo: PackageInfo): Set<String> =
packageInfo.authors.mapNotNullTo(mutableSetOf()) { it.name }

Expand Down Expand Up @@ -340,7 +335,12 @@ private fun PackageInfo.toPackage(): Package {
description = description.orEmpty(),
homepageUrl = homepageUrl,
binaryArtifact = RemoteArtifact.EMPTY,
sourceArtifact = parseArtifact(this),
sourceArtifact = dist?.let {
RemoteArtifact(
url = it.url.orEmpty(),
hash = Hash.create(it.shasum.orEmpty())
)
}.orEmpty(),
vcs = vcsFromPackage,
vcsProcessed = processPackageVcs(vcsFromPackage, homepageUrl)
)
Expand Down

0 comments on commit 00395eb

Please sign in to comment.