project.xcproj: unresolvedPackage when a repository URL ends in an extension other than .git
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- swift
调研方向
从 XCRemoteSwiftPackageReference.name 开始,然后追踪 XCProjDecoder.makePackageProductDependency 如何使用 packagesByName,以及编码器如何推导包名。使用以 .ios_sdk 结尾的仓库 URL 重现故障;项目能够加载,且包身份处理与 SwiftPM 移除完整路径扩展名的行为一致时,即为完成。
由索引模型根据 Issue 内容生成。
描述
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
- Add
https://github.com/Ometria/ometria.ios_sdkas a package dependency in an Xcode project. - Convert it with
xcodebuild -project App.xcodeproj -convert-project "Xcode Project"(or the Project Format menu in Xcode 27.2). - 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.xcprojsupport
- 主要语言
- Swift
- 星标
- 2.2k
- 派生
- 356
- 平均合并
- 4 小时 48 分钟
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tuist/XcodeProj 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
tuist/XcodeProj#1198 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
tuist/XcodeProj#1137 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 52/100
tuist/XcodeProj#1154 · 2 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
Removing a target referenced by PBXFileSystemSynchronizedBuildFileExceptionSet crashes serialization未关闭
难度 4/5 3-5 天 新手友好度 55/100
tuist/XcodeProj#1093 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
PBXProjEncoder crashes when sorting projectReferences if ProjectRef file element has nil name可能已有人在做 @Ant-tree 于 269 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
tuist/XcodeProj#1055 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
carp-dk/flutter-plugins#1312 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
newrelic/newrelic-flutter-agent#256 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
jhomlala/betterplayer#1646 ·
维护者通常 1 天内回复
-
Feature
难度 2/5 1-3 小时 新手友好度 72/100
amplitude/Amplitude-Flutter#337 · 1 条评论 ·
维护者通常 1 天内回复