Package.resolved isn't versioned; How are deterministic Package versions achieved?
(Xcodegen version 2.10.1)
Hey!
I'm trying to migrate our iOS project that uses Xcodegen, to start using a SwiftPM library we use internally. As part of doing this, I am specifying, in my project.yml, the SwiftPM dependency to use.
However, in trying to attempt this, I run into the following problem that is fundamentally at odds with Xcodegen:
- From this article I understand that the
Package.resolvedfile--used for making sure all developers are using the same version of packages is stored in the.xcodeprojdirectory. Here's the relevant quote:
You can find the Package.resolved file inside your .xcodeproj directory at [appName].xcodeproj/project.workspace/xcshareddata/swiftpm/Package.resolved
- However, the premise of using Xcodegen is that the repository is able to discard the
.xcodeprojfolder and related artefacts. So thePackage.resolvedfile can also not be checked in. - How then do developers of a repository get deterministically same versions of their dependencies? I may be missing something here.
Hi @mayurdhaka-suryasoftware.
While you don't need to check in the whole xcodeproj, you must check in the Package.resolved file as mentioned here https://github.com/yonaskolb/XcodeGen/blob/master/Docs/Usage.md#swift-package
You can do so with something like the following in your .gitignore:
MyProject.xcodeproj/**
!MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
we somehow had to do a staircase of ignored and non ignored:
!/MyProject.xcodeproj/project.xcworkspace
/MyProject.xcodeproj/project.xcworkspace/*
!/MyProject.xcodeproj/project.xcworkspace/xcshareddata
/MyProject.xcodeproj/project.xcworkspace/xcshareddata/*
!/MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
/MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/*
!/MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
If you ONLY wish to check in the Package.resolved, we did the same as @paulz with just the one additional line at the beginning:
MyProject.xcodeproj/**
!MyProject.xcodeproj/project.xcworkspace
MyProject.xcodeproj/project.xcworkspace/*
!MyProject.xcodeproj/project.xcworkspace/xcshareddata
MyProject.xcodeproj/project.xcworkspace/xcshareddata/*
!MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/*
!MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved