Skip to content

Commit

Permalink
refactor(conan): Inline the parsePackageField() one-liner function
Browse files Browse the repository at this point in the history
This function did not really reduce the amount of code.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Jul 19, 2024
1 parent 45251dc commit 012e9cf
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions plugins/package-managers/conan/src/main/kotlin/Conan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class Conan(
id = id,
authors = parseAuthors(pkgInfo),
declaredLicenses = pkgInfo.license.toSet(),
description = parsePackageField(pkgInfo, workingDir, "description"),
description = inspectField(pkgInfo.displayName, workingDir, "description"),
homepageUrl = homepageUrl,
binaryArtifact = RemoteArtifact.EMPTY, // TODO: implement me!
sourceArtifact = parseSourceArtifact(conanData),
Expand Down Expand Up @@ -356,8 +356,8 @@ class Conan(
Identifier(
type = "Conan",
namespace = "",
name = parsePackageField(pkgInfo, workingDir, "name"),
version = parsePackageField(pkgInfo, workingDir, "version")
name = inspectField(pkgInfo.displayName, workingDir, "name"),
version = inspectField(pkgInfo.displayName, workingDir, "version")
)

/**
Expand All @@ -370,12 +370,6 @@ class Conan(
return if (revision == "0") vcsInfo else vcsInfo.copy(revision = revision)
}

/**
* Return the value of [field] from the output of `conan inspect --raw` for the package in [pkgInfo].
*/
private fun parsePackageField(pkgInfo: PackageInfo, workingDir: File, field: String): String =
inspectField(pkgInfo.displayName, workingDir, field)

/**
* Return the source artifact contained in [conanData], or [RemoteArtifact.EMPTY] if no source artifact is
* available.
Expand Down

0 comments on commit 012e9cf

Please sign in to comment.