Xcodeproj
Xcodeproj copied to clipboard
Unexcepted additional .git keyword in XCRemoteSwiftPackageReference
Xcodeproj version: 1.20.0
I want to update the version of a swift package. Hence I emulated the objects and found the package. Then I modified the version and saved it. But I couldn't open my Xcode project. It seems my .pbxproj
format is incorrect.

Here is my code:
project_path = './myproject.xcodeproj'
if !File.exist?(project_path)
print "Didn't find .xcodeproj file at '#{project_path}'\n"
exit(1)
end
project = Xcodeproj::Project.open(project_path)
project.objects.each do |object|
next unless 'some_package' == object.display_name && object.is_a?(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
object.package.requirement["version"] = '456'
print "display_name: #{object.display_name}, requirement: #{object.package.requirement["version"]}\n"
end
project.save
I'm seeing this as well, but I'm not modifying any Swift package related fields. I'm just updating the MARKETING_VERSION
and saving, and then all my dependencies have the .git
appended. I'm using Xcodeproj 1.21.0
and Xcode 13.1
. This didn't seem to mess up the project file or prevent me from opening, but would hope that unrelated properties wouldn't be modified during save.
project.build_configurations.each do |configuration|
configuration.build_settings["MARKETING_VERSION"] = new_version
end
project.save
This is happening to us with Cocoapods just doing a pod install
and even with removed any post-install hooks.
It doesn't throw errors but then Xcode changes it back. A constant back and forth over PRs that include different versions of the change. This change and https://github.com/CocoaPods/Xcodeproj/issues/574 also happens, but that was fixed in the unreleased #861 PR.
I just figured it out, as it was only happening to some of our packages, not all of them.
It was only happening to projects with .git
at the end of the XCRemoteSwiftPackageReference
repositoryURL
. So to avoid this going forward, I removed the.git
from those URLs. Ran pod install
again and did an Xcode build. Now all is well between both tools with the naming of those references.
Hopefully this helps someone else.
do you have any solution for this?, I found same issue🥺