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

Unexcepted additional .git keyword in XCRemoteSwiftPackageReference #864

Open
powerwolf543 opened this issue Nov 12, 2021 · 4 comments
Open

Comments

@powerwolf543
Copy link

powerwolf543 commented Nov 12, 2021

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.

Screen Shot 2021-11-12 at 3 39 32 PM

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
@zachwaugh
Copy link

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

@mccarron
Copy link

mccarron commented Mar 10, 2022

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 #574 also happens, but that was fixed in the unreleased #861 PR.

@mccarron
Copy link

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.

@Top-Pattarapol
Copy link

do you have any solution for this?, I found same issue🥺

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

No branches or pull requests

4 participants