From e62e68b008ea13967cd16bef1404c5d1eab42622 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 23 Feb 2024 09:59:00 +0100 Subject: [PATCH] chore(package-managers): Simplify some set constructions Signed-off-by: Sebastian Schuberth --- plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt | 2 +- plugins/package-managers/conan/src/main/kotlin/Conan.kt | 2 +- plugins/package-managers/stack/src/main/kotlin/Stack.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt b/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt index e69284367a98b..89ca744e10a62 100644 --- a/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt +++ b/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt @@ -177,7 +177,7 @@ class CocoaPods( return Package( id = id, authors = emptySet(), - declaredLicenses = podspec.license.takeUnless { it.isEmpty() }?.let { setOf(it) }.orEmpty(), + declaredLicenses = setOfNotNull(podspec.license.takeUnless { it.isEmpty() }), description = podspec.summary, homepageUrl = podspec.homepage, binaryArtifact = RemoteArtifact.EMPTY, diff --git a/plugins/package-managers/conan/src/main/kotlin/Conan.kt b/plugins/package-managers/conan/src/main/kotlin/Conan.kt index 93f5e8204f5e9..ef37e6e0c546e 100644 --- a/plugins/package-managers/conan/src/main/kotlin/Conan.kt +++ b/plugins/package-managers/conan/src/main/kotlin/Conan.kt @@ -488,5 +488,5 @@ class Conan( * author name; otherwise, return an empty set. */ private fun parseAuthors(node: JsonNode): Set = - parseAuthorString(node["author"]?.textValue(), '<', '(')?.let { setOf(it) }.orEmpty() + setOfNotNull(parseAuthorString(node["author"]?.textValue(), '<', '(')) } diff --git a/plugins/package-managers/stack/src/main/kotlin/Stack.kt b/plugins/package-managers/stack/src/main/kotlin/Stack.kt index 97b7dbf56c9f8..778f0c193e05d 100644 --- a/plugins/package-managers/stack/src/main/kotlin/Stack.kt +++ b/plugins/package-managers/stack/src/main/kotlin/Stack.kt @@ -347,7 +347,7 @@ class Stack( .map(String::trim) .filter(String::isNotEmpty) .mapNotNullTo(mutableSetOf(), ::parseAuthorString), - declaredLicenses = map["license"]?.let { setOf(it) }.orEmpty(), + declaredLicenses = setOfNotNull(map["license"]), description = map["description"].orEmpty(), homepageUrl = homepageUrl, binaryArtifact = RemoteArtifact.EMPTY,