Skip to content

fix: write */ in a comment as (*)/, as Xcode does - #1206

Open
lacostej wants to merge 1 commit into
tuist:mainfrom
lacostej:fix-comment-end
Open

lacostej wants to merge 1 commit into
tuist:mainfrom
lacostej:fix-comment-end

Conversation

@lacostej

Copy link
Copy Markdown

Short description 📝

A group or target whose name contains */ is written as /* Group */ Name */: the comment ends early, and neither XcodeProj, plutil nor Xcode can open the project afterwards (Expected terminating ')' for array).

Solution 📦

PBXProjEncoder.write(comment:) writes */ as (*)/, as Xcode 26.3 does (/* Group (*)/ Name */). Values are not changed, so the name still reads back as Group */ Name. Comments without */ skip the replace. The same fix is proposed for CocoaPods in CocoaPods/Nanaimo#75 and CocoaPods/Xcodeproj#1064.

Implementation 👩‍💻👨‍💻

  • Escape */ in write(comment:)
  • Test: a group in the iOS fixture renamed to Group */ Name is written with (*)/ and decodes back; it fails without the fix
  • mise run test and mise run lint pass; a project written with the fix passes plutil -lint and xcodebuild -list

A group named `Group */ Name` was written as `/* Group */ Name */`, which ends the comment early: neither XcodeProj, plutil nor Xcode could open the project afterwards.

This branch has not been deployed

No deployments
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