[BUG] Local package XCLocalSwiftPackageReference is not getting parsed properly
michalszelagsonos opened this issue · comments
Michal Szelag commented
Describe the bug
I have a xcode project where there is a local package defined as follows:
packageReferences = (
BABB55E92B30EE41003E224D /* XCLocalSwiftPackageReference "Foo" */
);
...
/* Begin XCLocalSwiftPackageReference section */
BABB55E92B30EE41003E224D /* XCLocalSwiftPackageReference "Foo" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = Foo;
};
/* End XCLocalSwiftPackageReference section */
If I load the project and save it like this:
project = pbxproj.XcodeProject.load(project_file)
project.save()
I end up with this:
packageReferences = (
BABB55E92B30EE41003E224D
);
...
/* Begin XCLocalSwiftPackageReference section */
BABB55E92B30EE41003E224D = {
isa = XCLocalSwiftPackageReference;
relativePath = Foo;
};
/* End XCLocalSwiftPackageReference section */
Looks like the comment markers get stripped since there is no XCLocalSwiftPackageReference
object type in the project to support this.
System information
- pbxproj version used:
4.0.0
- python version used:
3.11
- Xcode version used:
15.2
To Reproduce
Steps to reproduce the behavior:
- Add a local dependency to your Xcode project
- Save the project.
- Load the project in python
project = pbxproj.XcodeProject.load("path to your project.pbxproj file") project.save()
- Inspect your
project.pbxproj
file, you will see thatXCLocalSwiftPackageReference
comments are gone in the file.
Expected behavior
Loading and saving the project should preserve the entries, as is.
Michal Szelag commented
Note, I think I know how to fix this, I may take a shot at opening a PR with a fix.