Skip to content

Xcode 16 "folder style" projects #880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mickeyl opened this issue Nov 8, 2024 · 15 comments
Closed

Xcode 16 "folder style" projects #880

mickeyl opened this issue Nov 8, 2024 · 15 comments

Comments

@mickeyl
Copy link

mickeyl commented Nov 8, 2024

With Xcode 16, Apple has set the folder style (instead of group style) as the default for the Xcode project file organisation.

With these kinds of projects, XcodeProj no longer seems to find any resource files.

@mickeyl
Copy link
Author

mickeyl commented Nov 8, 2024

Sorry, this might just be a duplicate of #852?

@AliTavakoliFFW
Copy link

I face the same problem, our project is using now the FolderStructure with xcode 16, therefore I think, it can't be read by XcodeProj.

@dusi
Copy link

dusi commented Jan 6, 2025

We have recently experienced similar issue which makes it seem like XcodeProj does not support FileSystemSynchronizedGroup on the workspace scope 🤔

For us this has manifested by attempting to use periphery which has a dependency on tuist's XcodeProj.

I'm attaching the same sample project just in case there's an "easy" fix for this.
Sample.zip

@lukecharman
Copy link

Looks like we have a PR to fix it sitting behind a small linting error – hoping we can see this merged and released soon! :)

@mickeyl
Copy link
Author

mickeyl commented Mar 4, 2025

Did that PR make it into the newest release?

@fortmarek
Copy link
Member

Yes, we have an automated release process, so what has been merged, has also been released.

Correct me if I'm wrong, but I believe we can close this one.

@AliTavakoliFFW
Copy link

I tried the new Version 8.27.3 and I still get nothing from sourceFiles() and resourcesBuildPhase()?.files(), no files.

@mickeyl
Copy link
Author

mickeyl commented Mar 11, 2025

Yeah, I'm seeing the same behavior here. @fortmarek Can we please reopen the issue?

@fortmarek
Copy link
Member

Sure, contribution would be welcome here 🙂

@fortmarek fortmarek reopened this Mar 13, 2025
@kwridan
Copy link
Collaborator

kwridan commented Mar 13, 2025

This appears to be a quirk of the Xcode project format as opposed to a bug in XcodeProj.

Inspecting the raw contents of the pbxproj file when buildable folders (sync groups) are used, there doesn't appear to be any references to those folder in the sources build phase 🤔

/* Begin PBXSourcesBuildPhase section */
		FB17F7312D82E1C5005A08D0 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

@fortmarek
Copy link
Member

Inspecting the raw contents of the pbxproj file when buildable folders (sync groups) are used, there doesn't appear to be any references to those folder in the sources build phase 🤔

Yeah, the files are not represented in the pbxproj since that's dynamic and resolved by Xcode based on the synchronized group. To expand the files is not a responsibility of XcodeProj ... so I'm closing this again 😅

@mickeyl
Copy link
Author

mickeyl commented Mar 18, 2025

Ok, good for XcodeProj, bad for clients though. I wonder whether XcodeProj at least could assist these cases, i.e. with API that tells you that there is a folder (where?) we have to traverse manually.

@fortmarek
Copy link
Member

I wonder whether XcodeProj at least could assist these cases, i.e. with API that tells you that there is a folder (where?) we have to traverse manually.

You need to get the synchronized groups and expand the sources. We already do this in XcodeGraph: https://github.com/tuist/XcodeGraph/blob/bcbef4b34953a594adec24c472c24a2a4c6fce25/Sources/XcodeGraphMapper/Mappers/Targets/PBXTargetMapper.swift#L369-L407

fwiw, XcodeProj is a low-level library that's meant to be 1-1 mapping of the pbxproj format. For higher-level modifications, XcodeGraph might be a library you might want to look into, depending on what you're doing.

@mickeyl
Copy link
Author

mickeyl commented Mar 18, 2025

@fortmarek Thank you, that does look like an interesting option. My use case is https://github.com/kaandedeoglu/Shark ­which I'm currently maintaining. It's a statically-typed resource generator, much like R.swift or SwiftGen and I'm using XcodeProj there to get hold of the resource source files.

@AliTavakoliFFW
Copy link

@fortmarek Thanks for the response, I'm gonna check your alternative suggestion.

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

No branches or pull requests

6 participants