tuist / XcodeProj

📝 Read, update and write your Xcode projects
https://xcodeproj.tuist.io
MIT License
2.03k stars 309 forks source link

Add support for PBXBuildStyle #688

Closed Bigpet closed 2 years ago

Bigpet commented 2 years ago

Context 🕵️‍♀️

I was trying to use Xcodegen to reference a target inside a xcode project generated by cmake.

/* Begin PBXBuildStyle section */
        C3A1C34E5D9A41E99812FB9C /* Release */ = {
            isa = PBXBuildStyle;
            buildSettings = {
                COPY_PHASE_STRIP = NO;
            };
            name = Release;
        };
/* End PBXBuildStyle section */

Later on used in

/* Begin PBXProject section */
        5F89BF4899BD4F768A3616BC /* Project object */ = {
            isa = PBXProject;
            attributes = {
                BuildIndependentTargetsInParallel = YES;
                LastUpgradeCheck = 1340;
            };
            buildConfigurationList = A855B1006B43451EBA296B88 /* Build configuration list for PBXProject "myproj" */;
            buildSettings = {
            };
            buildStyles = (
                C3A1C34E5D9A41E99812FB9C /* Release */,
            );

What 🌱

It could not add a target from the cmake generated xcodeproj as a dependency and just returned the error "The element PBXBuildStyle is not supported."

Proposal 🎉

This element seems like it's the base of XCConfigurationList which is supported, so this element might be able to be handled similarly.

Bigpet commented 2 years ago

this seems related: https://github.com/CocoaPods/CocoaPods/issues/6325

And they appear to mostly blame cmake as the culprit.

In case anyone lands here via google, I used this script from here before the initial generation to make it work. If CMake overwrites it again, it still works until you try to use xcodegen again: https://gist.github.com/Bigpet/9c8f950aa5dd3ad99923d4d98cf87209

Bigpet commented 2 years ago

I got my issue solved by editing the *.xcodeproj file. While I can't find any Reference to the element being "deprecated" or "outdated" officially. Apparently it's just accepted that if the XCode UI of newer versions doesn't generate an element, it's de-facto "outdated".