Skip to content

[STEP-2562] Parse xcodebuild_options into typed options - #358

Open
lpusok wants to merge 1 commit into
STEP-2562-2-build-exportfrom
STEP-2562-3-parse
Open

lpusok wants to merge 1 commit into
STEP-2562-2-build-exportfrom
STEP-2562-3-parse

Conversation

@lpusok

@lpusok lpusok commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

SplitAdditionalOptions splits the xcodebuild_options input with POSIX shell rules
(go-shellquote's Split, which the steps have always used on it), and
ParseAdditionalOptions reads the arguments as xcodebuild does:

  • every argument is a switch, a flag with a value (-flag value, -flag:value), a user
    default (-Key=value), a build setting (NAME=value, split at the first "="), or a build
    action; there is no dictionary of xcodebuild flags, so flags of a newer Xcode work;
  • a flag takes the next argument as its value unless that is a flag, a NAME=value or an
    action; a short hint list of flags whose values can look like one (-destination
    platform=..., -scheme test, -derivedDataPath build) always takes it;
  • what fits no form is kept verbatim as Unknown with the reason (an empty argument, a flag
    quoted together with its value, a bare word from an unquoted value with spaces);
  • parsing round-trips: Args() gives back the arguments it was given.

Options.Filter selects by kind, for steps that forward part of the options, such as
xcode-archive's build settings and package flags for -showBuildSettings.

The builders still append the options verbatim; nothing here changes a command line.

🤖 Generated with Claude Code

SplitAdditionalOptions splits the xcodebuild_options input with POSIX shell rules
(go-shellquote's Split, which the steps have always used on it), and
ParseAdditionalOptions reads the arguments as xcodebuild does:

- every argument is a switch, a flag with a value (-flag value, -flag:value), a user
  default (-Key=value), a build setting (NAME=value, split at the first "="), or a build
  action; there is no dictionary of xcodebuild flags, so flags of a newer Xcode work;
- a flag takes the next argument as its value unless that is a flag, a NAME=value or an
  action; a short hint list of flags whose values can look like one (-destination
  platform=..., -scheme test, -derivedDataPath build) always takes it;
- what fits no form is kept verbatim as Unknown with the reason (an empty argument, a flag
  quoted together with its value, a bare word from an unquoted value with spaces);
- parsing round-trips: Args() gives back the arguments it was given.

Options.Filter selects by kind, for steps that forward part of the options, such as
xcode-archive's build settings and package flags for -showBuildSettings.

The builders still append the options verbatim; nothing here changes a command line.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unknown-option diagnostics are inaccessible to consumers of the public parsing API.

1 open finding
What changed in this PR

Adds typed parsing and filtering for shell-split xcodebuild_options while preserving argument round-tripping.

Changes:

  • Classifies switches, value options, defaults, settings, actions, and unknown arguments.
  • Adds filtering, keying, rendering, and comprehensive parser tests.
  • Adds go-shellquote for POSIX-compatible splitting.
File Description
xcodecommand/​xcodebuild.go Defines recognized build actions.
xcodecommand/​options.go Implements splitting, parsing, classification, and filtering.
xcodecommand/​options_test.go Tests parser behavior and round-tripping.
go.mod Adds the shell-splitting dependency.
go.sum Records dependency checksums.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread xcodecommand/options.go
Kind Kind
Name string
Value string
issue issue // why an Unknown option was not parsed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants