Skip to content
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

xcodeproj_extensions: fix wrong serialization with local swift packages. #122

Conversation

barakwei
Copy link
Member

@barakwei barakwei commented Sep 15, 2024

In case of a local Swift package, xcodeproj wrongfully uses the
File.basename of the path and Xcode fixes that to be the full path.
This commit patches the xcodeproj implementation and fixes it.

Below is an example before and after the change.

before (wrong):

/* Begin XCLocalSwiftPackageReference section */
                BA78EB3B2C889B20000D85B2 /* XCLocalSwiftPackageReference "Package" */ = {
                        isa = XCLocalSwiftPackageReference;
                        relativePath = ../Path/To/Package;
                };

after (correct)

/* Begin XCLocalSwiftPackageReference section */
                BA78EB3B2C889B20000D85B2 /* XCLocalSwiftPackageReference "../Path/To/Package" */ = {
                        isa = XCLocalSwiftPackageReference;
                        relativePath = ../Path/To/Package;
                };

Copy link
Member

@ashdnazg ashdnazg left a comment

Choose a reason for hiding this comment

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

F&S&M

# The original implemenation is `" #{isa} \"#{File.basename(display_name)}\"` so that means that if we have a
# relative path which is Path/To/Package, the item will be serialized as `XCLocalSwiftPackageReference "Package"`.
# And Xcode will automatically fix this to be `XCLocalSwiftPackageReference "Path/To/Package"`.
# So, we need to patch the implementationa and make sure the whole path is used.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# So, we need to patch the implementationa and make sure the whole path is used.
# So, we need to patch the implementation and make sure the whole path is used.

In case of a local Swift package, xcodeproj wrongfully uses the
`File.basename` of the path and Xcode fixes that to be the full path.
This commit patches the xcodeproj implementation and fixes it.

Below is an example before and after the change.

before (wrong):
/* Begin XCLocalSwiftPackageReference section */
                BA78EB3B2C889B20000D85B2 /* XCLocalSwiftPackageReference "Package" */ = {
                        isa = XCLocalSwiftPackageReference;
                        relativePath = ../Path/To/Package;
                };

after (correct)
/* Begin XCLocalSwiftPackageReference section */
                BA78EB3B2C889B20000D85B2 /* XCLocalSwiftPackageReference "../Path/To/Package" */ = {
                        isa = XCLocalSwiftPackageReference;
                        relativePath = ../Path/To/Package;
                };
@barakwei barakwei force-pushed the feature/fix-local-switch-package-path-serialization branch from 7e032d7 to 90117e1 Compare September 16, 2024 06:43
@barakwei barakwei merged commit 2fabf9b into Lightricks:main Sep 16, 2024
4 checks passed
@barakwei barakwei deleted the feature/fix-local-switch-package-path-serialization branch September 16, 2024 06:45
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.

2 participants