From 63ab950f204248716387eb4c4cad69aef684f69f Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 8 Aug 2024 11:17:39 +0200 Subject: [PATCH] fix(conan): Properly inspect null values This is a fixup for 802dfa8. Signed-off-by: Sebastian Schuberth --- .../assets/projects/synthetic/conan-expected-output-py.yml | 2 +- plugins/package-managers/conan/src/main/kotlin/Conan.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/package-managers/conan/src/funTest/assets/projects/synthetic/conan-expected-output-py.yml b/plugins/package-managers/conan/src/funTest/assets/projects/synthetic/conan-expected-output-py.yml index f52e89f6ee19b..45be0f422f1a9 100644 --- a/plugins/package-managers/conan/src/funTest/assets/projects/synthetic/conan-expected-output-py.yml +++ b/plugins/package-managers/conan/src/funTest/assets/projects/synthetic/conan-expected-output-py.yml @@ -1,6 +1,6 @@ --- project: - id: "Conan::poco:null" + id: "Conan::poco:" definition_file_path: "plugins/package-managers/conan/src/funTest/assets/projects/synthetic/conan-py/conanfile.py" declared_licenses: - "BSL-1.0" diff --git a/plugins/package-managers/conan/src/main/kotlin/Conan.kt b/plugins/package-managers/conan/src/main/kotlin/Conan.kt index 16c54734520c5..31c91bad63a35 100644 --- a/plugins/package-managers/conan/src/main/kotlin/Conan.kt +++ b/plugins/package-managers/conan/src/main/kotlin/Conan.kt @@ -32,6 +32,7 @@ import java.io.File import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.contentOrNull import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive @@ -334,7 +335,9 @@ class Conan( } } - return results[field]?.jsonPrimitive?.content + // Note that while the console output of "conan inspect" uses "None" for absent values, the JSON output actually + // uses null values. + return results[field]?.jsonPrimitive?.contentOrNull } /**