Skip to content

Fix --legacy flag detection for Xcode 26 beta 2 compatibility#24

Open
davidbean-hash wants to merge 1 commit into
masterfrom
devin/1779386362-fix-legacy-flag-xcode26
Open

Fix --legacy flag detection for Xcode 26 beta 2 compatibility#24
davidbean-hash wants to merge 1 commit into
masterfrom
devin/1779386362-fix-legacy-flag-xcode26

Conversation

@davidbean-hash
Copy link
Copy Markdown
Owner

@davidbean-hash davidbean-hash commented May 21, 2026

Change Description:

Fixes the error when using Xcode 26 beta 2 where xcresulttool requires the --legacy flag for deprecated commands but version detection fails, causing the flag to not be added:

Warning: Could not determine xcresulttool version
Error: Error: This command is deprecated and will be removed in a future release, --legacy flag is required to use it.

Ref: ChargePoint#91

Root cause: In shouldAddLegacyFlag, when Version.xcresulttool() returns nil (version detection fails), the code defaulted to false — meaning --legacy was never added. In Xcode 26 beta 2, the xcresulttool version output format likely changed, breaking the parser.

Changes:

  1. Default shouldAddLegacyFlag to true when version detection fails (XCResultToolCommand.swift): If we can't determine the version, it's safer to assume --legacy is needed. Older Xcode versions parse fine, so this only affects newer unrecognized versions.

  2. Fallback version detection with --legacy (Version+XCPTooling.swift): If xcresulttool version fails or returns unparseable output, retry with xcresulttool version --legacy in case the version command itself is deprecated.

  3. Check stderr for version info (Version+XCPTooling.swift): In case the version output destination changed in newer Xcode.

  4. Add --legacy flag to MetadataGet command (XCResultToolCommand.swift): Was missing from the original --legacy support in PR Add --legacy flag for Xcode 16 compatibility ChargePoint/xcparse#88.

  5. Add legacyFlag parameter to Version command (XCResultToolCommand.swift): Supports the fallback version detection.

  6. Extract version parsing into testable method (Version+XCPTooling.swift): parseXCResultToolVersionString(_:) is now public and testable.

Test Plan/Testing Performed:

  • Added VersionParsingTests.swift with 11 unit tests covering:
    • Standard integer version format (xcresulttool version 23028)
    • Older version format (xcresulttool version 15500)
    • Semantic version formats (23028.0.1, 26000.1)
    • Edge cases: empty string, no version prefix, version-only output, multiline output
    • Version comparison against the deprecated API threshold (above, below, at exact threshold)
  • Updated XCTestManifests.swift for Linux test discovery
  • Cannot run swift build on this Linux VM (macOS-only project) — CI will verify compilation

Link to Devin session: https://app.devin.ai/sessions/fac19a61bc9648dcaa1e8957888a7371
Requested by: @davidbean-hash


Open in Devin Review

When xcresulttool version detection fails (as with Xcode 26 beta 2),
the --legacy flag was not being added to deprecated commands, causing:
  Warning: Could not determine xcresulttool version
  Error: This command is deprecated ... --legacy flag is required

Changes:
- Default shouldAddLegacyFlag to true when version detection fails,
  ensuring forward compatibility with newer Xcode versions
- Add fallback version detection: try 'xcresulttool version --legacy'
  if the standard version command fails or returns unparseable output
- Also check stderr for version info in case output destination changed
- Extract version string parsing into a public testable method
- Add --legacy flag to MetadataGet command (was missing)
- Add legacyFlag parameter to Version command class
- Add unit tests for version string parsing

Fixes: ChargePoint#91
Co-Authored-By: david.bean <david.bean@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

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