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

Aperta Adatta ai principianti
#1,202 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
swift

Direzione di ricerca

Inizia da XCRemoteSwiftPackageReference.name, poi segui il modo in cui XCProjDecoder.makePackageProductDependency usa packagesByName e come l’encoder ricava i nomi dei package. Riproduci il problema con un URL del repository che termina con .ios_sdk; il lavoro è completato quando il progetto viene caricato e la gestione dell’identità del package corrisponde alla rimozione dell’estensione completa del percorso da parte di SwiftPM.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Swift
Stelle
2.2k
Fork
356
Merge medio
4h 48m
PR unite (30g)
10

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tuist/XcodeProj

Tutte le issue di tuist/XcodeProj

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.