From 012e9cf9504d0ed249b2b3480a87f9d41cb9ecd8 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 18 Jul 2024 23:31:40 +0200 Subject: [PATCH] refactor(conan): Inline the `parsePackageField()` one-liner function This function did not really reduce the amount of code. Signed-off-by: Sebastian Schuberth --- .../package-managers/conan/src/main/kotlin/Conan.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/plugins/package-managers/conan/src/main/kotlin/Conan.kt b/plugins/package-managers/conan/src/main/kotlin/Conan.kt index cade116232876..fbac01bf282ee 100644 --- a/plugins/package-managers/conan/src/main/kotlin/Conan.kt +++ b/plugins/package-managers/conan/src/main/kotlin/Conan.kt @@ -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), @@ -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") ) /** @@ -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.