project.xcproj: unresolvedPackage when a repository URL ends in an extension other than .git

Open Beginner friendly
#1,202 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
swift

Research direction

Start with XCRemoteSwiftPackageReference.name, then trace how XCProjDecoder.makePackageProductDependency uses packagesByName and how the encoder derives package names. Reproduce the failure with a repository URL ending in .ios_sdk; done means the project loads and package identity handling matches SwiftPM's removal of the full path extension.

Written by the indexing model from the issue text.

Description

Summary

Decoding a project.xcproj fails with XCProjError.unresolvedPackage when a remote package's repository URL ends in a path extension other than .git. Xcode 27.2 writes the package's SwiftPM identity into package-product-members, but XCProjDecoder looks packages up by XCRemoteSwiftPackageReference.name, which only strips .git.

Reproduction

  1. Add https://github.com/Ometria/ometria.ios_sdk as a package dependency in an Xcode project.
  2. Convert it with xcodebuild -project App.xcodeproj -convert-project "Xcode Project" (or the Project Format menu in Xcode 27.2).
  3. Load the project with XcodeProj (we hit it through Periphery).

The converted file contains:

"packages": [
  {
    "kind": "remote",
    "repository": "https://github.com/Ometria/ometria.ios_sdk",
    "version": { "up-to-next-major-version": "1.9.1" },
  },
],
...
"package-product-members": [
  {
    "package": "ometria",
    "product-name": "Ometria",
    "build-phase": { "build-phase": "frameworks" },
  },
],

Actual

Error: (XCProjError) The project has no Swift package named 'ometria'

Expected

The project loads. Xcode and xcodebuild -list read the same file without problems.

Cause

XCRemoteSwiftPackageReference.name is:

repositoryURL?.split(separator: "/").last?.replacingOccurrences(of: ".git", with: "")

which gives ometria.ios_sdk. Xcode drops the whole path extension, as SwiftPM does when deriving a package identity from a URL, giving ometria. Other packages in the same project keep their casing (MobileSDK-iOS), so only the extension handling differs. XCProjDecoder.makePackageProductDependency then misses packagesByName["ometria"].

Deriving the name used by packagesByName (and by the encoder) with the path extension removed, instead of only .git, would fix it.

Environment

  • Xcode 27.2 (27B52)
  • Periphery 1.0.0.beta.9 with XcodeProj's project.xcproj support
Dominant language
Swift
Stars
2.2k
Forks
356
Avg merge
4h 48m
Merged PRs (30d)
10

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tuist/XcodeProj

All issues in tuist/XcodeProj

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.