Skip to content

Add xcodebuild output formatter with config file support - #3

Merged
phuongddx merged 5 commits into
mainfrom
feature/xcodebuild-output-formatter
Dec 6, 2025
Merged

Add xcodebuild output formatter with config file support#3
phuongddx merged 5 commits into
mainfrom
feature/xcodebuild-output-formatter

Conversation

@phuongddx

Copy link
Copy Markdown
Owner

Summary

Adds real-time xcodebuild output streaming with automatic formatter detection (xcbeautify/xcpretty) and configuration file support for verbose mode.

Changes

1. Xcodebuild Output Formatter

  • New: lib/xcframework_cli/xcodebuild/formatter.rb
    • Auto-detects xcbeautify or xcpretty availability
    • Streams xcodebuild output in real-time when verbose mode enabled
    • Pipes output through formatters for colored, formatted display
    • Falls back to plain streaming if no formatter available

2. Wrapper Integration

  • Updated: lib/xcframework_cli/xcodebuild/wrapper.rb
    • Integrate formatter into execute method
    • Add use_formatter parameter to archive and create-xcframework commands
    • Stream output when verbose mode is enabled
    • Maintain backward compatibility

3. Configuration Support

  • Updated: lib/xcframework_cli/config/defaults.rb
    • Add verbose: false and use_formatter: true defaults
  • Updated: lib/xcframework_cli/config/schema.rb
    • Validate new build options in config files

4. Build Pipeline Integration

  • Updated: lib/xcframework_cli/cli/commands/build.rb
    • Read verbose setting from config file
    • CLI options override config file settings
    • Apply verbose mode to logger before build starts
  • Updated: lib/xcframework_cli/builder/orchestrator.rb
    • Pass use_formatter option to archiver
  • Updated: lib/xcframework_cli/builder/archiver.rb
    • Forward formatter options to xcodebuild wrapper

5. Documentation

  • Updated: config/examples/basic.yml
    • Document verbose and use_formatter options
  • Updated: Example/SwiftyBeaver/.xcframework.yml
    • Enable verbose mode in example

Usage

Via Config File (New!)

```yaml
build:
verbose: true # Enable verbose output
use_formatter: true # Use xcbeautify/xcpretty
```

```bash
./bin/xcframework-cli build --config .xcframework.yml
```

Via CLI Flag (Existing)

```bash
./bin/xcframework-cli build --project MySDK.xcodeproj --verbose
```

What You See

✅ Real-time build logs:

  • `[MySDK] Linking MySDK`
  • `[MySDK] Generating MySDK.framework.dSYM`
  • Compilation progress, warnings, errors

✅ Automatic formatter detection:

  • Prefers xcbeautify → xcpretty → plain output

✅ Color-coded output:

  • Warnings in yellow
  • Errors in red
  • Success in green

Testing

109 unit tests - All passing
Config file mode - Verbose works from config
CLI override - CLI flags override config settings
Formatter detection - xcbeautify auto-detected
Real-time streaming - Build logs appear as they happen

Breaking Changes

None. All changes are backward compatible.

- Auto-detects xcbeautify or xcpretty availability
- Streams xcodebuild output in real-time when verbose mode enabled
- Falls back to plain streaming if no formatter available
- Supports piping through formatters for colored, formatted output
- Update execute method to support streaming and formatter options
- Add use_formatter parameter to execute_archive and execute_create_xcframework
- Stream output in real-time when verbose mode is enabled
- Preserve backward compatibility with existing code
- Add verbose and use_formatter to build defaults
- Update schema to validate new build options
- verbose: boolean to enable verbose output
- use_formatter: boolean or string to control output formatting
- Update CLI to read verbose setting from config file
- CLI options override config file settings
- Pass use_formatter option through orchestrator to archiver
- Archiver forwards options to xcodebuild wrapper
- Enable real-time build logs via config file
- Add verbose and use_formatter to basic.yml example
- Enable verbose mode in SwiftyBeaver example config
- Document formatter options (true, false, or specific formatter name)
@phuongddx
phuongddx merged commit d52894c into main Dec 6, 2025
1 check failed
@phuongddx
phuongddx deleted the feature/xcodebuild-output-formatter branch December 9, 2025 15:02
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.

1 participant