From 0e17ae7109f338c9e6a1152adc3d33e3ca35adc4 Mon Sep 17 00:00:00 2001 From: LaszloP <7979773+lpusok@users.noreply.github.com> Date: Mon, 1 Sep 2025 15:44:48 +0200 Subject: [PATCH] Fix build settings overwrite issue. --- xcodebuild/show_build_settings.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xcodebuild/show_build_settings.go b/xcodebuild/show_build_settings.go index 31cda3bb..40bd6bee 100644 --- a/xcodebuild/show_build_settings.go +++ b/xcodebuild/show_build_settings.go @@ -96,6 +96,9 @@ func (c ShowBuildSettingsCommandModel) PrintableCmd() string { return command.PrintableCommandArgs(false, cmdSlice) } +// parseBuildSettings parses xcodebuild -showBuildSettings output into a map of build settings. +// When using multi-target schemes, the output may contain multiple entries for the same key. +// In this case, the first occurrence of each key is used, which corresponds to the main target. func parseBuildSettings(out string) (serialized.Object, error) { settings := serialized.Object{} @@ -122,7 +125,10 @@ func parseBuildSettings(out string) (serialized.Object, error) { value := strings.TrimSpace(strings.Join(split[1:], "=")) value = strings.Trim(value, `"`) - settings[key] = value + // Use the first occurrence of each key (the main target in case of multi-target schemes) + if _, exists := settings[key]; !exists { + settings[key] = value + } } buffer.Reset()