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

Đang mở Phù hợp với người mới
#1,202 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
swift
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Bắt đầu với XCRemoteSwiftPackageReference.name, sau đó theo dõi cách XCProjDecoder.makePackageProductDependency sử dụng packagesByName và cách encoder suy ra tên gói. Tái hiện lỗi với URL kho lưu trữ kết thúc bằng .ios_sdk; công việc hoàn tất khi dự án tải được và cách xử lý danh tính gói khớp với việc SwiftPM loại bỏ toàn bộ phần mở rộng đường dẫn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Swift
Star
2.2k
Fork
356
Merge trung bình
4 giờ 48 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tuist/XcodeProj

Tất cả issue của tuist/XcodeProj

Issue tương tự

Thêm issue về Swift

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.