Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion xcodebuild/show_build_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand All @@ -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()
Expand Down