Skip to content

Conversation

@michaelversus
Copy link
Collaborator

@michaelversus michaelversus commented Nov 26, 2025

Resolves #921

Short description 📝

This MR fixes an issue with projects that use the new format, where for build phases, a shell script is an array of strings instead of a string.

Solution 📦

I am deserializing the script with a fallback approach.
If we fail deserializing using the String type we are trying the [String] type to ensure that I will not break old xcode version format

Implementation 👩‍💻👨‍💻

  • Step 1 (Introduce extra decoding handling for shellScript property of PBXShellScriptBuildPhase)
  • Step 3 (Removed unused testDictionary function from PBXShellScriptBuildPhaseTests)
  • Step 3 (Introduce new fixture and update unit tests)

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 26, 2025
@michaelversus michaelversus changed the title fix https://github.com/tuist/XcodeProj/issues/921 fix issue with Xcode 16 format and shellScript Nov 26, 2025
@michaelversus
Copy link
Collaborator Author

michaelversus commented Nov 27, 2025

@fortmarek @cschmatzler @asmitbm, please check when you can. Thank you!

@ileitch
Copy link
Contributor

ileitch commented Dec 20, 2025

Hey all, any progress on this? /cc @pepicrft

isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticed this is another change in Xcode 26. I created an issue for it to tackle separately.


/// Shell script.
public var shellScript: String?
public var shellScript: Either<String, [String]>?
Copy link
Contributor

Choose a reason for hiding this comment

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

The change introduced by Xcode 26 is a breaking change, which explains why it's breaking here too, but I was wondering if we should take a different approach that wouldn't require creating a major version of tuist/XcodeProj. Thoughts @tuist/engineering ?

Copy link
Member

Choose a reason for hiding this comment

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

based on the original issue, each newline represents a new element ... which makes me think, do we need to keep the representation 1-1? Or can we keep the type as String? and just handle this scenario when decoding/encoding?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we can preserve the format that we read from the project such that we can write back causing no diffs, then yeah. We can maybe have a private property that captures that?

Copy link
Member

Choose a reason for hiding this comment

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

would first try if following the newline convention would be enough, but if needed, we could use a private property.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will keep the String? as you mentioned @fortmarek. Pushing changes in a minute

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Check again please @pepicrft @fortmarek.

Copy link
Collaborator Author

@michaelversus michaelversus Dec 22, 2025

Choose a reason for hiding this comment

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

I avoided to add the extra private property. I am not sure we need it. I am missing some use cases on when we are encoding the PBXShellScriptBuildPhase model most probably.

@pepicrft
Copy link
Contributor

Hey all, any progress on this? /cc @pepicrft

I completely missed this one. Thanks for the ping @ileitch

Let's address figure out the best path for this first (cc @fortmarek )

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 22, 2025
Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Thanks! this looks good 😌

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 24, 2025
@fortmarek fortmarek changed the title fix issue with Xcode 16 format and shellScript fix: support for shellScript in the Xcode 16 format Dec 24, 2025
@pepicrft pepicrft merged commit bc3ec50 into tuist:main Dec 26, 2025
6 of 8 checks passed
@dosubot
Copy link

dosubot bot commented Dec 26, 2025

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@pepicrft
Copy link
Contributor

Thanks a lot @michaelversus 🚀. Release in progress...

@pepicrft
Copy link
Contributor

@all-contributors add @michaelversus for code

@allcontributors
Copy link
Contributor

@pepicrft

I've put up a pull request to add @michaelversus! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

4 participants