Project.pbxproj SPM dependency file comments get replaced with generic labels

I am using this fastlane plugin to get and bump my project version. However, when I use it all the file references to SPM dependencies in my project.pbxproj change automatically so that labels that are specific to the package change to things like SwiftPackageProductDependency, RemoteSwiftPackageReference, and BuildFile . On its own this is not such a big deal since these are just comments (nice to have but not really that important), but these revert back anytime anyone makes a change to the project (e.g. adding, removing, or moving a file in the project). This results in extra changes to discard in git, which is annoying since you have to find the lines in the project file with the changes you want in the middle of a bunch of other changes.

e.g. this:

B21693D8256DC06F00F98045 /* FirebaseMessaging in Frameworks */,
B21693E6256DC0F100F98045 /* FirebaseFirestore in Frameworks */,
B21693A4256DBFB500F98045 /* Segment in Frameworks */,
B2CC9E5325647C8D00AC7158 /* Sentry in Frameworks */,

is converted to:

B21693D8256DC06F00F98045 /* BuildFile in Frameworks */,
B21693E6256DC0F100F98045 /* BuildFile in Frameworks */,
B21693A4256DBFB500F98045 /* BuildFile in Frameworks */,
B2CC9E5325647C8D00AC7158 /* BuildFile in Frameworks */,

and many other similar changes throughout the project file. And these changes revert whenever the project file is modified in Xcode. Note this happens every time I call the methods in the fastlane plugin and the changes revert back every time the project file changes subsequently.

Is there any way to prevent this from happening in the first place or to mitigate it by regenerating the project file from the command line so the changes are cancelled out?

A similar issue was reported on StackOverflow with SwiftLint, but it has no solutions posted. I also created an issue on the repo for the fastlane plugin, but I doubt the issue is caused by the plugin directly.

I tried xcodebuild -resolvePackageDependencies but it doesn't have any effect on these changes.

I tried swift package generate-xcodeproj but I got the error:

error: root manifest not found

I was looking at plugins (like this one) that would let me modify the project from the command line, but adding another dependency just for a hack like this is not ideal, plus I don't even know if I will be able to get it working.

1 Like

Here is the link to the plugin; I can't seem to edit the post anymore.

Note this seems to have been an issue with one of the plugin's dependencies, and it has since been resolved.